[PATCH 6/6] [DEBUG] seccomp: Report bitmap coverage ranges

2020-09-23 Thread Kees Cook
This is what I've been using to explore actual bitmap results for real-world filters... Signed-off-by: Kees Cook --- kernel/seccomp.c | 115 +++ 1 file changed, 115 insertions(+) diff --git a/kernel/seccomp.c b/kernel/seccomp.c index 9921f6f

Re: [RFC PATCH 01/11] counters: Introduce counter and counter_atomic

2020-09-23 Thread Kees Cook
On Wed, Sep 23, 2020 at 03:19:08PM -0600, Shuah Khan wrote: > On 9/23/20 2:58 PM, Kees Cook wrote: > > On Wed, Sep 23, 2020 at 02:48:22PM -0600, Shuah Khan wrote: > > > On 9/23/20 1:04 PM, Kees Cook wrote: > > > > On Tue, Sep 22, 2020 at 07:43:30PM -0600, Shuah Khan

Re: [PATCH 1/7] efi: pstore: disentangle from deprecated efivars module

2020-09-23 Thread Kees Cook
On Wed, Sep 23, 2020 at 08:43:21PM +0200, Ard Biesheuvel wrote: > On Wed, 23 Sep 2020 at 20:41, Kees Cook wrote: > > > > On Wed, Sep 23, 2020 at 06:13:58PM +0200, Ard Biesheuvel wrote: > > > The EFI pstore implementation relies on the 'efivars' abstraction

Re: [RFC PATCH 01/11] counters: Introduce counter and counter_atomic

2020-09-23 Thread Kees Cook
On Wed, Sep 23, 2020 at 02:48:22PM -0600, Shuah Khan wrote: > On 9/23/20 1:04 PM, Kees Cook wrote: > > On Tue, Sep 22, 2020 at 07:43:30PM -0600, Shuah Khan wrote: > > I would really like these APIs to be _impossible_ to use for object > > lifetime management. To that end, I w

Re: [RFC PATCH 01/11] counters: Introduce counter and counter_atomic

2020-09-23 Thread Kees Cook
On Wed, Sep 23, 2020 at 09:34:48PM +0200, Greg KH wrote: > On Wed, Sep 23, 2020 at 12:04:08PM -0700, Kees Cook wrote: > > On Tue, Sep 22, 2020 at 07:43:30PM -0600, Shuah Khan wrote: > > > Introduce Simple atomic and non-atomic counters. > > > > > > There ar

Re: [RFC PATCH 07/11] drivers/android/binder: convert stats, transaction_log to counter_atomic

2020-09-23 Thread Kees Cook
On Wed, Sep 23, 2020 at 09:31:34PM +0200, Greg KH wrote: > On Wed, Sep 23, 2020 at 12:04:58PM -0700, Kees Cook wrote: > > On Wed, Sep 23, 2020 at 07:10:27AM +0200, Greg KH wrote: > > > On Tue, Sep 22, 2020 at 07:43:36PM -0600, Shuah Khan wrote: > >

Re: [PATCH v6 1/9] kernel: Support TIF_SYSCALL_INTERCEPT flag

2020-09-23 Thread Kees Cook
On Wed, Sep 23, 2020 at 04:18:26PM -0400, Gabriel Krisman Bertazi wrote: > Kees Cook writes: > > > On Fri, Sep 04, 2020 at 04:31:39PM -0400, Gabriel Krisman Bertazi wrote: > >> Convert TIF_SECCOMP into a generic TI flag for any syscall interception > >> work being d

Re: x86/irq: Make run_on_irqstack_cond() typesafe

2020-09-23 Thread Kees Cook
would expect this form to be much robust: inc load sp from per-cpu pivot sp make call restore sp WARN(dec_and_test) -Kees [1] https://security.stackexchange.com/questions/44418/return-oriented-programming-how-to-find-a-stack-pivot -- Kees Cook

Re: [RFC PATCH 07/11] drivers/android/binder: convert stats, transaction_log to counter_atomic

2020-09-23 Thread Kees Cook
truct counter_atomic br[_IOC_NR(BR_FAILED_REPLY) + 1]; > > + struct counter_atomic bc[_IOC_NR(BC_REPLY_SG) + 1]; > > + struct counter_atomic obj_created[BINDER_STAT_COUNT]; > > + struct counter_atomic obj_deleted[BINDER_STAT_COUNT]; > > These are just debugging statistics, no reason they have to be atomic > variables at all and they should be able to just be "struct counter" > variables instead. But there's no reason for them _not_ to be atomic. Please let's keep this API as always safe. Why even provide a new foot-gun here? -- Kees Cook

Re: [RFC PATCH 01/11] counters: Introduce counter and counter_atomic

2020-09-23 Thread Kees Cook
al; Please build this test using KUnit. > + start_val = counter_long_read(&acnt); > + end_val = counter_long_dec_return(&acnt); > + pr_info("Test read decrement and return: %ld to %ld - %s\n", > + start_val, end_val, > + ((start_val-1 == end_val) ? "PASS" : "FAIL")); I also see a lot of copy/paste patterns here. These should all use a common helper. -- Kees Cook

