Re: [PATCH v4 2/2] pidfd: add tests for NSpid info in fdinfo

2019-10-15 Thread Christian Brauner
sted namespaces. In the case that > a pidfd is from a pid namespace not in the same namespace hierarchy as > the process accessing the fdinfo file, ensure the 'NSpid' shows 0 for > that pidfd, analogous to the 'Pid' entry. > > Signed-off-by: Christian Kellner That looks reasonab

Re: [PATCH v4 1/2] pidfd: add NSpid entries to fdinfo

2019-10-15 Thread Christian Brauner
ment to > pidfd_show_fdinfo with a detailed explanation of Pid and NSpid fields. > > Co-developed-by: Christian Brauner > Signed-off-by: Christian Brauner > Signed-off-by: Christian Kellner Thanks! Reviewed-by: Christian Brauner > --- > Changes in v4: > - Reworked

Re: [PATCH] pidfd: add NSpid entries to fdinfo

2019-10-14 Thread Christian Brauner
On October 14, 2019 5:09:58 PM GMT+02:00, Jann Horn wrote: >On Sat, Oct 12, 2019 at 12:19 PM Christian Brauner > wrote: >> Currently, the fdinfo file of contains the field Pid: > >nit: something missing after "of"? > >> It contains the pid a given

[PATCH v3 2/2] tests: test CLONE_CLEAR_SIGHAND

2019-10-14 Thread Christian Brauner
Test that CLONE_CLEAR_SIGHAND resets signal handlers to SIG_DFL for the child process and that CLONE_CLEAR_SIGHAND and CLONE_SIGHAND are mutually exclusive. Cc: Florian Weimer Cc: libc-al...@sourceware.org Cc: linux-...@vger.kernel.org Signed-off-by: Christian Brauner --- /* v1 */ Link: https

[PATCH v3 1/2] clone3: add CLONE_CLEAR_SIGHAND

2019-10-14 Thread Christian Brauner
? Members of the audience suggested that more glibc developers should perhaps join the linux-api list. The other suggestion was to "copy Florian on everything".' Cc: Oleg Nesterov Cc: Florian Weimer Cc: libc-al...@sourceware.org Cc: linux-...@vger.kernel.org Signed-off-by:

Re: [PATCH] pidfd: add NSpid entries to fdinfo

2019-10-14 Thread Christian Brauner
On Mon, Oct 14, 2019 at 11:43:01AM +0200, Christian Kellner wrote: > On Sat, 2019-10-12 at 12:21 +0200, Christian Brauner wrote: > > I think this might be more what we want. > Yep, indeed. > > > I tried to think of cases where the first entry of Pid is not > > ident

Re: [PATCH 1/2] clone3: add CLONE3_CLEAR_SIGHAND

2019-10-14 Thread Christian Brauner
On Sat, Oct 12, 2019 at 01:46:54PM +0200, Michael Kerrisk (man-pages) wrote: > On 10/12/19 9:48 AM, Christian Brauner wrote: > > On Sat, Oct 12, 2019 at 08:53:34AM +0200, Michael Kerrisk (man-pages) wrote: > >> Hello Aleksa, > >> > >> On Sat, 12 Oc

Re: [PATCH] pidfd: add NSpid entries to fdinfo

2019-10-12 Thread Christian Brauner
On Sat, Oct 12, 2019 at 12:19:22PM +0200, Christian Brauner wrote: > Currently, the fdinfo file of contains the field Pid: > It contains the pid a given pidfd refers to in the pid namespace of the > opener's procfs instance. > If the pid namespace of the process is not a descendan

[PATCH] pidfd: add NSpid entries to fdinfo

2019-10-12 Thread Christian Brauner
-by: Christian Kellner Signed-off-by: Christian Kellner Signed-off-by: Christian Brauner --- kernel/fork.c | 73 ++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/kernel/fork.c b/kernel/fork.c index 1f6c45f6a734..b155bad92d9c 100644

Re: [PATCH 1/2] clone3: add CLONE3_CLEAR_SIGHAND

2019-10-12 Thread Christian Brauner
On Sat, Oct 12, 2019 at 08:53:34AM +0200, Michael Kerrisk (man-pages) wrote: > Hello Aleksa, > > On Sat, 12 Oct 2019 at 00:12, Aleksa Sarai wrote: > > > > On 2019-10-11, Michael Kerrisk wrote: > > > Why CLONE3_CLEAR_SIGHAND rather than just CLONE_CLEAR_SIGHAND? I don't care much how we name

Re: [PATCH v2 2/2] pidfd: add tests for NSpid info in fdinfo

2019-10-11 Thread Christian Brauner
On Fri, Oct 11, 2019 at 05:09:29PM +0200, Jann Horn wrote: > On Wed, Oct 9, 2019 at 6:10 PM Christian Kellner wrote: > > Add tests that check that if pid namespaces are configured the fdinfo > > file of a pidfd contains an NSpid: entry containing the process id > > in the current and additionally

Re: [PATCH v3 1/2] pidfd: show pids for nested pid namespaces in fdinfo

2019-10-11 Thread Christian Brauner
On Fri, Oct 11, 2019 at 05:30:03PM +0200, Jann Horn wrote: > On Fri, Oct 11, 2019 at 5:17 PM Christian Brauner > wrote: > > > > On Fri, Oct 11, 2019 at 04:55:59PM +0200, Jann Horn wrote: > > > On Fri, Oct 11, 2019 at 2:23 PM Christian Kellner > > > wrote: &

Re: [PATCH v3 1/2] pidfd: show pids for nested pid namespaces in fdinfo

