Re: [PATCH 80/82] xen-netback: Refactor intentional wrap-around test

2024-01-23 Thread Kees Cook
On Tue, Jan 23, 2024 at 08:55:44AM +0100, Jan Beulich wrote: > On 23.01.2024 01:27, Kees Cook wrote: > > --- a/drivers/net/xen-netback/hash.c > > +++ b/drivers/net/xen-netback/hash.c > > @@ -345,7 +345,7 @@ u32 xenvif_set_hash_mapping(struct xenvif *vif, u32 > > gref, u32 len, > >

Re: [PATCH 80/82] xen-netback: Refactor intentional wrap-around test

2024-01-22 Thread Jan Beulich
On 23.01.2024 01:27, Kees Cook wrote: > --- a/drivers/net/xen-netback/hash.c > +++ b/drivers/net/xen-netback/hash.c > @@ -345,7 +345,7 @@ u32 xenvif_set_hash_mapping(struct xenvif *vif, u32 gref, > u32 len, > .flags = GNTCOPY_source_gref > }}; > > - if ((off + len < off)

[PATCH 80/82] xen-netback: Refactor intentional wrap-around test

2024-01-22 Thread Kees Cook
In an effort to separate intentional arithmetic wrap-around from unexpected wrap-around, we need to refactor places that depend on this kind of math. One of the most common code patterns of this is: VAR + value < VAR Notably, this is considered "undefined behavior" for signed and pointer