Re: [PATCH 1/7] efi: pstore: disentangle from deprecated efivars module

2020-09-23 Thread Kees Cook
dule is deprecated, and all users appear to > have moved to the efivarfs file system instead, let's prepare for > its removal, by removing EFI pstore's dependency on it. > > Signed-off-by: Ard Biesheuvel With this and the other pstore patch, do the pstore self-tests still p

Re: [PATCH v6 1/9] kernel: Support TIF_SYSCALL_INTERCEPT flag

2020-09-22 Thread Kees Cook
emantics of checking the > syscall_intercept flag, like it is done in the common entry syscall > code, or even better, migrate to the common syscall entry code. Can we "eat" all the other flags like ptrace, audit, etc, too? Doing this only for seccomp seems strange. -- Kees Cook

Re: [PATCH v6 1/9] kernel: Support TIF_SYSCALL_INTERCEPT flag

2020-09-22 Thread Kees Cook
> I was trying to reduce overhead to seccomp entry due to two cache misses > when reading this structure. Measuring it seccomp_benchmark didn't show > any difference with the unwrapped version, so perhaps it was a bit of > premature optimization? That should not be a thing to think about here. Structure randomization already has a mode to protect against cache line issues. I would leave this as just a new member; no wrapping struct. -- Kees Cook

Re: [PATCH v6 3/9] x86: vdso: Expose sigreturn address on vdso to the kernel

2020-09-22 Thread Kees Cook
> Signed-off-by: Gabriel Krisman Bertazi Look good to me; would anything else benefit from this information? Reviewed-by: Kees Cook -- Kees Cook

Re: [PATCH v6 4/9] signal: Expose SYS_USER_DISPATCH si_code type

2020-09-22 Thread Kees Cook
n Bertazi Yup, this looks good; seccomp is glad to have a new SIGSYS friend. ;) Acked-by: Kees Cook -- Kees Cook

Re: [PATCH v6 7/9] x86: Enable Syscall User Dispatch