2019-10-11 Thread Christian Brauner
On Fri, Oct 11, 2019 at 04:55:59PM +0200, Jann Horn wrote: > On Fri, Oct 11, 2019 at 2:23 PM Christian Kellner wrote: > > The fdinfo file for a process file descriptor already contains the > > pid of the process in the callers namespaces. Additionally, if pid > > namespaces are configured, show

Re: NULL pointer deref in put_fs_context with unprivileged LXC

2019-10-11 Thread Christian Brauner
On Thu, Oct 10, 2019 at 11:35:12PM +0200, Thibaut Sautereau wrote: > Since v5.1 and as of v5.3.5, I get the following oops every single time > I start an *unprivileged* LXC container: > > BUG: kernel NULL pointer dereference, address: 0043 > #PF: supervisor read access in

Re: [PATCH v3 2/2] pidfd: add tests for NSpid info in fdinfo

2019-10-11 Thread Christian Brauner
sted namespaces. > > Signed-off-by: Christian Kellner Acked-by: Christian Brauner Shuah, can I get an Ack for you from this. If you have no objections I'd queue up this patchset for the 5.5 merge window. Thanks! Christian

Re: [PATCH v3 1/2] pidfd: show pids for nested pid namespaces in fdinfo

2019-10-11 Thread Christian Brauner
the process ids of the process in > all nested namespaces in the same format as in the procfs status > file, i.e. "NSPid:\t%d\%d...". This allows the easy identification > of the processes in nested namespaces. > > Signed-off-by: Christian Kellner Reviewed-by: Christian Brauner If

[PATCH v2 2/2] tests: test CLONE3_CLEAR_SIGHAND

2019-10-11 Thread Christian Brauner
Test that CLONE3_CLEAR_SIGHAND resets signal handlers to SIG_DFL for the child process and that CLONE3_CLEAR_SIGHAND and CLONE_SIGHAND are mutually exclusive. Cc: Florian Weimer Cc: libc-al...@sourceware.org Cc: linux-...@vger.kernel.org Signed-off-by: Christian Brauner --- /* v1 */ Link

[PATCH v2 1/2] clone3: add CLONE3_CLEAR_SIGHAND

2019-10-11 Thread Christian Brauner
? Members of the audience suggested that more glibc developers should perhaps join the linux-api list. The other suggestion was to "copy Florian on everything".' Cc: Oleg Nesterov Cc: Florian Weimer Cc: libc-al...@sourceware.org Cc: linux-...@vger.kernel.org Signed-off-by:

Re: [PATCH v2 1/3] seccomp: add SECCOMP_USER_NOTIF_FLAG_CONTINUE

2019-10-11 Thread Christian Brauner
On Thu, Oct 10, 2019 at 02:45:38PM -0700, Kees Cook wrote: > On Fri, Sep 20, 2019 at 10:30:05AM +0200, Christian Brauner wrote: > > + * Similar precautions should be applied when stacking > > SECCOMP_RET_USER_NOTIF. > > + * For SECCOMP_RET_USER_NOTIF filters actin

Re: [PATCH v1] seccomp: simplify secure_computing()

2019-10-11 Thread Christian Brauner
On Thu, Oct 10, 2019 at 02:53:24PM -0700, Kees Cook wrote: > On Tue, Sep 24, 2019 at 08:44:20AM +0200, Christian Brauner wrote: > > Afaict, the struct seccomp_data argument to secure_computing() is unused > > by all current callers. So let's remove it. > > The arg

Re: [PATCH] usercopy: Avoid soft lockups in test_check_nonzero_user()

2019-10-11 Thread Christian Brauner
On Fri, Oct 11, 2019 at 02:48:10PM +1100, Aleksa Sarai wrote: > On 2019-10-11, Michael Ellerman wrote: > > On a machine with a 64K PAGE_SIZE, the nested for loops in > > test_check_nonzero_user() can lead to soft lockups, eg: > > > > watchdog: BUG: soft lockup - CPU#4 stuck for 22s!

Re: [PATCH 1/2] clone3: add CLONE3_CLEAR_SIGHAND

2019-10-11 Thread Christian Brauner
On Fri, Oct 11, 2019 at 10:21:18AM +0200, Michal Hocko wrote: > [Cc linux-api] Right, thanks Michal. Christian

Re: [PATCH 1/2] clone3: add CLONE3_CLEAR_SIGHAND

2019-10-10 Thread Christian Brauner
On Thu, Oct 10, 2019 at 04:19:44PM +0200, Florian Weimer wrote: > * Christian Brauner: > > > @@ -2567,7 +2572,7 @@ static bool clone3_args_valid(const struct > > kernel_clone_args *kargs) > > * All lower bits of the flag word are taken. > > * Veri

[PATCH 2/2] tests: test CLONE3_CLEAR_SIGHAND

2019-10-10 Thread Christian Brauner
Test that CLONE3_CLEAR_SIGHAND resets signal handlers to SIG_DFL for the child process and that CLONE3_CLEAR_SIGHAND and CLONE_SIGHAND are mutually exclusive. Cc: Florian Weimer Cc: libc-al...@sourceware.org Signed-off-by: Christian Brauner --- MAINTAINERS

[PATCH 1/2] clone3: add CLONE3_CLEAR_SIGHAND

2019-10-10 Thread Christian Brauner
? Members of the audience suggested that more glibc developers should perhaps join the linux-api list. The other suggestion was to "copy Florian on everything".' Cc: Oleg Nesterov Cc: Florian Weimer Cc: libc-al...@sourceware.org Signed-off-by: Christian Brauner --- include/

