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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 13 Dec 2020 11:48:15 +0200
From:   Yonatan Linik <yonatanlinik@...il.com>
To:     Jakub Kicinski <kuba@...nel.org>
Cc:     David Miller <davem@...emloft.net>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        Andrii Nakryiko <andriin@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...omium.org>,
        Willem de Bruijn <willemb@...gle.com>,
        john.ogness@...utronix.de, Arnd Bergmann <arnd@...db.de>,
        Mao Wenan <maowenan@...wei.com>,
        Colin Ian King <colin.king@...onical.com>,
        orcohen@...oaltonetworks.com, Networking <netdev@...r.kernel.org>,
        linux-kernel@...r.kernel.org, bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH 1/1] net: Fix use of proc_fs

On Sat, Dec 12, 2020 at 11:51 PM Jakub Kicinski <kuba@...nel.org> wrote:
>
> On Sat, 12 Dec 2020 23:39:20 +0200 Yonatan Linik wrote:
> > On Sat, Dec 12, 2020 at 9:48 PM Jakub Kicinski <kuba@...nel.org> wrote:
> > >
> > > On Fri, 11 Dec 2020 18:37:49 +0200 Yonatan Linik wrote:
> > > > proc_fs was used, in af_packet, without a surrounding #ifdef,
> > > > although there is no hard dependency on proc_fs.
> > > > That caused the initialization of the af_packet module to fail
> > > > when CONFIG_PROC_FS=n.
> > > >
> > > > Specifically, proc_create_net() was used in af_packet.c,
> > > > and when it fails, packet_net_init() returns -ENOMEM.
> > > > It will always fail when the kernel is compiled without proc_fs,
> > > > because, proc_create_net() for example always returns NULL.
> > > >
> > > > The calling order that starts in af_packet.c is as follows:
> > > > packet_init()
> > > > register_pernet_subsys()
> > > > register_pernet_operations()
> > > > __register_pernet_operations()
> > > > ops_init()
> > > > ops->init() (packet_net_ops.init=packet_net_init())
> > > > proc_create_net()
> > > >
> > > > It worked in the past because register_pernet_subsys()'s return value
> > > > wasn't checked before this Commit 36096f2f4fa0 ("packet: Fix error path in
> > > > packet_init.").
> > > > It always returned an error, but was not checked before, so everything
> > > > was working even when CONFIG_PROC_FS=n.
> > > >
> > > > The fix here is simply to add the necessary #ifdef.
> > > >
> > > > Signed-off-by: Yonatan Linik <yonatanlinik@...il.com>
> > >
> > > Hm, I'm guessing you hit this on a kernel upgrade of a real system?
> >
> > Yeah, suddenly using socket with AF_PACKET didn't work,
> > so I checked what happened.
> >
> > > It seems like all callers to proc_create_net (and friends) interpret
> > > NULL as an error, but only handful is protected by an ifdef.
> >
> > I guess where there is no ifdef,
> > there should be a hard dependency on procfs,
> > using depends on in the Kconfig.
> > Maybe that's not the case everywhere it should be.
>
> You're right, on a closer look most of the places have a larger #ifdef
> block (which my grep didn't catch) or are under Kconfig. Of those I
> checked only TLS looks wrong (good job me) - would you care to fix that
> one as well, or should I?

I can fix that as well, you are talking about tls_proc.c, right?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