2020-09-22 Thread Kees Cook
is sufficient to enable it. (Especially since there's a top level config for SYSCALL_USER_DISPATCH, it feels like overkill). -- Kees Cook

Re: [PATCH v6 8/9] selftests: Add kselftest for syscall user dispatch

2020-09-22 Thread Kees Cook
gt; - Update bad selector test to reflect change in API > > Changes since v3: > - Sort entry in Makefile > - Add SPDX header > - Use __NR_syscalls if available > > Signed-off-by: Gabriel Krisman Bertazi This passes, looks good. Thank you again for the self tests! Acked-by: Kees Cook -- Kees Cook

Re: [PATCH v6 9/9] doc: Document Syscall User Dispatch

2020-09-22 Thread Kees Cook
On Fri, Sep 04, 2020 at 04:31:47PM -0400, Gabriel Krisman Bertazi wrote: > Explain the interface, provide some background and security notes. > > Signed-off-by: Gabriel Krisman Bertazi Looks good to me! Reviewed-by: Kees Cook -- Kees Cook

[tip: x86/cleanups] x86/entry: Fix typo in comments for syscall_enter_from_user_mode()

2020-09-22 Thread tip-bot2 for Kees Cook
The following commit has been merged into the x86/cleanups branch of tip: Commit-ID: 900ffe39fec908e0aa26a30612e43ebc7140db79 Gitweb: https://git.kernel.org/tip/900ffe39fec908e0aa26a30612e43ebc7140db79 Author:Kees Cook AuthorDate:Sat, 19 Sep 2020 01:09:36 -07:00 Committer

[PATCH] entry: Fix typo in comments for syscall_enter_from_user_mode()

2020-09-19 Thread Kees Cook
Just to help myself and others with finding the correct function names, fix a typo for "usermode" vs "user_mode". Signed-off-by: Kees Cook --- include/linux/entry-common.h | 2 +- kernel/entry/common.c| 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff -

[PATCH v2 4/4] selftests/clone3: Avoid OS-defined clone_args

2020-09-19 Thread Kees Cook
As the UAPI headers start to appear in distros, we need to avoid outdated versions of struct clone_args to be able to test modern features; rename to "struct __clone_args". Additionally update the struct size macro names to match UAPI names. Signed-off-by: Kees Cook --- tools/testing

[PATCH v2 1/4] selftests/seccomp: Record syscall during ptrace entry

2020-09-19 Thread Kees Cook
/20200911181012.171027-1-casca...@canonical.com/ Signed-off-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_bpf.c | 40 +-- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp

[PATCH v2 3/4] selftests/seccomp: powerpc: Set syscall return during ptrace syscall exit

2020-09-19 Thread Kees Cook
/20200911181012.171027-1-casca...@canonical.com/ Fixes: 58d0a862f573 ("seccomp: add tests for ptrace hole") Signed-off-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_bpf.c | 25 --- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/seccomp/sec

[PATCH v2 2/4] selftests/seccomp: Allow syscall nr and ret value to be set separately

2020-09-19 Thread Kees Cook
In preparation for setting syscall nr and ret values separately, refactor the helpers to take a pointer to a value, so that a NULL can indicate "do not change this respective value". This is done to keep the regset read/write happening once and in one code path. Signed-off-by:

[PATCH v2 0/4] selftests/seccomp: Refactor change_syscall()

2020-09-19 Thread Kees Cook
syscall number/return handling for powerpc. Additionally fixes clone3 (which seccomp depends on for testing) to run under MIPS where an old struct clone_args has become visible. (FWIW, I expect to take these via the seccomp tree.) Thanks, Kees Cook (4): selftests/seccomp: Record syscall during ptrace

Re: [PATCH 14/15] selftests/clone3: Avoid OS-defined clone_args

2020-09-18 Thread Kees Cook
On Tue, Sep 15, 2020 at 06:25:28PM +0200, Christian Brauner wrote: > On Sat, Sep 12, 2020 at 04:08:19AM -0700, Kees Cook wrote: > > As the UAPI headers start to appear in distros, we need to avoid > > outdated versions of struct clone_args to be able to test modern > > featur

Re: [PATCH 03/15] selftests/seccomp: mips: Define SYSCALL_NUM_SET macro

2020-09-18 Thread Kees Cook
On Tue, Sep 15, 2020 at 05:55:46PM +0200, Christian Brauner wrote: > On Sat, Sep 12, 2020 at 04:08:08AM -0700, Kees Cook wrote: > > Remove the mips special-case in change_syscall(). > > > > Signed-off-by: Kees Cook > > --- > > tools/testing/sel

Re: [RFC PATCH 6/6] security/fbfam: Mitigate a fork brute force attack

2020-09-18 Thread Kees Cook
On Fri, Sep 18, 2020 at 06:02:16PM +0200, John Wood wrote: > On Thu, Sep 10, 2020 at 04:56:19PM -0700, Kees Cook wrote: > > On Thu, Sep 10, 2020 at 01:21:07PM -0700, Kees Cook wrote: > > > + pr_warn("fbfam: Offending process with PID %d killed\n", &g

Re: [PATCH v3 17/30] init: lto: ensure initcall ordering

2020-09-18 Thread Kees Cook
jobserver-exec to limit the number of jobs spawned. > > Signed-off-by: Sami Tolvanen Thanks for the update; using jobserver-exec looks much better for controlling the build resources. :) Reviewed-by: Kees Cook -- Kees Cook

Re: [PATCH v3 13/30] kbuild: lto: postpone objtool

2020-09-18 Thread Kees Cook
the arguments can be reused in Makefile.modfinal. > > Signed-off-by: Sami Tolvanen Thanks for reorganizing this! Reviewed-by: Kees Cook -- Kees Cook

Re: [PATCH 06/14] Fix CFLAGS for UBSAN_BOUNDS on Clang

2020-09-17 Thread Kees Cook
I have is that I don't like the coverage of some mitigation or detection to "silently" vary between builds. e.g. someone would build with/without UBSAN_TRAP and end up with unexpectedly different coverage. I'd rather there be a separate CONFIG that appears. -- Kees Cook

Re: [PATCH 06/14] Fix CFLAGS for UBSAN_BOUNDS on Clang

2020-09-17 Thread Kees Cook
I'm fine to turn that off. -- Kees Cook

Re: [PATCH] selftests/harness: Flush stdout before forking

2020-09-17 Thread Kees Cook
ot;TAP version 13" test.log > 2 Oh thank you for tracking this down! I thought seccomp wasn't killing a child or something, and hadn't found it yet. :) Acked-by: Kees Cook -- Kees Cook

Re: [PATCH] selftests/harness: Flush stdout before forking

2020-09-17 Thread Kees Cook
/kselftest_harness.h | 5 + > > > >   1 file changed, 5 insertions(+) > > > > > > Tested-by: Max Filippov > > > > > > > Thank you both. Applying to linux-kselftest fixes for 5.9-rc7 > > > > Kees, > > I haven't pulled this in yet. If you want to take this through seccomp > tree for dependencies: > > Acked-by: Shuah Khan You can have it -- it's a global fix and more than the seccomp selftest is likely affected. :) -- Kees Cook

Re: [RFC PATCH 1/6] security/fbfam: Add a Kconfig to enable the fbfam feature

2020-09-17 Thread Kees Cook
On Thu, Sep 17, 2020 at 08:40:06PM +0200, John Wood wrote: > Hi, > > On Thu, Sep 10, 2020 at 04:18:08PM -0700, Kees Cook wrote: > > On Thu, Sep 10, 2020 at 01:21:02PM -0700, Kees Cook wrote: > > > From: John Wood > > > > > > Add a menu entry under &q

Re: [PATCH 06/14] Fix CFLAGS for UBSAN_BOUNDS on Clang

2020-09-14 Thread Kees Cook
CLANG > +CFLAGS_UBSAN += $(call cc-option, -fsanitize=array-bounds) This would mean losing the local-bounds coverage? Isn't that for locally defined arrays on the stack? > + else > +CFLAGS_UBSAN += $(call cc-option, -fsanitize=bounds) > + endif > endif > > ifdef CONFIG_UBSAN_MISC > -- > 2.28.0.618.gf4bc123cb7-goog > -- Kees Cook