Re: [PATCH 0/3] bpf: switch to new usercopy helpers

2019-10-10 Thread Christian Brauner
On Wed, Oct 09, 2019 at 04:06:18PM -0700, Alexei Starovoitov wrote: > On Wed, Oct 9, 2019 at 9:09 AM Christian Brauner > wrote: > > > > Hey everyone, > > > > In v5.4-rc2 we added two new helpers check_zeroed_user() and > > copy_struct_from_user() including

Re: [PATCH v2 1/2] pidfd: show pids for nested pid namespaces in fdinfo

2019-10-09 Thread Christian Brauner
On Wed, Oct 09, 2019 at 06:05:30PM +0200, Christian Kellner wrote: > From: Christian Kellner > > The fdinfo file for a process file descriptor already contains the > pid of the process in the callers namespaces. Additionally, if pid > namespaces are configured, show the process ids of the

[PATCH 2/3] bpf: use copy_struct_from_user() in bpf_prog_get_info_by_fd()

2019-10-09 Thread Christian Brauner
() already. So technically, the min_t() call could go. But the info_len is used further below so leave it. [1]: f5a1a536fa14 ("lib: introduce copy_struct_from_user() helper") Signed-off-by: Christian Brauner --- kernel/bpf/syscall.c | 7 ++- 1 file changed, 2 insertions(+), 5

[PATCH 1/3] bpf: use check_zeroed_user() in bpf_check_uarg_tail_zero()

2019-10-09 Thread Christian Brauner
oduce copy_struct_from_user() helper") Signed-off-by: Christian Brauner --- kernel/bpf/syscall.c | 22 +++--- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 82eabd4e38ad..78790778f101 100644 --- a/kernel/bpf/syscall.c +++ b/

[PATCH 0/3] bpf: switch to new usercopy helpers

2019-10-09 Thread Christian Brauner
. This little series switches over bpf codepaths that have hand-rolled implementations of these helpers. Thanks! Christian /* Reference */ [1]: f5a1a536fa14 ("lib: introduce copy_struct_from_user() helper") Christian Brauner (3): bpf: use check_zeroed_user() in bpf_check_uarg_tail_zero()

[PATCH 3/3] bpf: use copy_struct_from_user() in bpf() syscall

2019-10-09 Thread Christian Brauner
() already. So technically, the min_t() call could go. But the size is used further below so leave it. [1]: f5a1a536fa14 ("lib: introduce copy_struct_from_user() helper") Signed-off-by: Christian Brauner --- kernel/bpf/syscall.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-)

Re: [PATCH] binder: prevent UAF read in print_binder_transaction_log_entry()

2019-10-09 Thread Christian Brauner
On Wed, Oct 09, 2019 at 10:55:58AM -0400, Joel Fernandes wrote: > On Wed, Oct 09, 2019 at 04:29:11PM +0200, Christian Brauner wrote: > > On Wed, Oct 09, 2019 at 10:21:29AM -0400, Joel Fernandes wrote: > > > On Wed, Oct 09, 2019 at 12:40:12PM +0200, Christian Brauner wrote: >

Re: [PATCH] binder: prevent UAF read in print_binder_transaction_log_entry()

2019-10-09 Thread Christian Brauner
On Wed, Oct 09, 2019 at 10:21:29AM -0400, Joel Fernandes wrote: > On Wed, Oct 09, 2019 at 12:40:12PM +0200, Christian Brauner wrote: > > On Tue, Oct 08, 2019 at 02:05:16PM -0400, Joel Fernandes wrote: > > > On Tue, Oct 08, 2019 at 03:01:59PM +0200, Christian Brauner wrote: >

Re: [PATCH v5] taskstats: fix data-race

2019-10-09 Thread Christian Brauner
On Wed, Oct 09, 2019 at 01:48:09PM +0200, Christian Brauner wrote: > When assiging and testing taskstats in taskstats_exit() there's a race > when writing and reading sig->stats when a thread-group with more than > one thread exits: > > cpu0: > thread catches fatal signal a

Re: [PATCH] taskstats: fix data-race

2019-10-09 Thread Christian Brauner
On Wed, Oct 09, 2019 at 01:48:27PM +0200, Marco Elver wrote: > On Wed, 9 Oct 2019 at 13:31, Christian Brauner > wrote: > > > > When assiging and testing taskstats in taskstats_exit() there's a race > > when writing and reading sig->stats when a thread-group with mor

[PATCH v5] taskstats: fix data-race

2019-10-09 Thread Christian Brauner
d_acquire() and smp_store_release(). Reported-by: syzbot+c5d03165a1bd1dead...@syzkaller.appspotmail.com Fixes: 34ec12349c8a ("taskstats: cleanup ->signal->stats allocation") Cc: sta...@vger.kernel.org Signed-off-by: Christian Brauner Reviewed-by: Dmitry Vyukov --- /* v1 */ Link: https://lore.kernel.o

Re: [PATCH] taskstats: fix data-race

2019-10-09 Thread Christian Brauner
On Wed, Oct 09, 2019 at 01:31:34PM +0200, Christian Brauner wrote: > When assiging and testing taskstats in taskstats_exit() there's a race > when writing and reading sig->stats when a thread-group with more than > one thread exits: > > cpu0: > thread catches fatal signal a

[PATCH] taskstats: fix data-race

2019-10-09 Thread Christian Brauner
d_acquire() and smp_store_release(). Reported-by: syzbot+c5d03165a1bd1dead...@syzkaller.appspotmail.com Fixes: 34ec12349c8a ("taskstats: cleanup ->signal->stats allocation") Cc: sta...@vger.kernel.org Signed-off-by: Christian Brauner Reviewed-by: Dmitry Vyukov --- /* v1 */ Link: https://lore.kernel.o

