Skip to contentSkip to conversation

bpf.2: Note that unused fields and padding in bpf_attr must be zero

PATCH In review Jakub Sitnicki 2 participants 3 messages Apr 25, 2022 – Apr 26, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf.2: Note that unused fields and padding in bpf_attr must be zero

In a discussion regarding a potential backward incompatible change [1], Andrii Nakryiko points out that unused bytes of bpf_attr should be zero. Add this bit of information to the bpf(2) man page.

[1] https://lore.kernel.org/bpf/CAEf4BzbT4vQBnZzdD00SuPCDkeb4Cm=F6PLUoO_3X93UQD5hbQ@mail.gmail.com/

---
 man2/bpf.2 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
man2/bpf.2 +1 -1
index 2d257eaa6..ee57226ee 100644
@@ -142,7 +142,7 @@ provided via
 .IR attr ,
 which is a pointer to a union of type
 .I bpf_attr
-(see below).
+(see below). The unused fields and padding must be zeroed out before the call.
 The
 .I size
 argument is the size of the union pointed to by
Signature · 1 line
2.35.1
#1 lore raw

Hi Jakub,

Quoted 7 lines · Jakub Sitnicki

In a discussion regarding a potential backward incompatible change [1], Andrii Nakryiko points out that unused bytes of bpf_attr should be zero. Add this bit of information to the bpf(2) man page.

[1] https://lore.kernel.org/bpf/CAEf4BzbT4vQBnZzdD00SuPCDkeb4Cm=F6PLUoO_3X93UQD5hbQ@mail.gmail.com/

Patch applied.

Thanks,

Alex

Quoted 9 lines
---
  man2/bpf.2 | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
man2/bpf.2 +0 -0
index 2d257eaa6..ee57226ee 100644

man2/bpf.2 provided via · line 145

Quoted 5 lines
man2/bpf.2 +1 -1
@@ -142,7 +142,7 @@ provided via
  .IR attr ,
  which is a pointer to a union of type
  .I bpf_attr
-(see below).
+(see below). The unused fields and padding must be zeroed out before the call.

But I changed it to add a separate line, instead of continuation in the same one.

Quoted 3 lines
man2/bpf.2 +0 -0
  The
  .I size
  argument is the size of the union pointed to by
#2 lore raw

On Mon, Apr 25, 2022 at 11:01 PM +02, Alejandro Colomar wrote:

[...]

Quoted 5 lines
Quoted 5 lines
man2/bpf.2 +0 -0
index 2d257eaa6..ee57226ee 100644
@@ -142,7 +142,7 @@ provided via
Quoted 9 lines

man2/bpf.2 provided via · line 145

Quoted 5 lines
man2/bpf.2 +1 -1
  .IR attr ,
  which is a pointer to a union of type
  .I bpf_attr
-(see below).
+(see below). The unused fields and padding must be zeroed out before the call.

But I changed it to add a separate line, instead of continuation in the same one.

Thanks for the fixup, Alex. I will keep it in mind for the next time.