[tip: core/urgent] core/entry: Report syscall correctly for trace and audit

2020-09-14 Thread tip-bot2 for Kees Cook
The following commit has been merged into the core/urgent branch of tip: Commit-ID: b6ec413461034d49f9e586845825adb35ba308f6 Gitweb: https://git.kernel.org/tip/b6ec413461034d49f9e586845825adb35ba308f6 Author:Kees Cook AuthorDate:Fri, 11 Sep 2020 17:58:26 -07:00 Committer

Re: [PATCH 00/15] selftests/seccomp: Refactor change_syscall()

2020-09-14 Thread Kees Cook
On Mon, Sep 14, 2020 at 10:15:18PM +1000, Michael Ellerman wrote: > Kees Cook writes: > > Hi, > > > > This refactors the seccomp selftest macros used in change_syscall(), > > in an effort to remove special cases for mips, arm, arm64, and xtensa, > > whic

Re: [PATCH 13/15] selftests/seccomp: powerpc: Set syscall return during ptrace syscall exit

2020-09-14 Thread Kees Cook
On Mon, Sep 14, 2020 at 03:47:13PM +1000, Michael Ellerman wrote: > Kees Cook writes: > > Some archs (like ppc) only support changing the return code during > > syscall exit when ptrace is used. As the syscall number might not > > be available anymore during syscall exit,

Re: linux-next: build warning after merge of the tip tree

2020-09-14 Thread Kees Cook
ynamic.o' being placed in section `.ctors.65435' > [...] Hmm, I wasn't seeing that... Which gcc and bintuils versions are you using? > Probably exposed by commit > > 83109d5d5fba ("x86/build: Warn on orphan section placement") Very likely! :) -- Kees Cook

Re: WARNING in syscall_exit_to_user_mode

2020-09-14 Thread Kees Cook
On Sun, Sep 13, 2020 at 09:54:34PM +0200, Thomas Gleixner wrote: > On Sat, Sep 12 2020 at 10:52, Kees Cook wrote: > >> [ cut here ] > >> syscall 56 left IRQs disabled > > > > This WARN appears reachable. :) > > The above is hardly a p

Re: [REGRESSION] x86/entry: Tracer no longer has opportunity to change the syscall number at entry via orig_ax

2020-09-14 Thread Kees Cook
On Sun, Sep 13, 2020 at 08:27:23PM +0200, Thomas Gleixner wrote: > On Sun, Sep 13 2020 at 17:44, Michael Ellerman wrote: > > Kees Cook writes: > > diff --git a/kernel/entry/common.c b/kernel/entry/common.c > > index 18683598edbc..901361e2f8ea 100644 > > --- a/kern

Re: WARNING in syscall_exit_to_user_mode

2020-09-12 Thread Kees Cook
ll 56 left IRQs disabled This WARN appears reachable. :) I also see on the dashboard these other problems with the new entry code: https://syzkaller.appspot.com/bug?extid=d4336c84ed0099fdbe47 https://syzkaller.appspot.com/bug?extid=c4af95386364bc59b13e I can't tell if any of these have been looked at yet, though. -- Kees Cook

[PATCH 01/15] selftests/seccomp: Refactor arch register macros to avoid xtensa special case

2020-09-12 Thread Kees Cook
To avoid an xtensa special-case, refactor all arch register macros to take the register variable instead of depending on the macro expanding as a struct member name. Signed-off-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_bpf.c | 97 +-- 1 file changed, 47

[PATCH 07/15] selftests/seccomp: Remove syscall setting #ifdefs

2020-09-12 Thread Kees Cook
With all architectures now using the common SYSCALL_NUM_SET() macro, the arch-specific #ifdef can be removed from change_syscall() itself. Signed-off-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_bpf.c | 16 +++- 1 file changed, 3 insertions(+), 13 deletions(-) diff

[PATCH 13/15] selftests/seccomp: powerpc: Set syscall return during ptrace syscall exit

2020-09-12 Thread Kees Cook
Suggested-by: Thadeu Lima de Souza Cascardo Link: https://lore.kernel.org/linux-kselftest/20200911181012.171027-1-casca...@canonical.com/ Fixes: 58d0a862f573 ("seccomp: add tests for ptrace hole") Signed-off-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_

[PATCH 05/15] selftests/seccomp: arm64: Define SYSCALL_NUM_SET macro

2020-09-12 Thread Kees Cook
Remove the arm64 special-case in change_syscall(). Signed-off-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_bpf.c | 27 +-- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests

[PATCH 03/15] selftests/seccomp: mips: Define SYSCALL_NUM_SET macro

2020-09-12 Thread Kees Cook
Remove the mips special-case in change_syscall(). Signed-off-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_bpf.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp

[PATCH 14/15] selftests/clone3: Avoid OS-defined clone_args

2020-09-12 Thread Kees Cook
As the UAPI headers start to appear in distros, we need to avoid outdated versions of struct clone_args to be able to test modern features. Additionally pull in the syscall numbers correctly. Signed-off-by: Kees Cook --- I needed to fix this to get MIPS to build the seccomp selftests