Re: [PATCH] binder: prevent UAF read in print_binder_transaction_log_entry()

2019-10-09 Thread Christian Brauner
On Tue, Oct 08, 2019 at 02:05:16PM -0400, Joel Fernandes wrote: > On Tue, Oct 08, 2019 at 03:01:59PM +0200, Christian Brauner wrote: > > When a binder transaction is initiated on a binder device coming from a > > binderfs instance, a pointer to the name of the binder de

Re: [PATCH v2] taskstats: fix data-race

2019-10-08 Thread Christian Brauner
On Tue, Oct 08, 2019 at 05:26:59PM +0200, Andrea Parri wrote: > On Tue, Oct 08, 2019 at 04:24:14PM +0200, Christian Brauner wrote: > > On Tue, Oct 08, 2019 at 04:20:35PM +0200, Andrea Parri wrote: > > > On Mon, Oct 07, 2019 at 04:18:26PM +0200, Dmitry Vyukov wrote: > > >

Re: [PATCH v2] taskstats: fix data-race

2019-10-08 Thread Christian Brauner
On Tue, Oct 08, 2019 at 04:20:35PM +0200, Andrea Parri wrote: > On Mon, Oct 07, 2019 at 04:18:26PM +0200, Dmitry Vyukov wrote: > > On Mon, Oct 7, 2019 at 4:14 PM Andrea Parri wrote: > > > > > > > > > static struct taskstats *taskstats_tgid_alloc(struct task_struct > > > > > > *tsk) > > > > > >

Re: [PATCH] pidfd: show pids for nested pid namespaces in fdinfo

2019-10-08 Thread Christian Brauner
ools/testing/selftests/pidfd/ and should already have most of the infrastructure there. The fdinfo parsing code should be in samples/pidfd/ which For the patch itself: Reviewed-by: Christian Brauner You can resend with my Reviewed-by retained if you don't change anything. Before I see tests I

[PATCH] binder: prevent UAF read in print_binder_transaction_log_entry()

2019-10-08 Thread Christian Brauner
: 03e2e07e3814 ("binder: Make transaction_log available in binderfs") Link: https://lore.kernel.org/r/cag48ez14q0-f8lqsvcnbyr2o6gpw8shxsm4u5jmd9mpstem...@mail.gmail.com Cc: Joel Fernandes Cc: Todd Kjos Cc: Hridya Valsaraju Signed-off-by: Christian Brauner --- drivers/android/binder.c

Re: [PATCH] proc:fix confusing macro arg name

2019-10-08 Thread Christian Brauner
_size and ops are in the wrong position, fix it. > > Signed-off-by: Miaohe Lin > Reviewed-by: Andrew Morton > Cc: Alexey Dobriyan > Signed-off-by: Andrew Morton I thought I already reviewed this weeks ago... Reviewed-by: Christian Brauner

Re: UAF read in print_binder_transaction_log_entry() on ANDROID_BINDERFS kernels

2019-10-07 Thread Christian Brauner
On Mon, Oct 07, 2019 at 10:49:57PM +0200, Jann Horn wrote: > Hi! > > There is a use-after-free read in print_binder_transaction_log_entry() > on ANDROID_BINDERFS kernels because > print_binder_transaction_log_entry() prints the char* e->context_name > as string, and if the transaction occurred on

Re: [PATCH v2] taskstats: fix data-race

2019-10-07 Thread Christian Brauner
On Mon, Oct 07, 2019 at 04:08:41PM +0200, Dmitry Vyukov wrote: > On Mon, Oct 7, 2019 at 3:55 PM Christian Brauner > wrote: > > > > On Mon, Oct 07, 2019 at 03:50:47PM +0200, Dmitry Vyukov wrote: > > > On Mon, Oct 7, 2019 at 3:18 PM Andrea Parri > > > wrote:

Re: [PATCH v2] taskstats: fix data-race

2019-10-07 Thread Christian Brauner
On Mon, Oct 07, 2019 at 03:50:47PM +0200, Dmitry Vyukov wrote: > On Mon, Oct 7, 2019 at 3:18 PM Andrea Parri wrote: > > > > On Mon, Oct 07, 2019 at 01:01:17PM +0200, Christian Brauner wrote: > > > When assiging and testing taskstats in taskstats_exit() there's a

Re: [PATCH v2] taskstats: fix data-race

2019-10-07 Thread Christian Brauner
On Mon, Oct 07, 2019 at 03:18:04PM +0200, Andrea Parri wrote: > On Mon, Oct 07, 2019 at 01:01:17PM +0200, Christian Brauner wrote: > > When assiging and testing taskstats in taskstats_exit() there's a race > > when writing and reading sig->stats when a thread-group with more t

[PATCH v2] taskstats: fix data-race

2019-10-07 Thread Christian Brauner
e_release(). Reported-by: syzbot+c5d03165a1bd1dead...@syzkaller.appspotmail.com Fixes: 34ec12349c8a ("taskstats: cleanup ->signal->stats allocation") Cc: sta...@vger.kernel.org Signed-off-by: Christian Brauner Reviewed-by: Dmitry Vyukov Link: https://lore.kernel.org/r/20191006235

Re: [PATCH] taskstats: fix data-race

2019-10-07 Thread Christian Brauner
On Mon, Oct 07, 2019 at 12:40:39PM +0200, Andrea Parri wrote: > Hi Christian, > > On Mon, Oct 07, 2019 at 01:52:16AM +0200, Christian Brauner wrote: > > When assiging and testing taskstats in taskstats_exit() there's a race > > when writing and reading sig->stats when

Re: [PATCH] taskstats: fix data-race

2019-10-07 Thread Christian Brauner
On Mon, Oct 07, 2019 at 09:31:16AM +0200, Dmitry Vyukov wrote: > On Mon, Oct 7, 2019 at 1:52 AM Christian Brauner > wrote: > > > > When assiging and testing taskstats in taskstats_exit() there's a race > > when writing and reading sig->stats when a thread-group with mor

[PATCH] taskstats: fix data-race

2019-10-06 Thread Christian Brauner
e_release(). Reported-by: syzbot+c5d03165a1bd1dead...@syzkaller.appspotmail.com Cc: Dmitry Vyukov Signed-off-by: Christian Brauner --- /* v1 */ Link: https://lore.kernel.org/r/20191005112806.13960-1-christian.brau...@ubuntu.com /* v2 */ - Dmitry Vyukov , Marco Elver : - fix the original double-checke

Re: [PATCH] taskstats: fix data-race

2019-10-06 Thread Christian Brauner
On Sun, Oct 06, 2019 at 12:00:32PM +0200, Dmitry Vyukov wrote: > On Sat, Oct 5, 2019 at 1:28 PM Christian Brauner > wrote: > > > > When assiging and testing taskstats in taskstats > > taskstats_exit() there's a race around writing and reading sig->stats. > &

Re: [PATCH] lib: test_user_copy: style cleanup

2019-10-06 Thread Christian Brauner
d-off-by: Aleksa Sarai Fwiw, I think the commit message doesn't necessarily need to mention stylistic preferences nor a specific mail. It's sufficient enough to say that the new way makes things way more obvious. But ok. :) I'll pick this up now. Reviewed-by: Christian Brauner

Re: [PATCH] taskstats: fix data-race

2019-10-05 Thread Christian Brauner
On Sat, Oct 05, 2019 at 03:33:07PM +0200, Marco Elver wrote: > On Sat, 5 Oct 2019 at 13:28, Christian Brauner > wrote: > > > > When assiging and testing taskstats in taskstats > > taskstats_exit() there's a race around writing and reading sig->stats. > &

Re: KCSAN: data-race in taskstats_exit / taskstats_exit

2019-10-05 Thread Christian Brauner
On Sat, Oct 05, 2019 at 06:29:39AM +0200, Dmitry Vyukov wrote: > On Sat, Oct 5, 2019 at 6:26 AM syzbot > wrote: > > > > Hello, > > > > syzbot found the following crash on: > > > > HEAD commit:b4bd9343 x86, kcsan: Enable KCSAN for x86 > > git tree: https://github.com/google/ktsan.git

[PATCH] taskstats: fix data-race

2019-10-05 Thread Christian Brauner
yzkaller.appspotmail.com Signed-off-by: Christian Brauner --- kernel/taskstats.c | 28 +--- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/kernel/taskstats.c b/kernel/taskstats.c index 13a0f2e6ebc2..58b145234c4a 100644 --- a/kernel/taskstats.c +++ b/kerne

Re: [GIT PULL] usercopy structs for v5.4-rc2

2019-10-04 Thread Christian Brauner
On Fri, Oct 04, 2019 at 10:53:41AM -0700, Linus Torvalds wrote: > On Fri, Oct 4, 2019 at 3:42 AM Christian Brauner > wrote: > > > >The only separate fix we we had to apply > > was for a warning by clang when building the tests for using the result of > >

Re: [GIT PULL] process fixes for v5.4-rc2

2019-10-04 Thread Christian Brauner
On Fri, Oct 04, 2019 at 10:24:05AM -0700, Linus Torvalds wrote: > On Fri, Oct 4, 2019 at 2:40 AM Christian Brauner > wrote: > > > > This pull request contains a couple of fixes: > > Pulled. > > Small note: it is sad, and I'm ashamed of my life, but to me &

Re: [PATCH] devpts: Fix NULL pointer dereference in dcache_readdir()

2019-10-04 Thread Christian Brauner
On Fri, Oct 04, 2019 at 04:10:58PM +0100, Al Viro wrote: > On Fri, Oct 04, 2019 at 04:33:02PM +0200, Christian Brauner wrote: > > On Fri, Oct 04, 2019 at 03:27:48PM +0100, Al Viro wrote: > > > On Fri, Oct 04, 2019 at 04:05:03PM +0200, Christian Brauner wrote: > &g

Re: [PATCH] devpts: Fix NULL pointer dereference in dcache_readdir()

2019-10-04 Thread Christian Brauner
On Fri, Oct 04, 2019 at 03:27:48PM +0100, Al Viro wrote: > On Fri, Oct 04, 2019 at 04:05:03PM +0200, Christian Brauner wrote: > > From: Will Deacon > > > > Closing /dev/pts/ptmx removes the corresponding pty under /dev/pts/ > > without synchronizing against concurrent

[PATCH] devpts: Fix NULL pointer dereference in dcache_readdir()

2019-10-04 Thread Christian Brauner
rences */ [1]: https://lore.kernel.org/r/20181109143744.GA12128@hc Fixes: 8ead9dd54716 ("devpts: more pty driver interface cleanups") Cc: Cc: Jan Glauber Cc: Alexander Viro Cc: Greg Kroah-Hartman Cc: Linus Torvalds Signed-off-by: Will Deacon Reviewed-by: Christian Brauner [christi

[GIT PULL] usercopy structs for v5.4-rc2

2019-10-04 Thread Christian Brauner
Hi Linus, /* Summary */ This pull request contains the copy_struct_from_user() helper which got split out from the openat2() patchset. It is a generic interface designed to copy a struct from userspace. The helper will be especially useful for structs versioned by size of which we have quite a

Re: Linux 5.4 kselftest known issues - update

2019-10-04 Thread Christian Brauner
On Thu, Oct 03, 2019 at 08:30:55AM -0600, shuah wrote: > On 9/26/19 11:41 AM, Shuah Khan wrote: > > Here are the know kselftest issues on Linux 5.4 with > > top commit commit 619e17cf75dd58905aa67ccd494a6ba5f19d6cc6 > > on x86_64: > > > > The goal is to get these addressed before 5.4 comes out. >

[GIT PULL] process fixes for v5.4-rc2

2019-10-04 Thread Christian Brauner
) In some scenarios linux/uapi/linux/sched.h is included where __ASSEMBLY__ is defined causing a build failure because struct clone_args was not guarded by an #ifndef __ASSEMBLY__. - Add missing clone3() and struct clone_args kernel-doc (Christian Brauner) clone3() and struct clone_args were

Re: [RFC][PATCH] sysctl: Remove the sysctl system call

2019-10-03 Thread Christian Brauner
On Thu, Oct 03, 2019 at 08:56:19AM +0200, Florian Weimer wrote: > Is anyone else getting a very incomplete set of messages in this > thread? > > These changes likely matter to glibc, and I've yet to see the actual > patch. Would someone please forward it to me? > > The original message didn't

Re: Kernel Concurrency Sanitizer (KCSAN)

2019-10-03 Thread Christian Brauner
On Thu, Oct 03, 2019 at 06:00:38PM +0200, Dmitry Vyukov wrote: > On Thu, Oct 3, 2019 at 3:13 PM Dmitry Vyukov wrote: > > > > On Wed, Oct 2, 2019 at 9:52 PM Marco Elver wrote: > > > > > > Hi Joel, > > > > > > On Tue, 1 Oct 2019 at 23:19, Joel Fernandes > > > wrote: > > > > > > > > On Fri, Sep

Re: [PATCH] usercopy: Add parentheses around assignment in test_copy_struct_from_user

2019-10-03 Thread Christian Brauner
On Thu, Oct 03, 2019 at 10:11:21AM -0700, Nathan Chancellor wrote: > Clang warns: > > lib/test_user_copy.c:96:10: warning: using the result of an assignment > as a condition without parentheses [-Wparentheses] > if (ret |= test(umem_src == NULL, "kmalloc failed")) >

Re: [PATCH v4 0/4] lib: introduce copy_struct_from_user() helper

2019-10-01 Thread Christian Brauner
On Tue, Oct 01, 2019 at 11:10:51AM +1000, Aleksa Sarai wrote: > Patch changelog: > v4: > * __always_inline copy_struct_from_user(). [Kees Cook] > * Rework test_user_copy.ko changes. [Kees Cook] > v3: >

[PATCH 0/2] document clone3 and struct clone_args

2019-10-01 Thread Christian Brauner
Hey, This adds missing kernel-docs for the clone3() syscall and its argument struct clone_args. I somehow failed to add this right away. I intend to include this in my rc2 pull request. Thanks! Christian Christian Brauner (2): fork: add kernel-doc for clone3 sched: add kernel-doc

[PATCH 2/2] sched: add kernel-doc for struct clone_args

2019-10-01 Thread Christian Brauner
Add kernel-doc for struct clone_args for the clone3() syscall. Signed-off-by: Christian Brauner --- include/uapi/linux/sched.h | 26 -- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/sched.h b/include/uapi/linux/sched.h index

[PATCH 1/2] fork: add kernel-doc for clone3

2019-10-01 Thread Christian Brauner
Add kernel-doc for the clone3() syscall. Signed-off-by: Christian Brauner --- kernel/fork.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/kernel/fork.c b/kernel/fork.c index 5a0fd518e04e..c819cce9bdd0 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -2590,6 +2590,17

Re: [PATCH v4 4/4] perf_event_open: switch to copy_struct_from_user()

2019-09-30 Thread Christian Brauner
On Tue, Oct 01, 2019 at 11:10:55AM +1000, Aleksa Sarai wrote: > The change is very straightforward, and helps unify the syscall > interface for struct-from-userspace syscalls. > > Reviewed-by: Kees Cook > Signed-off-by: Aleksa Sarai Reviewed-by: Christian Brauner

Re: [PATCH v4 2/4] clone3: switch to copy_struct_from_user()

2019-09-30 Thread Christian Brauner
sion pattern. > > Reviewed-by: Kees Cook > Signed-off-by: Aleksa Sarai Reviewed-by: Christian Brauner

Re: [PATCH v4 3/4] sched_setattr: switch to copy_struct_from_user()

2019-09-30 Thread Christian Brauner
I logic and code") > > Reviewed-by: Kees Cook > Signed-off-by: Aleksa Sarai Reviewed-by: Christian Brauner

Re: [PATCH v4 1/4] lib: introduce copy_struct_from_user() helper

