Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Simon Schippers" <simon.schippers@tu-dortmund.de>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH net-next v14 1/5] tun/tap: add IFF_BACKPRESSURE flag
Date: Wed, 05 Aug 2026 01:57:33 +0000	[thread overview]
Message-ID: <20260805015734.9D6D31F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260803183641.96882-2-simon.schippers@tu-dortmund.de>

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 <simon.schippers@tu-dortmund.de>

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/20260803183641.96882-1-simon.schippers@tu-dortmund.de?part=1

  reply	other threads:[~2026-08-05  1:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03 18:36 [PATCH net-next v14 0/5] tun/tap & vhost-net: apply qdisc backpressure on full ptr_ring to reduce TX drops Simon Schippers
2026-08-03 18:36 ` [PATCH net-next v14 1/5] tun/tap: add IFF_BACKPRESSURE flag Simon Schippers
2026-08-05  1:57   ` sashiko-bot [this message]
2026-08-03 18:36 ` [PATCH net-next v14 2/5] tun/tap: add ptr_ring consume helper with netdev queue wakeup Simon Schippers
2026-08-05  1:57   ` sashiko-bot
2026-08-03 18:36 ` [PATCH net-next v14 3/5] vhost-net: wake queue of tun/tap after ptr_ring consume Simon Schippers
2026-08-03 18:36 ` [PATCH net-next v14 4/5] ptr_ring: move free-space check into separate helper Simon Schippers
2026-08-05  1:57   ` sashiko-bot
2026-08-03 18:36 ` [PATCH net-next v14 5/5] tun/tap & vhost-net: stop tail-drop when IFF_BACKPRESSURE is set Simon Schippers
2026-08-05  5:20 ` [PATCH net-next v14 0/5] tun/tap & vhost-net: apply qdisc backpressure on full ptr_ring to reduce TX drops Simon Schippers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260805015734.9D6D31F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=simon.schippers@tu-dortmund.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox