lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250502161733.17fd0d60@kernel.org>
Date: Fri, 2 May 2025 16:17:33 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Jesper Dangaard Brouer <hawk@...nel.org>
Cc: netdev@...r.kernel.org, bpf@...r.kernel.org, Eric Dumazet
 <eric.dumazet@...il.com>, "David S. Miller" <davem@...emloft.net>, Paolo
 Abeni <pabeni@...hat.com>, Toke Høiland-Jørgensen
 <toke@...e.dk>, kernel-team@...udflare.com, mfleming@...udflare.com
Subject: Re: [PATCH net-next V1] net: track pfmemalloc drops via
 SKB_DROP_REASON_PFMEMALLOC

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