2019-09-30 Thread Christian Brauner
o ensure they are zeroed, otherwise -E2BIG is returned. > > + * > > + * Returns (in all cases, some data may have been copied): > > + * * -E2BIG: (@usize > @ksize) and there are non-zero trailing bytes in > > @src. > > + * * -EFAULT: access to userspace failed. > > + */ > > +static __always_inline > > +int copy_struct_from_user(void *dst, size_t ksize, > > + const void __user *src, size_t usize) > > And of course I forgot to realize both this and check_zeroed_user() > should also have the __must_check attribute. Sorry for forgetting that > earlier! Just said to Aleksa that I'll just fix this up when I apply so he doesn't have to resend. You ok with this, Kees? > > With that, please consider it: > > Reviewed-by: Kees Cook Reviewed-by: Christian Brauner

Re: [PATCH] binder: Fix comment headers on binder_alloc_prepare_to_free()

2019-09-30 Thread Christian Brauner
On Mon, Sep 30, 2019 at 04:12:50PM -0400, Joel Fernandes wrote: > binder_alloc_buffer_lookup() doesn't exist and is named > "binder_alloc_prepare_to_free()". Correct the code comments to reflect > this. > > Signed-off-by: Joel Fernandes (Google) Reviewed-by: Christian Brauner

Re: [PATCH v3 0/4] Add binder state and statistics to binderfs

2019-09-27 Thread Christian Brauner
On Tue, Sep 03, 2019 at 09:16:51AM -0700, Hridya Valsaraju wrote: > Currently, the only way to access binder state and > statistics is through debugfs. We need a way to > access the same even when debugfs is not mounted. > These patches add a mount option to make this > information available in

Re: [PATCH v2 1/4] lib: introduce copy_struct_from_user() helper

