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]
Message-ID: <20230517-bushaltestelle-super-e223978c1ba6@brauner>
Date:   Wed, 17 May 2023 10:25:08 +0200
From:   Christian Brauner <brauner@...nel.org>
To:     syzbot <syzbot+ac3b41786a2d0565b6d5@...kaller.appspotmail.com>,
        Kees Cook <keescook@...omium.org>
Cc:     linux-kernel@...r.kernel.org, linux-next@...r.kernel.org,
        sfr@...b.auug.org.au, syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [kernel?] linux-next test error: UBSAN:
 array-index-out-of-bounds in alloc_pid

On Wed, May 17, 2023 at 12:40:03AM -0700, syzbot wrote:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    065efa589871 Add linux-next specific files for 20230517
> git tree:       linux-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=17f27bb2280000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=821eeb02ef201bcc
> dashboard link: https://syzkaller.appspot.com/bug?extid=ac3b41786a2d0565b6d5
> compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> 
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/dbbd691e9e5a/disk-065efa58.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/e5b9541c3979/vmlinux-065efa58.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/44cf3f3aaabb/bzImage-065efa58.xz
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+ac3b41786a2d0565b6d5@...kaller.appspotmail.com
> 
> ================================================================================
> UBSAN: array-index-out-of-bounds in kernel/pid.c:244:15

Only way I see this happening is if the logic in
kernel/pid_namespace.c:create_pid_cachep() which sets the object size
for the struct pid allocation of this pid namespace based on
parent_pid_namespace->level + 1 is broken. The way this works is:

    struct pid
    {
            [snip]
            struct upid numbers[1];
    };

    create_pid_namespace()
    {
            unsigned int level = parent_pid_ns->level + 1;
            ns->pid_cachep = create_pid_cachep(level);
    }

and then during fork:

    alloc_pid()
    {
            pid = kmem_cache_alloc(ns->pid_cachep, GFP_KERNEL);
    }

So effectively, the wrong level must've been set in
create_pid_namespace() so that the flexible array allocation is too
small.

I don't have time to debug this tbh. Ccing Kees maybe there's some
flexible array stuff going on I'm unaware of.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