[PATCH 12/15] selftests/seccomp: powerpc: Fix seccomp return value testing

2020-09-12 Thread Kees Cook
...@canonical.com/ Fixes: 5d83c2b37d43 ("selftests/seccomp: Add powerpc support") Signed-off-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_bpf.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing

[PATCH 11/15] selftests/seccomp: Remove SYSCALL_NUM_RET_SHARE_REG in favor of SYSCALL_RET_SET

2020-09-12 Thread Kees Cook
ut an associated SYSCALL_RET() macro. This also paves the way for architectures that need to do special things to set the return value (e.g. powerpc). Signed-off-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_bpf.c | 33 +-- 1 file changed, 23 insertions(+), 10 dele

[PATCH 15/15] selftests/seccomp: Use __NR_mknodat instead of __NR_mknod

2020-09-12 Thread Kees Cook
The __NR_mknod syscall doesn't exist on arm64 (only __NR_mknodat). Switch to the modern syscall. Fixes: ad5682184a81 ("selftests/seccomp: Check for EPOLLHUP for user_notif") Signed-off-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_bpf.c | 2 +- 1 file changed, 1

[PATCH 09/15] selftests/seccomp: Convert REGSET calls into ARCH_GETREG/ARCH_SETREG

2020-09-12 Thread Kees Cook
Consolidate the REGSET logic into the new ARCH_GETREG() and ARCH_SETREG() macros, avoiding more #ifdef code in function bodies. Signed-off-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_bpf.c | 42 +++ 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a

[PATCH 10/15] selftests/seccomp: Avoid redundant register flushes

2020-09-12 Thread Kees Cook
When none of the registers have changed, don't flush them back. This can happen if the architecture uses a non-register way to change the syscall (e.g. arm64) , and a return value hasn't been written. Signed-off-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_bpf.c | 6

[PATCH 06/15] selftests/seccomp: mips: Remove O32-specific macro

2020-09-12 Thread Kees Cook
Instead of having the mips O32 macro special-cased, pull the logic into the SYSCALL_NUM() macro. Additionally include the ABI headers, since these appear to have been missing, leaving __NR_O32_Linux undefined. Signed-off-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_bpf.c | 18

[PATCH 02/15] selftests/seccomp: Provide generic syscall setting macro

2020-09-12 Thread Kees Cook
In order to avoid "#ifdef"s in the main function bodies, create a new macro, SYSCALL_NUM_SET(), where arch-specific logic can live. Signed-off-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_bpf.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) di

[PATCH 08/15] selftests/seccomp: Convert HAVE_GETREG into ARCH_GETREG/ARCH_SETREG

2020-09-12 Thread Kees Cook
Instead of special-casing the get/set-registers routines, move the HAVE_GETREG logic into the new ARCH_GETREG() and ARCH_SETREG() macros. Signed-off-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_bpf.c | 27 ++- 1 file changed, 15 insertions(+), 12 deletions(-) diff

[PATCH 04/15] selftests/seccomp: arm: Define SYSCALL_NUM_SET macro

2020-09-12 Thread Kees Cook
Remove the arm special-case in change_syscall(). Signed-off-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_bpf.c | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp

[PATCH 00/15] selftests/seccomp: Refactor change_syscall()

2020-09-12 Thread Kees Cook
arm64, and i386 selftests shortly, but I currently don't have an easy way to check xtensa, mips, nor powerpc. Any help there would be appreciated! (FWIW, I expect to take these via the seccomp tree.) Thanks, -Kees Kees Cook (15): selftests/seccomp: Refactor arch register macros

Re: [RESEND][RFC PATCH 0/6] Fork brute force attack mitigation (fbfam)

