Thread (35 messages) 35 messages, 8 authors, 2016-09-06

Re: [PATCH v3 3/6] bpf: add BPF_PROG_ATTACH and BPF_PROG_DETACH commands

From: Daniel Mack <daniel@zonque.org>
Date: 2016-09-05 15:40:13

On 09/05/2016 05:30 PM, David Laight wrote:
From: Daniel Mack
quoted
quoted
quoted
+
+	struct { /* anonymous struct used by BPF_PROG_ATTACH/DETACH commands */
+		__u32		target_fd;	/* container object to attach to */
+		__u32		attach_bpf_fd;	/* eBPF program to attach */
+		__u32		attach_type;	/* BPF_ATTACH_TYPE_* */
+		__u64		attach_flags;
+	};
there is a 4 byte hole in this struct. Can we pack it differently?
Okay - I swapped "type" and "flags" to repair this.
That just moves the pad to the end of the structure.
Still likely to cause a problem for 32bit apps on a 64bit kernel.
What kind of problem do you have in mind? Again, this is embedded in a
union of much bigger total size, and the API is not used in any kind of
hot-path.
If you can't think of any flags, why 64 of them?
I can't think of them right now, but this is about defining an API that
can be used in other context as well. Also, it doesn't matter at all,
they don't harm. IMO, it's just better to have them right away than to
do a binary compat dance once someone needs them.


Thanks,
Daniel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help