From: Florian Westphal <fw@strlen.de>
To: Topi Miettinen <toiwoton@gmail.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
Florian Westphal <fw@strlen.de>,
netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] netfilter: nft_socket: socket expressions for GID & UID
Date: Wed, 27 Apr 2022 17:28:38 +0200 [thread overview]
Message-ID: <20220427152838.GC9849@breakpoint.cc> (raw)
In-Reply-To: <b0389581-cf28-13fe-6444-0840958b757a@gmail.com>
Topi Miettinen <toiwoton@gmail.com> wrote:
> On 27.4.2022 10.01, Pablo Neira Ayuso wrote:
> > On Wed, Apr 27, 2022 at 07:48:20AM +0200, Florian Westphal wrote:
> > > Topi Miettinen <toiwoton@gmail.com> wrote:
> > > > On 26.4.2022 1.34, Florian Westphal wrote:
> > > > > Topi Miettinen <toiwoton@gmail.com> wrote:
> > > > > > On 20.4.2022 21.54, Topi Miettinen wrote:
> > > > > > > Add socket expressions for checking GID or UID of the originating
> > > > > > > socket. These work also on input side, unlike meta skuid/skgid.
> > > > > >
> > > > > > Unfortunately, there's a reproducible kernel BUG when closing a local
> > > > > > connection:
> > > > > >
> > > > > > Apr 25 21:18:13 kernel:
> > > > > > ==================================================================
> > > > > > Apr 25 21:18:13 kernel: BUG: KASAN: null-ptr-deref in
> > > > > > nf_sk_lookup_slow_v6+0x45b/0x590 [nf_socket_ipv6]
> > > > >
> > > > > You can pass this to scripts/faddr2line to get the location of the null deref.
> > > >
> > > > Didn't work,
> > >
> > > ?
> > >
> > > You pass the object file and the nf_sk_lookup_slow_v6+0x45b/0x590 info.
> > > I can't do it for you because I lack the object file and the exact
> > > source code.
> > >
>
> $ faddr2line nf_socket_ipv6.ko nf_sk_lookup_slow_v6+0x45b/0x590
> bad symbol size: base: 0x0000000000000000 end: 0x0000000000000000
> $ faddr2line nf_socket_ipv6.o nf_sk_lookup_slow_v6+0x45b/0x590
> bad symbol size: base: 0x0000000000000000 end: 0x0000000000000000
> $ faddr2line nf_socket_ipv6.mod nf_sk_lookup_slow_v6+0x45b/0x590
> readelf: Error: nf_socket_ipv6.mod: Failed to read file header
> size: nf_socket_ipv6.mod: file format not recognized
> nm: nf_socket_ipv6.mod: file format not recognized
> size: nf_socket_ipv6.mod: file format not recognized
> nm: nf_socket_ipv6.mod: file format not recognized
> no match for nf_sk_lookup_slow_v6+0x45b/0x590
> $ faddr2line nf_socket_ipv6.mod.o nf_sk_lookup_slow_v6+0x45b/0x590
> no match for nf_sk_lookup_slow_v6+0x45b/0x590
> $ faddr2line vmlinux nf_sk_lookup_slow_v6+0x45b/0x590
> no match for nf_sk_lookup_slow_v6+0x45b/0x590
>
> > > > net/ipv6/netfilter/nf_socket_ipv6.c:
> > > >
> > > > static struct sock *
> > > > nf_socket_get_sock_v6(struct net *net, struct sk_buff *skb, int doff,
> > > > const u8 protocol,
> > > > const struct in6_addr *saddr, const struct in6_addr
> > > > *daddr,
> > > > const __be16 sport, const __be16 dport,
> > > > const struct net_device *in)
> > > > {
> > > > switch (protocol) {
> > > > case IPPROTO_TCP:
> > > > return inet6_lookup(net, &tcp_hashinfo, skb, doff,
> > > > saddr, sport, daddr, dport,
> > > > in->ifindex);
> > >
> > > What does that rule look like? Seems like no input interface is
> > > available, seems like a bug in existing code?
> >
> > nft_socket_eval() assumes it always run from input path.
Oof, there is no restriction.
I don't think we can make it illegal now, so probably best to check for
indev != NULL first.
I'll send a patch.
next prev parent reply other threads:[~2022-04-27 15:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-20 18:54 [PATCH] netfilter: nft_socket: socket expressions for GID & UID Topi Miettinen
2022-04-20 21:15 ` Jan Engelhardt
2022-04-21 16:35 ` Topi Miettinen
2022-04-26 21:05 ` Pablo Neira Ayuso
2022-04-26 21:07 ` Pablo Neira Ayuso
2022-04-27 18:07 ` Topi Miettinen
2022-05-02 17:02 ` Pablo Neira Ayuso
2022-04-25 18:45 ` Topi Miettinen
2022-04-25 22:34 ` Florian Westphal
2022-04-26 19:02 ` Topi Miettinen
2022-04-27 5:48 ` Florian Westphal
2022-04-27 7:01 ` Pablo Neira Ayuso
2022-04-27 15:00 ` Topi Miettinen
2022-04-27 15:28 ` Florian Westphal [this message]
2022-04-27 15:30 ` Pablo Neira Ayuso
2022-04-27 15:42 ` Florian Westphal
2022-04-27 15:45 ` Pablo Neira Ayuso
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=20220427152838.GC9849@breakpoint.cc \
--to=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=toiwoton@gmail.com \
/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).