Re: [GIT PULL] blob-stacking updates for security-next

From: Tetsuo Handa
Date: Fri Jan 11 2019 - 05:38:37 EST


On 2019/01/09 6:35, Kees Cook wrote:
> Hi James,
>
> Please pull these blob-stacking changes for security-next.
>
> Thanks!
>
> -Kees
>
> The following changes since commit bfeffd155283772bbe78c6a05dec7c0128ee500c:
>
> Linux 5.0-rc1 (2019-01-06 17:08:20 -0800)
>
> are available in the Git repository at:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git tags/blob-stacking-security-next
>
> for you to fetch changes up to a5e2fe7ede1268d2f80fe49ca1f717d0e3750995:
>
> TOMOYO: Update LSM flags to no longer be exclusive (2019-01-08 13:18:45 -0800)
>

And syzbot already found a bug.
This is occurring immediately after memory allocation failure for cred object.
We need to be prepared for free() function being called when alloc() function failed.

[ 59.992498][ T8010] FAULT_INJECTION: forcing a failure.
[ 59.992498][ T8010] name failslab, interval 1, probability 0, space 0, times 1
[ 60.005214][ T8010] CPU: 0 PID: 8010 Comm: syz-executor178 Not tainted 5.0.0-rc1-next-20190111 #10
[ 60.014337][ T8010] Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
[ 60.024383][ T8010] Call Trace:
[ 60.027657][ T8010] dump_stack+0x1db/0x2d0
[ 60.063731][ T8010] should_fail.cold+0xa/0x14
[ 60.089894][ T8010] __should_failslab+0x121/0x190
[ 60.094810][ T8010] should_failslab+0x9/0x14
[ 60.099411][ T8010] __kmalloc+0x2dc/0x740
[ 60.124293][ T8010] security_prepare_creds+0x123/0x190
[ 60.129644][ T8010] prepare_creds+0x3c4/0x510
[ 60.149852][ T8010] __x64_sys_capset+0x58c/0x9b0
[ 60.185347][ T8010] do_syscall_64+0x1a3/0x800
[ 60.206747][ T8010] entry_SYSCALL_64_after_hwframe+0x49/0xbe