On 7/3/26 1:00 PM, Zhuoying Cai wrote:
> Add address range tracking and overlap checks to ensure that no
> component overlaps with a signed component during secure IPL.
>
> Signed-off-by: Zhuoying Cai <[email protected]>
> Reviewed-by: Jared Rossi <[email protected]>
> ---
...
> --- a/pc-bios/s390-ccw/secure-ipl.h
> +++ b/pc-bios/s390-ccw/secure-ipl.h
> @@ -112,4 +112,10 @@ static inline bool
> verify_signature(IplDeviceComponentEntry comp_entry,
> return false;
> }
>
> +static inline bool intersects(uint64_t addr0, uint64_t size0,
> + uint64_t addr1, uint64_t size1)
> +{
> + return addr0 + size0 > addr1 && addr1 + size1 > addr0;
Another way to do this to avoid any possibility of u64 overflow
would be to use subtraction:
if (addr1 > addr0)
return addr1 - addr0 < size0;
return addr0 - addr1 < size1;
With something like that:
Reviewed-by: Matthew Rosato <[email protected]>