From: Jakub Kicinski <kuba@kernel.org>
To: Jesper Dangaard Brouer <hawk@kernel.org>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org,
"Eric Dumazet" <eric.dumazet@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
"Paolo Abeni" <pabeni@redhat.com>,
"Toke Høiland-Jørgensen" <toke@toke.dk>,
kernel-team@cloudflare.com, mfleming@cloudflare.com
Subject: Re: [PATCH net-next V1] net: track pfmemalloc drops via SKB_DROP_REASON_PFMEMALLOC
Date: Fri, 2 May 2025 16:17:33 -0700 [thread overview]
Message-ID: <20250502161733.17fd0d60@kernel.org> (raw)
In-Reply-To: <174619899817.1075985.12078484570755125058.stgit@firesoul>
On Fri, 02 May 2025 17:16:38 +0200 Jesper Dangaard Brouer wrote:
> @@ -142,15 +144,20 @@ int sk_filter_trim_cap(struct sock *sk, struct sk_buff *skb, unsigned int cap)
> */
> if (skb_pfmemalloc(skb) && !sock_flag(sk, SOCK_MEMALLOC)) {
> NET_INC_STATS(sock_net(sk), LINUX_MIB_PFMEMALLOCDROP);
> + *reason = SKB_DROP_REASON_PFMEMALLOC;
> return -ENOMEM;
> }
> err = BPF_CGROUP_RUN_PROG_INET_INGRESS(sk, skb);
> - if (err)
> + if (err) {
> + *reason = SKB_DROP_REASON_SOCKET_FILTER;
> return err;
> + }
>
> err = security_sock_rcv_skb(sk, skb);
> - if (err)
> + if (err) {
> + *reason = SKB_DROP_REASON_SECURITY_HOOK;
> return err;
> + }
>
> rcu_read_lock();
> filter = rcu_dereference(sk->sk_filter);
there is:
err = pkt_len ? pskb_trim(skb, max(cap, pkt_len)) : -EPERM;
later on, which I think may return error without touching drop reason.
If caller didn't init it the reason will be undefined.
--
pw-bot: cr
next prev parent reply other threads:[~2025-05-02 23:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-02 15:16 [PATCH net-next V1] net: track pfmemalloc drops via SKB_DROP_REASON_PFMEMALLOC Jesper Dangaard Brouer
2025-05-02 23:17 ` Jakub Kicinski [this message]
2025-05-09 13:48 ` Jesper Dangaard Brouer
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=20250502161733.17fd0d60@kernel.org \
--to=kuba@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=hawk@kernel.org \
--cc=kernel-team@cloudflare.com \
--cc=mfleming@cloudflare.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=toke@toke.dk \
/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;
as well as URLs for NNTP newsgroup(s).