2020-09-12 Thread Kees Cook
On Sat, Sep 12, 2020 at 10:03:23AM +1000, James Morris wrote: > On Thu, 10 Sep 2020, Kees Cook wrote: > > > [kees: re-sending this series on behalf of John Wood > > also visible at https://github.com/johwood/linux fbfam] > > > > From: John Wood > > Why a

Re: [RESEND][RFC PATCH 0/6] Fork brute force attack mitigation (fbfam)

2020-09-12 Thread Kees Cook
nd patch series? Please feel free! I'm happy to help. :) > My goal is to learn as much as possible doing something useful for the > linux kernel. Sounds good; thanks! -- Kees Cook

[PATCH] core/entry: Report syscall correctly for trace and audit

2020-09-11 Thread Kees Cook
Cc: Andy Lutomirski Cc: Ingo Molnar Signed-off-by: Kees Cook --- kernel/entry/common.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/entry/common.c b/kernel/entry/common.c index 18683598edbc..6fdb6105e6d6 100644 --- a/kernel/entry/common.c +++ b/kernel/entr

[GIT PULL] seccomp fixes for v5.9-rc5

2020-09-11 Thread Kees Cook
llocation fails .mailmap | 1 + MAINTAINERS | 2 +- kernel/seccomp.c | 24 ++-- 3 files changed, 20 insertions(+), 7 deletions(-) -- Kees Cook

Re: [REGRESSION] x86/entry: Tracer no longer has opportunity to change the syscall number at entry via orig_ax

2020-09-11 Thread Kees Cook
perf-$VER record -e raw_syscalls:sys_enter -e raw_syscalls:sys_exit & # ./seccomp_bpf # fg ctrl-c # ./perf-$VER script | grep seccomp_bpf | awk '{print $7}' | sort | uniq -c > $VER.log *repeat* # diff -u old.log new.log ... (Is there an easier way to get those results?) I will go see if I can figure out the best way to correct this. -- Kees Cook

Re: [PATCH 0/3] xtensa: add seccomp support

2020-09-11 Thread Kees Cook
changes for feedback. I was surprised to find the changes in the seccomp selftests today in Linus's tree. I didn't seem to get CCed on this series, even though get_maintainers shows this: $ ./scripts/get_maintainer.pl 0001-selftests-seccomp-add-xtensa-support.mbox Kees Cook (supporter:

Re: [REGRESSION] x86/entry: Tracer no longer has opportunity to change the syscall number at entry via orig_ax

2020-09-11 Thread Kees Cook
es the syscall number on > entry eg. in __audit_syscall_entry(). So it will record the wrong > syscall happening in this case I think. > > Seems like we should reload the syscall number before calling > trace_sys_enter() & audit ? Agreed. I wonder what the best way to build a regression test for this is... hmmm. -- Kees Cook

Re: [RESEND][RFC PATCH 0/6] Fork brute force attack mitigation (fbfam)

2020-09-10 Thread Kees Cook
On Thu, Sep 10, 2020 at 01:21:01PM -0700, Kees Cook wrote: > From: John Wood > > The goal of this patch serie is to detect and mitigate a fork brute force > attack. Thanks for this RFC! I'm excited to get this problem finally handled in the kernel. Hopefully the feedback is use

Re: [RFC PATCH 6/6] security/fbfam: Mitigate a fork brute force attack

2020-09-10 Thread Kees Cook
On Thu, Sep 10, 2020 at 01:21:07PM -0700, Kees Cook wrote: > From: John Wood > > In order to mitigate a fork brute force attack it is necessary to kill > all the offending tasks. This tasks are all the ones that share the > statistical data with the current task (the task t

Re: [RFC PATCH 5/6] security/fbfam: Detect a fork brute force attack

2020-09-10 Thread Kees Cook
On Thu, Sep 10, 2020 at 01:21:06PM -0700, Kees Cook wrote: > From: John Wood > > To detect a fork brute force attack it is necessary to compute the > crashing rate of the application. This calculation is performed in each > fatal fail of a task, or in other words, when a core du

Re: [RFC PATCH 3/6] security/fbfam: Use the api to manage statistics

2020-09-10 Thread Kees Cook
On Thu, Sep 10, 2020 at 01:21:04PM -0700, Kees Cook wrote: > From: John Wood > > Use the previous defined api to manage statistics calling it accordingly > when a task forks, calls execve or exits. > > Signed-off-by: John Wood > --- > fs/exec.c | 2 ++ > ker

Re: [RFC PATCH 2/6] security/fbfam: Add the api to manage statistics

2020-09-10 Thread Kees Cook
On Thu, Sep 10, 2020 at 01:21:03PM -0700, Kees Cook wrote: > From: John Wood > > Create a statistical data structure to hold all the necessary > information involve in a fork brute force attack. This info is a > timestamp for the first fork or execve and the number of crash

Re: [RFC PATCH 1/6] security/fbfam: Add a Kconfig to enable the fbfam feature

2020-09-10 Thread Kees Cook
On Thu, Sep 10, 2020 at 01:21:02PM -0700, Kees Cook wrote: > From: John Wood > > Add a menu entry under "Security options" to enable the "Fork brute > force attack mitigation" feature. > > Signed-off-by: John Wood > --- > security/Kconfig

Re: [RFC PATCH 4/6] security/fbfam: Add a new sysctl to control the crashing rate threshold

2020-09-10 Thread Kees Cook
On Thu, Sep 10, 2020 at 01:21:05PM -0700, Kees Cook wrote: > From: John Wood > > This is a previous step to add the detection feature. > > A fork brute force attack will be detected when an application crashes > quickly. Since, a rate can be defined as a time per fault, add

[RFC PATCH 1/6] security/fbfam: Add a Kconfig to enable the fbfam feature

2020-09-10 Thread Kees Cook
From: John Wood Add a menu entry under "Security options" to enable the "Fork brute force attack mitigation" feature. Signed-off-by: John Wood --- security/Kconfig | 1 + security/fbfam/Kconfig | 10 ++ 2 files changed, 11 insertions(+) create mode 100644 security/fbfam/Kconfig

[RFC PATCH 4/6] security/fbfam: Add a new sysctl to control the crashing rate threshold

2020-09-10 Thread Kees Cook
From: John Wood This is a previous step to add the detection feature. A fork brute force attack will be detected when an application crashes quickly. Since, a rate can be defined as a time per fault, add a new sysctl to control the crashing rate threshold. This way, each system can tune the det

[RFC PATCH 2/6] security/fbfam: Add the api to manage statistics

2020-09-10 Thread Kees Cook
From: John Wood Create a statistical data structure to hold all the necessary information involve in a fork brute force attack. This info is a timestamp for the first fork or execve and the number of crashes since then. Moreover, due to this statitistical data will be shared between different tas

[RFC PATCH 6/6] security/fbfam: Mitigate a fork brute force attack

2020-09-10 Thread Kees Cook
From: John Wood In order to mitigate a fork brute force attack it is necessary to kill all the offending tasks. This tasks are all the ones that share the statistical data with the current task (the task that has crashed). Since the attack detection is done in the function fbfam_handle_attack()

[RFC PATCH 5/6] security/fbfam: Detect a fork brute force attack

2020-09-10 Thread Kees Cook
From: John Wood To detect a fork brute force attack it is necessary to compute the crashing rate of the application. This calculation is performed in each fatal fail of a task, or in other words, when a core dump is triggered. If this rate shows that the application is crashing quickly, there is

[RESEND][RFC PATCH 0/6] Fork brute force attack mitigation (fbfam)

2020-09-10 Thread Kees Cook
[kees: re-sending this series on behalf of John Wood also visible at https://github.com/johwood/linux fbfam] From: John Wood The goal of this patch serie is to detect and mitigate a fork brute force attack. Attacks with the purpose to break ASLR or bypass canaries traditionaly use some level

[RFC PATCH 3/6] security/fbfam: Use the api to manage statistics

2020-09-10 Thread Kees Cook
From: John Wood Use the previous defined api to manage statistics calling it accordingly when a task forks, calls execve or exits. Signed-off-by: John Wood --- fs/exec.c | 2 ++ kernel/exit.c | 2 ++ kernel/fork.c | 4 3 files changed, 8 insertions(+) diff --git a/fs/exec.c b/fs/exec

Re: [PATCH] checkpatch: Warn on self-assignments

2020-09-10 Thread Kees Cook
d include a link in the checkpatch warning to it? (Feel free to just reuse the text removed from deprecated.rst) -- Kees Cook

Re: [PATCH] kbuild: preprocess module linker script

2020-09-10 Thread Kees Cook
rch/*/kernel/module.lds to arch/*/include/asm/module.lds.h, > which is included from scripts/module.lds.S. > > scripts/module.lds is fine because 'make clean' keeps all the build > artifacts under scripts/. > > You can add arch-specific sections in . > > Signed-off-by: Masahiro Yamada Reviewed-by: Kees Cook -- Kees Cook

[PATCH] mailmap: Add older email addresses for Kees Cook

2020-09-10 Thread Kees Cook
This adds explicit mailmap entries for my older/other email addresses. Reported-by: Joe Perches Signed-off-by: Kees Cook --- .mailmap | 4 1 file changed, 4 insertions(+) diff --git a/.mailmap b/.mailmap index 50096b96c85d..a780211468e4 100644 --- a/.mailmap +++ b/.mailmap @@ -169,6

Re: [PATCH] lib: Fix some broken comments

2020-09-10 Thread Kees Cook
On Thu, Sep 10, 2020 at 05:05:24AM -0400, Miaohe Lin wrote: > Fix some weird and confusing comments. > > Signed-off-by: Miaohe Lin Reviewed-by: Kees Cook -- Kees Cook

Re: [PATCH] sched.h: drop in_ubsan field when UBSAN is in trap mode

2020-09-10 Thread Kees Cook
een vanilla and CONFIG_UBSAN_TRAP'ed kernels. In particular, > this will help enabling bounds sanitizer transparently for Android's > GKI. > > Signed-off-by: Elena Petrova Acked-by: Kees Cook (This should be CCed to akpm who has been taking most of the ubsan patches lately.) -- Kees Cook

Re: [PATCH v2 05/28] objtool: Add a pass for generating __mcount_loc

2020-09-10 Thread Kees Cook
On Fri, Sep 04, 2020 at 11:31:04AM +0200, pet...@infradead.org wrote: > On Thu, Sep 03, 2020 at 03:03:30PM -0700, Sami Tolvanen wrote: > > On Thu, Sep 3, 2020 at 2:51 PM Kees Cook wrote: > > > > > > On Thu, Sep 03, 2020 at 01:30:30PM -0700, Sami Tolvanen wrote: &

Re: [PATCH v2 00/28] Add support for Clang LTO

2020-09-10 Thread Kees Cook
example, these are some: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?qt=grep&q=Control+Flow+Integrity [2] https://lore.kernel.org/lkml/20200624203200.78870-1-samitolva...@google.com/T/#m6b576c3af79bdacada10f21651a2b02d33a4e32e [3] https://android-developers.googleblog.com/2018/10/control-flow-integrity-in-android-kernel.html -- Kees Cook

[PATCH v5] test_firmware: Test platform fw loading on non-EFI systems

2020-09-09 Thread Kees Cook
orcement of the symbol visibility. Fixes: 548193cba2a7 ("test_firmware: add support for firmware_request_platform") Cc: sta...@vger.kernel.org Signed-off-by: Kees Cook --- This is split out from the larger kernel_read_file series: https://lore.kernel.org/lkml/20200729175845.174547

Re: linux-next: build failure after merge of the driver-core tree

2020-09-09 Thread Kees Cook
uot;) > > {sigh} > > I'll go revert this, sorry about that. > > Kees, can you fix up this whole series and resend it again? I'm > dropping it from my trees now... Oh ew, I will check the configs. I wonder what went wrong with this... sorry for the noise! -- Kees Cook

[PATCH v2] selftests/lkdtm: Use "comm" instead of "diff" for dmesg

2020-09-09 Thread Kees Cook
Instead of full GNU diff (which smaller boot environments may not have), use "comm" which is more available. Reported-by: Naresh Kamboju Cc: Shuah Khan Cc: linux-kselft...@vger.kernel.org Fixes: f131d9edc29d ("selftests/lkdtm: Don't clear dmesg when running tests")

Re: [PATCH] selftests/lkdtm: Use "comm" instead of "diff" for dmesg

2020-09-09 Thread Kees Cook
On Wed, Sep 09, 2020 at 04:29:50PM -0400, Joe Lawrence wrote: > On 9/9/20 3:49 PM, Kees Cook wrote: > > > > On Fri, Jun 26, 2020 at 01:59:43PM -0700, Kees Cook wrote: > > > Instead of full GNU diff (which smaller boot environments may not have), > > > u

Re: [PATCH] selftests/lkdtm: Use "comm" instead of "diff" for dmesg

2020-09-09 Thread Kees Cook
On Fri, Jun 26, 2020 at 01:59:43PM -0700, Kees Cook wrote: > Instead of full GNU diff (which smaller boot environments may not have), > use "comm" which is more available. > > Reported-by: Naresh Kamboju > Link: > https://lore.kernel.org/lkml/ca+g9fythp+gg+brr_gk

Re: [PATCH] docs: deprecated.rst: Update zero-length/one-element arrays section

2020-09-09 Thread Kees Cook
f-by: Gustavo A. R. Silva Looks great! Acked-by: Kees Cook -- Kees Cook

Re: [PATCH v2 1/1] samples/seccomp: eliminate two compile warnings in user-trap.c

2020-09-08 Thread Kees Cook
hy do these two warnings occur every time I compiled? Hi! I think the samples have been a bit ignored lately because they have a lot of weird build issues with regard to native vs compat and needing the kernel headers to be built first, etc. That said, yes, I'd like to fix warnings. However, I can't reproduce this. How are you building? I tried x86_64 and cross-compiled to i386. -- Kees Cook

Re: [ptrace] 201766a20e: kernel_selftests.seccomp.make_fail

2020-09-08 Thread Kees Cook
mpile rules. > # TEST_CUSTOM_PROGS should be used by tests that require > # custom build rule and prevent common build rule use. *thread necromancy* I think this is fixed in the selftest tree itself now (though differently), in that it depends on having build the headers first. Anyway, please let me know if this is still a problem, and I'll take another look (and hopefully I also won't lose the thread for a year...) Thanks! -- Kees Cook

Re: [PATCH -next] selftests/seccomp: Use bitwise instead of arithmetic operator for flags

2020-09-08 Thread Kees Cook
NING: sum of > probable bitmasks, consider | Applied, thanks! [1/1] selftests/seccomp: Use bitwise instead of arithmetic operator for flags https://git.kernel.org/kees/c/76993fe3c1e4 Sorry for the massive delay on this one! I lost this email in my inbox. :) -- Kees Cook

Re: [PATCH] seccomp: Use current_pt_regs()

2020-09-08 Thread Kees Cook
kees/c/4484dbacd7b6 I reworded your commit based on the thread and added one comment for a weird case where task == current, hopefully that looks correct: https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?h=for-next/seccomp&id=4484dbacd7b61eaa4e21332c0a044dedce732ebb -- Kees Cook

Re: [PATCH] seccomp: kill process instead of thread for unknown actions

2020-09-08 Thread Kees Cook
1d922d51 I tweaked the coredump logic and added a selftest (and CCed you) for the behavior (since it wasn't included in the existing tests). -- Kees Cook

[PATCH] selftests/seccomp: Add test for unknown SECCOMP_RET kill behavior

2020-09-08 Thread Kees Cook
While we testing for the behavior of unknown seccomp filter return values, there was no test for how it acted in a thread group. Add a test in the thread group tests for this. Signed-off-by: Kees Cook --- (This is going via the seccomp tree.) --- tools/testing/selftests/seccomp/seccomp_bpf.c

Re: [PATCH 1/2] seccomp: don't leak memory when filter install races

2020-09-08 Thread Kees Cook
Applied, thanks! [1/2] seccomp: don't leak memory when filter install races https://git.kernel.org/kees/c/a566a9012acd [2/2] mailmap, MAINTAINERS: move to tycho.pizza https://git.kernel.org/kees/c/19d1d49f2a8c Best regards, -- Kees Cook

<    4   5   6   7   8   9   10   11   12   13   >