2019-09-27 Thread Christian Brauner
On Fri, Sep 27, 2019 at 11:07:36AM +1000, Aleksa Sarai wrote: > On 2019-09-26, Christian Brauner wrote: > > On Thu, Sep 26, 2019 at 01:03:29AM +0200, Aleksa Sarai wrote: > > > +int is_zeroed_user(const void __user *from, size_t size) > > > +{ > > > + unsign

Re: [PATCH v2 1/4] lib: introduce copy_struct_from_user() helper

2019-09-26 Thread Christian Brauner
On Thu, Sep 26, 2019 at 01:03:29AM +0200, Aleksa Sarai wrote: > A common pattern for syscall extensions is increasing the size of a > struct passed from userspace, such that the zero-value of the new fields > result in the old kernel behaviour (allowing for a mix of userspace and > kernel vintages

Re: [PATCH v2 1/4] lib: introduce copy_struct_from_user() helper

2019-09-25 Thread Christian Brauner
On Thu, Sep 26, 2019 at 01:03:29AM +0200, Aleksa Sarai wrote: > A common pattern for syscall extensions is increasing the size of a > struct passed from userspace, such that the zero-value of the new fields > result in the old kernel behaviour (allowing for a mix of userspace and > kernel vintages

Re: [PATCH v1 2/4] clone3: switch to copy_struct_from_user()

2019-09-25 Thread Christian Brauner
On Wed, Sep 25, 2019 at 06:59:13PM +0200, Aleksa Sarai wrote: > The change is very straightforward, and helps unify the syscall > interface for struct-from-userspace syscalls. Additionally, explicitly > define CLONE_ARGS_SIZE_VER0 to match the other users of the > struct-extension pattern. > >

Re: [PATCH v1 1/4] lib: introduce copy_struct_from_user() helper

2019-09-25 Thread Christian Brauner
On Wed, Sep 25, 2019 at 07:18:11PM +0200, Christian Brauner wrote: > On Wed, Sep 25, 2019 at 06:59:12PM +0200, Aleksa Sarai wrote: > > A common pattern for syscall extensions is increasing the size of a > > struct passed from userspace, such that the zero-value of the new fi

Re: [PATCH v1 1/4] lib: introduce copy_struct_from_user() helper

2019-09-25 Thread Christian Brauner
On Wed, Sep 25, 2019 at 06:59:12PM +0200, Aleksa Sarai wrote: > A common pattern for syscall extensions is increasing the size of a > struct passed from userspace, such that the zero-value of the new fields > result in the old kernel behaviour (allowing for a mix of userspace and > kernel vintages

Re: [PATCH v1 0/4] lib: introduce copy_struct_from_user() helper

2019-09-25 Thread Christian Brauner
On Wed, Sep 25, 2019 at 06:59:11PM +0200, Aleksa Sarai wrote: > This series was split off from the openat2(2) syscall discussion[1]. > However, the copy_struct_to_user() helper has been dropped, because > after some discussion it appears that there is no really obvious > semantics for how

Re: For review: pidfd_send_signal(2) manual page

2019-09-25 Thread Christian Brauner
On Wed, Sep 25, 2019 at 03:46:26PM +0200, Michael Kerrisk (man-pages) wrote: > On 9/24/19 11:53 PM, Christian Brauner wrote: > > On Tue, Sep 24, 2019 at 11:00:03PM +0200, Michael Kerrisk (man-pages) wrote: > >> Hello Christian, > >> > >>>>> I

Re: For review: pidfd_send_signal(2) manual page

2019-09-24 Thread Christian Brauner
On Tue, Sep 24, 2019 at 11:00:03PM +0200, Michael Kerrisk (man-pages) wrote: > Hello Christian, > > >>> If you're the parent of the process you can do this without CLONE_PIDFD: > >>> pid = fork(); > >>> pidfd = pidfd_open(); > >>> ret = pidfd_send_signal(pidfd, 0, NULL, 0); > >>> if (ret < 0 &&

Re: For review: pidfd_send_signal(2) manual page

2019-09-24 Thread Christian Brauner
On Tue, Sep 24, 2019 at 09:57:04PM +0200, Christian Brauner wrote: > On Tue, Sep 24, 2019 at 09:44:49PM +0200, Michael Kerrisk (man-pages) wrote: > > Hello Christian, > > > > On 9/23/19 4:23 PM, Christian Brauner wrote: > > > On Mon, Sep 23, 2019 at 01:26:34

Re: [PATCH] selftests: pidfd: Fix undefined reference to pthread_create()

2019-09-24 Thread Christian Brauner
On Tue, Sep 24, 2019 at 01:52:37PM -0600, Shuah Khan wrote: > Fix build failure: > > undefined reference to `pthread_create' > collect2: error: ld returned 1 exit status > > Fix CFLAGS to include pthread correctly. > > Signed-off-by: Shuah Khan Reviewed-by: Christian

Re: For review: pidfd_send_signal(2) manual page

2019-09-24 Thread Christian Brauner
On Tue, Sep 24, 2019 at 09:44:49PM +0200, Michael Kerrisk (man-pages) wrote: > Hello Christian, > > On 9/23/19 4:23 PM, Christian Brauner wrote: > > On Mon, Sep 23, 2019 at 01:26:34PM +0200, Florian Weimer wrote: > >> * Michael Kerrisk: > >> > >>> SY

Re: For review: pidfd_open(2) manual page

2019-09-24 Thread Christian Brauner
On Mon, Sep 23, 2019 at 10:41:19PM +0200, Florian Weimer wrote: > * Michael Kerrisk: > > >>>static > >>>int pidfd_open(pid_t pid, unsigned int flags) > >>>{ > >>>return syscall(__NR_pidfd_open, pid, flags); > >>>} > >> > >> Please call this function

[PATCH v1] seccomp: simplify secure_computing()

2019-09-24 Thread Christian Brauner
in [2]). This is not true anymore though. /* References */ [1]: 2f275de5d1ed ("seccomp: Add a seccomp_data parameter secure_computing()") [2]: https://lore.kernel.org/r/calcetru_fs_at-htpr231kpaad0z7xjn4ku-dvzhru6cvcj...@mail.gmail.com Signed-off-by: Christian Brauner Cc: Andy Lutomirski

Re: [PATCH] seccomp: remove unused arg from secure_computing()

2019-09-24 Thread Christian Brauner
On Mon, Sep 23, 2019 at 11:41:59AM -0700, Andy Lutomirski wrote: > On Mon, Sep 23, 2019 at 2:49 AM Borislav Petkov wrote: > > > > On Fri, Sep 20, 2019 at 03:19:09PM +0200, Christian Brauner wrote: > > > While touching seccomp code I realized that the struct sec

Re: [PATCH] seccomp: remove unused arg from secure_computing()

2019-09-24 Thread Christian Brauner
On Mon, Sep 23, 2019 at 09:34:46PM +0200, Borislav Petkov wrote: > On Mon, Sep 23, 2019 at 11:41:59AM -0700, Andy Lutomirski wrote: > > On Mon, Sep 23, 2019 at 2:49 AM Borislav Petkov wrote: > > > > > > On Fri, Sep 20, 2019 at 03:19:09PM +0200, Christian Brauner wr

Re: For review: pidfd_open(2) manual page

2019-09-23 Thread Christian Brauner
On Mon, Sep 23, 2019 at 12:53:09PM +0200, Florian Weimer wrote: > * Michael Kerrisk: > > > SYNOPSIS > >int pidfd_open(pid_t pid, unsigned int flags); > > Should this mention for pid_t? > > > ERRORS > >EINVAL flags is not 0. > > > >EINVAL pid is not valid. > > > >

Re: For review: pidfd_open(2) manual page

2019-09-23 Thread Christian Brauner
On Mon, Sep 23, 2019 at 11:11:53AM +0200, Michael Kerrisk (man-pages) wrote: > Hello Christian and all, > > Below, I have the rendered version of the current draft of > the pidfd_open(2) manual page that I have written. > The page source can be found in a Git branch at: >

Re: For review: pidfd_send_signal(2) manual page

2019-09-23 Thread Christian Brauner
On Mon, Sep 23, 2019 at 11:12:00AM +0200, Michael Kerrisk (man-pages) wrote: > Hello Christian and all, > > Below, I have the rendered version of the current draft of > the pidfd_send_signal(2) manual page that I have written. > The page source can be found in a Git branch at: >

Re: For review: pidfd_send_signal(2) manual page

2019-09-23 Thread Christian Brauner
On Mon, Sep 23, 2019 at 01:26:34PM +0200, Florian Weimer wrote: > * Michael Kerrisk: > > > SYNOPSIS > >int pidfd_send_signal(int pidfd, int sig, siginfo_t info, > > unsigned int flags); > > This probably should reference a header for siginfo_t. Agreed. > >

[PATCH] seccomp: remove unused arg from secure_computing()

2019-09-20 Thread Christian Brauner
While touching seccomp code I realized that the struct seccomp_data argument to secure_computing() seems to be unused by all current callers. So let's remove it unless there is some subtlety I missed. Note, I only tested this on x86. Signed-off-by: Christian Brauner Cc: Andy Lutomirski Cc

[PATCH v2 2/3] seccomp: avoid overflow in implicit constant conversion

2019-09-20 Thread Christian Brauner
^ seccomp_bpf.c:3572:15: note: in expansion of macro ‘USER_NOTIF_MAGIC’ resp.error = USER_NOTIF_MAGIC; ^~~~ Fixes: 6a21cc50f0c7 ("seccomp: add a return code to trap to userspace") Signed-off-by: Christian Brauner Reviewed-by: Tyler Hicks Cc:

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