Re: [PATCH net-next v14 1/5] tun/tap: add IFF_BACKPRESSURE flag
[email protected] Wed, 05 Aug 2026 01:57:33 +0000
| Newsgroups | org.kernel.vger.kvm |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: Pre-existing issues: - [High] UAPI Bit Collision between IFF_NO_PI and IFF_NOFILTER causes silent failure to re-attach socket filters. -- --- Patch [1]: [PATCH net-next v14 1/5] tun/tap: add IFF_BACKPRESSURE flag --- commit a863b69cf20b684debe10f1f06a9f4273abcd009 Author: Simon Schippers <[email protected]> tun/tap: add IFF_BACKPRESSURE flag This commit adds the IFF_BACKPRESSURE flag to the TUN/TAP UAPI headers. The flag acts as an opt-in switch for qdisc backpressure logic. > diff --git a/include/uapi/linux/if_tun.h b/include/uapi/linux/if_tun.h > index 79d53c7a1ebdc..a0ddc50a75342 100644 > --- a/include/uapi/linux/if_tun.h > +++ b/include/uapi/linux/if_tun.h > @@ -69,6 +69,10 @@ > #define IFF_NAPI_FRAGS 0x0020 > /* Used in TUNSETIFF to bring up tun/tap without carrier */ > #define IFF_NO_CARRIER 0x0040 > +/* Stop the queue instead of dropping when the internal ring is full, so an > + * attached qdisc applies backpressure instead of being bypassed. > + */ > +#define IFF_BACKPRESSURE 0x0080 > #define IFF_NO_PI 0x1000 [Severity: High] This is a pre-existing issue, but I noticed that IFF_NO_PI shares the same bit value (0x1000) as IFF_NOFILTER in this header. Does this bit collision cause a silent failure when re-attaching socket filters on persistent TUN/TAP devices? When userspace creates a persistent device and sets IFF_NO_PI, and later re-attaches to it via TUNSETIFF, tun_set_iff() in drivers/net/tun.c evaluates the flags: err = tun_attach(tun, file, ifr->ifr_flags & IFF_NOFILTER, ifr->ifr_flags & IFF_NAPI, ifr->ifr_flags & IFF_NAPI_FRAGS, true); Since ifr_flags & IFF_NOFILTER matches IFF_NO_PI (0x1000), it seems this would pass skip_filter = true to tun_attach(), silently bypassing the BPF filters. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1