Re: [linux-next] BUG triggered in ptraceme

2018-09-27 Thread Jann Horn
On Wed, Sep 19, 2018 at 6:13 PM Cyrill Gorcunov wrote: > > On Wed, Sep 19, 2018 at 04:16:50PM +0200, Jann Horn wrote: > ... > > > > > > Heh, actually not :) It is due to commit > > > > > > commit 1f8266ff58840d698a1e96d2274189de1bdf7969 > > >

[PATCH resend] proc: restrict kernel stack dumps to root

2018-09-27 Thread Jann Horn
stack") Cc: sta...@vger.kernel.org Signed-off-by: Jann Horn --- Resending because I forgot to send this to akpm the first time. fs/proc/base.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/fs/proc/base.c b/fs/proc/base.c index ccf86f16d9f0..7e9f07bf260d 100644 --- a/fs/p

[PATCH resend] proc: restrict kernel stack dumps to root

2018-09-27 Thread Jann Horn
stack") Cc: sta...@vger.kernel.org Signed-off-by: Jann Horn --- Resending because I forgot to send this to akpm the first time. fs/proc/base.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/fs/proc/base.c b/fs/proc/base.c index ccf86f16d9f0..7e9f07bf260d 100644 --- a/fs/p

Re: [PATCH] proc: restrict kernel stack dumps to root

2018-09-26 Thread Jann Horn
On Thu, Sep 13, 2018 at 4:39 PM Kees Cook wrote: > On Thu, Sep 13, 2018 at 4:55 AM, Jann Horn wrote: > > On Thu, Sep 13, 2018 at 12:28 AM Kees Cook wrote: > >> > >> On Wed, Sep 12, 2018 at 8:29 AM, Jann Horn wrote: > >> > +linux-api, I guess > >&g

Re: [PATCH] proc: restrict kernel stack dumps to root

2018-09-26 Thread Jann Horn
On Thu, Sep 13, 2018 at 4:39 PM Kees Cook wrote: > On Thu, Sep 13, 2018 at 4:55 AM, Jann Horn wrote: > > On Thu, Sep 13, 2018 at 12:28 AM Kees Cook wrote: > >> > >> On Wed, Sep 12, 2018 at 8:29 AM, Jann Horn wrote: > >> > +linux-api, I guess > >&g

Re: [PATCH v6 4/5] seccomp: add support for passing fds via USER_NOTIF

2018-09-21 Thread Jann Horn
On Fri, Sep 21, 2018 at 3:39 PM Tycho Andersen wrote: > On Thu, Sep 20, 2018 at 07:18:45PM -0700, Andy Lutomirski wrote: > > On Thu, Sep 20, 2018 at 4:42 PM Tycho Andersen wrote: > > > On Wed, Sep 19, 2018 at 12:58:20PM -0700, Andy Lutomirski wrote: > > > > On Wed, Sep 19, 2018 at 7:38 AM, Tycho

Re: [PATCH v6 4/5] seccomp: add support for passing fds via USER_NOTIF

2018-09-21 Thread Jann Horn
On Fri, Sep 21, 2018 at 3:39 PM Tycho Andersen wrote: > On Thu, Sep 20, 2018 at 07:18:45PM -0700, Andy Lutomirski wrote: > > On Thu, Sep 20, 2018 at 4:42 PM Tycho Andersen wrote: > > > On Wed, Sep 19, 2018 at 12:58:20PM -0700, Andy Lutomirski wrote: > > > > On Wed, Sep 19, 2018 at 7:38 AM, Tycho

Re: [linux-next] BUG triggered in ptraceme

2018-09-19 Thread Jann Horn
aa_label *label = aa_current_raw_label(); > > > > --> might_sleep(); > > > > Take a look please, once time permit. > > Heh, actually not :) It is due to commit > > commit 1f8266ff58840d698a1e96d2274189de1bdf7969 > Author: Jann Horn > Date: Thu Sep

Re: [linux-next] BUG triggered in ptraceme

2018-09-19 Thread Jann Horn
aa_label *label = aa_current_raw_label(); > > > > --> might_sleep(); > > > > Take a look please, once time permit. > > Heh, actually not :) It is due to commit > > commit 1f8266ff58840d698a1e96d2274189de1bdf7969 > Author: Jann Horn > Date: Thu Sep

Re: [BUG] mm: direct I/O (using GUP) can write to COW anonymous pages

2018-09-17 Thread Jann Horn
On Tue, Sep 18, 2018 at 2:05 AM Hugh Dickins wrote: > > Hi Jann, > > On Mon, 17 Sep 2018, Jann Horn wrote: > > > [I'm not sure who the best people to ask about this are, I hope the > > recipient list resembles something reasonable...] > > > > I have no

Re: [BUG] mm: direct I/O (using GUP) can write to COW anonymous pages

2018-09-17 Thread Jann Horn
On Tue, Sep 18, 2018 at 2:05 AM Hugh Dickins wrote: > > Hi Jann, > > On Mon, 17 Sep 2018, Jann Horn wrote: > > > [I'm not sure who the best people to ask about this are, I hope the > > recipient list resembles something reasonable...] > > > > I have no

[BUG] mm: direct I/O (using GUP) can write to COW anonymous pages

2018-09-17 Thread Jann Horn
[I'm not sure who the best people to ask about this are, I hope the recipient list resembles something reasonable...] I have noticed that the dup_mmap() logic on fork() doesn't handle pages with active direct I/O properly: dup_mmap() seems to assume that making the PTE referencing a page readonly

[BUG] mm: direct I/O (using GUP) can write to COW anonymous pages

2018-09-17 Thread Jann Horn
[I'm not sure who the best people to ask about this are, I hope the recipient list resembles something reasonable...] I have noticed that the dup_mmap() logic on fork() doesn't handle pages with active direct I/O properly: dup_mmap() seems to assume that making the PTE referencing a page readonly

Re: [PATCH 11/18] LSM: Lift LSM selection out of individual LSMs

2018-09-15 Thread Jann Horn
On Sun, Sep 16, 2018 at 3:14 AM Kees Cook wrote: > In order to adjust LSM selection logic in the future, this moves the > selection logic up out of the individual LSMs, making their init functions > only run when actually enabled. [...] > +/* Is an LSM allowed to be enabled? */ > +static bool

Re: [PATCH 11/18] LSM: Lift LSM selection out of individual LSMs

2018-09-15 Thread Jann Horn
On Sun, Sep 16, 2018 at 3:14 AM Kees Cook wrote: > In order to adjust LSM selection logic in the future, this moves the > selection logic up out of the individual LSMs, making their init functions > only run when actually enabled. [...] > +/* Is an LSM allowed to be enabled? */ > +static bool

Re: [PATCH 07/18] LSM: Add minor LSM initialization loop

2018-09-15 Thread Jann Horn
On Sun, Sep 16, 2018 at 3:11 AM Kees Cook wrote: > Split initialization loop into two phases: "exclusive" LSMs and "minor" > LSMs. > > Signed-off-by: Kees Cook > --- > include/linux/lsm_hooks.h | 6 ++ > security/security.c | 8 +--- > 2 files changed, 11 insertions(+), 3

Re: [PATCH 07/18] LSM: Add minor LSM initialization loop

2018-09-15 Thread Jann Horn
On Sun, Sep 16, 2018 at 3:11 AM Kees Cook wrote: > Split initialization loop into two phases: "exclusive" LSMs and "minor" > LSMs. > > Signed-off-by: Kees Cook > --- > include/linux/lsm_hooks.h | 6 ++ > security/security.c | 8 +--- > 2 files changed, 11 insertions(+), 3

Re: [RFC PATCH] Add /proc//numa_vamaps for numa node information

2018-09-14 Thread Jann Horn
On Fri, Sep 14, 2018 at 8:08 PM Prakash Sangappa wrote: > On 9/14/18 5:49 AM, Jann Horn wrote: > > On Fri, Sep 14, 2018 at 8:21 AM Michal Hocko wrote: > >> On Fri 14-09-18 03:33:28, Jann Horn wrote: > >>> On Wed, Sep 12, 2018 at 10:43 PM prakash.sangappa > >&

Re: [RFC PATCH] Add /proc//numa_vamaps for numa node information

2018-09-14 Thread Jann Horn
On Fri, Sep 14, 2018 at 8:08 PM Prakash Sangappa wrote: > On 9/14/18 5:49 AM, Jann Horn wrote: > > On Fri, Sep 14, 2018 at 8:21 AM Michal Hocko wrote: > >> On Fri 14-09-18 03:33:28, Jann Horn wrote: > >>> On Wed, Sep 12, 2018 at 10:43 PM prakash.sangappa > >&

Re: [RFC PATCH] Add /proc//numa_vamaps for numa node information

2018-09-14 Thread Jann Horn
On Fri, Sep 14, 2018 at 8:21 AM Michal Hocko wrote: > On Fri 14-09-18 03:33:28, Jann Horn wrote: > > On Wed, Sep 12, 2018 at 10:43 PM prakash.sangappa > > wrote: > > > On 05/09/2018 04:31 PM, Dave Hansen wrote: > > > > On 05/07/2018 06:16 PM, prakash.sanga

Re: [RFC PATCH] Add /proc//numa_vamaps for numa node information

2018-09-14 Thread Jann Horn
On Fri, Sep 14, 2018 at 8:21 AM Michal Hocko wrote: > On Fri 14-09-18 03:33:28, Jann Horn wrote: > > On Wed, Sep 12, 2018 at 10:43 PM prakash.sangappa > > wrote: > > > On 05/09/2018 04:31 PM, Dave Hansen wrote: > > > > On 05/07/2018 06:16 PM, prakash.sanga

Re: [PATCH] kernel: prevent submission of creds with higher privileges inside container

2018-09-14 Thread Jann Horn
On Fri, Sep 14, 2018 at 1:14 PM My Name <18650033...@163.com> wrote: > Adversaries often attack the Linux kernel via using > commit_creds(prepare_kernel_cred(0)) to submit ROOT > credential for the purpose of privilege escalation. > For processes inside the Linux container, the above > approach

Re: [PATCH] kernel: prevent submission of creds with higher privileges inside container

2018-09-14 Thread Jann Horn
On Fri, Sep 14, 2018 at 1:14 PM My Name <18650033...@163.com> wrote: > Adversaries often attack the Linux kernel via using > commit_creds(prepare_kernel_cred(0)) to submit ROOT > credential for the purpose of privilege escalation. > For processes inside the Linux container, the above > approach

Re: [RFC PATCH] Add /proc//numa_vamaps for numa node information

2018-09-13 Thread Jann Horn
On Wed, Sep 12, 2018 at 10:43 PM prakash.sangappa wrote: > On 05/09/2018 04:31 PM, Dave Hansen wrote: > > On 05/07/2018 06:16 PM, prakash.sangappa wrote: > >> It will be /proc//numa_vamaps. Yes, the behavior will be > >> different with respect to seeking. Output will still be text and > >> the

Re: [RFC PATCH] Add /proc//numa_vamaps for numa node information

2018-09-13 Thread Jann Horn
On Wed, Sep 12, 2018 at 10:43 PM prakash.sangappa wrote: > On 05/09/2018 04:31 PM, Dave Hansen wrote: > > On 05/07/2018 06:16 PM, prakash.sangappa wrote: > >> It will be /proc//numa_vamaps. Yes, the behavior will be > >> different with respect to seeking. Output will still be text and > >> the

Re: [PATCH 1/5] PM / hibernate: Create snapshot keys handler

2018-09-13 Thread Jann Horn
+cc keyrings list On Thu, Sep 13, 2018 at 4:08 PM Lee, Chun-Yi wrote: > This patch adds a snapshot keys handler for using the key retention > service api to create keys for snapshot image encryption and > authentication. > > This handler uses TPM trusted key as the snapshot master key, and the >

Re: [PATCH 1/5] PM / hibernate: Create snapshot keys handler

2018-09-13 Thread Jann Horn
+cc keyrings list On Thu, Sep 13, 2018 at 4:08 PM Lee, Chun-Yi wrote: > This patch adds a snapshot keys handler for using the key retention > service api to create keys for snapshot image encryption and > authentication. > > This handler uses TPM trusted key as the snapshot master key, and the >

Re: [RFC][PATCH 05/11] asm-generic/tlb: Provide generic tlb_flush

2018-09-13 Thread Jann Horn
On Thu, Sep 13, 2018 at 3:01 PM Peter Zijlstra wrote: > Provide a generic tlb_flush() implementation that relies on > flush_tlb_range(). This is a little awkward because flush_tlb_range() > assumes a VMA for range invalidation, but we no longer have one. > > Audit of all flush_tlb_range()

Re: [RFC][PATCH 05/11] asm-generic/tlb: Provide generic tlb_flush

2018-09-13 Thread Jann Horn
On Thu, Sep 13, 2018 at 3:01 PM Peter Zijlstra wrote: > Provide a generic tlb_flush() implementation that relies on > flush_tlb_range(). This is a little awkward because flush_tlb_range() > assumes a VMA for range invalidation, but we no longer have one. > > Audit of all flush_tlb_range()

Re: [PATCH] proc: restrict kernel stack dumps to root

2018-09-13 Thread Jann Horn
On Thu, Sep 13, 2018 at 12:28 AM Kees Cook wrote: > > On Wed, Sep 12, 2018 at 8:29 AM, Jann Horn wrote: > > +linux-api, I guess > > > > On Tue, Sep 11, 2018 at 8:39 PM Jann Horn wrote: > >> > >> Restrict the ability to inspect kernel stacks of arbitr

Re: [PATCH] proc: restrict kernel stack dumps to root

2018-09-13 Thread Jann Horn
On Thu, Sep 13, 2018 at 12:28 AM Kees Cook wrote: > > On Wed, Sep 12, 2018 at 8:29 AM, Jann Horn wrote: > > +linux-api, I guess > > > > On Tue, Sep 11, 2018 at 8:39 PM Jann Horn wrote: > >> > >> Restrict the ability to inspect kernel stacks of arbitr

Re: [PATCH] proc: restrict kernel stack dumps to root

2018-09-12 Thread Jann Horn
+linux-api, I guess On Tue, Sep 11, 2018 at 8:39 PM Jann Horn wrote: > > Restrict the ability to inspect kernel stacks of arbitrary tasks to root > in order to prevent a local attacker from exploiting racy stack unwinding > to leak kernel task stack contents. > See the added comme

Re: [PATCH] proc: restrict kernel stack dumps to root

2018-09-12 Thread Jann Horn
+linux-api, I guess On Tue, Sep 11, 2018 at 8:39 PM Jann Horn wrote: > > Restrict the ability to inspect kernel stacks of arbitrary tasks to root > in order to prevent a local attacker from exploiting racy stack unwinding > to leak kernel task stack contents. > See the added comme

[PATCH] proc: restrict kernel stack dumps to root

2018-09-11 Thread Jann Horn
stack") Cc: sta...@vger.kernel.org Signed-off-by: Jann Horn --- fs/proc/base.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/fs/proc/base.c b/fs/proc/base.c index ccf86f16d9f0..7e9f07bf260d 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -407,6 +407,20 @@

[PATCH] proc: restrict kernel stack dumps to root

2018-09-11 Thread Jann Horn
stack") Cc: sta...@vger.kernel.org Signed-off-by: Jann Horn --- fs/proc/base.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/fs/proc/base.c b/fs/proc/base.c index ccf86f16d9f0..7e9f07bf260d 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -407,6 +407,20 @@

Re: [PATCH v6 4/5] seccomp: add support for passing fds via USER_NOTIF

2018-09-10 Thread Jann Horn
On Thu, Sep 6, 2018 at 8:30 PM Tycho Andersen wrote: > On Thu, Sep 06, 2018 at 10:22:46AM -0600, Tycho Andersen wrote: > > On Thu, Sep 06, 2018 at 06:15:18PM +0200, Jann Horn wrote: > > > On Thu, Sep 6, 2018 at 5:29 PM Tycho Andersen wrote: > > > > The idea here

Re: [PATCH v6 4/5] seccomp: add support for passing fds via USER_NOTIF

2018-09-10 Thread Jann Horn
On Thu, Sep 6, 2018 at 8:30 PM Tycho Andersen wrote: > On Thu, Sep 06, 2018 at 10:22:46AM -0600, Tycho Andersen wrote: > > On Thu, Sep 06, 2018 at 06:15:18PM +0200, Jann Horn wrote: > > > On Thu, Sep 6, 2018 at 5:29 PM Tycho Andersen wrote: > > > > The idea here

Re: [RFC][PATCH 7/8] x86/mm/vsyscall: consider vsyscall page part of user address space

2018-09-07 Thread Jann Horn
On Sat, Sep 8, 2018 at 2:28 AM Dave Hansen wrote: > The vsyscall page is weird. It is in what is traditionally part of the > kernel address space. But, it has user permissions and we handle faults > on it like we would on a user page: interrupts on. > > Right now, we handle vsyscall emulation

Re: [RFC][PATCH 7/8] x86/mm/vsyscall: consider vsyscall page part of user address space

2018-09-07 Thread Jann Horn
On Sat, Sep 8, 2018 at 2:28 AM Dave Hansen wrote: > The vsyscall page is weird. It is in what is traditionally part of the > kernel address space. But, it has user permissions and we handle faults > on it like we would on a user page: interrupts on. > > Right now, we handle vsyscall emulation

Re: [RFC][PATCH 6/8] x86/mm: add vsyscall address helper

2018-09-07 Thread Jann Horn
On Sat, Sep 8, 2018 at 2:25 AM Dave Hansen wrote: > We will shortly be using this check in two locations. Put it in > a helper before we do so. [...] > +/* > + * The (legacy) vsyscall page is the long page in the kernel portion > + * of the address space that has user-accessible permissions. > +

Re: [RFC][PATCH 6/8] x86/mm: add vsyscall address helper

2018-09-07 Thread Jann Horn
On Sat, Sep 8, 2018 at 2:25 AM Dave Hansen wrote: > We will shortly be using this check in two locations. Put it in > a helper before we do so. [...] > +/* > + * The (legacy) vsyscall page is the long page in the kernel portion > + * of the address space that has user-accessible permissions. > +

Re: [RFC][PATCH 5/8] x86/mm: fix exception table comments

2018-09-07 Thread Jann Horn
On Sat, Sep 8, 2018 at 2:22 AM Dave Hansen wrote: > +* Kernel-mode access to the user address space should only occur > +* inside well-defined areas of code listed in the exception Actually, not areas, but single whitelisted instructions. It would probably be nice to say that

Re: [RFC][PATCH 5/8] x86/mm: fix exception table comments

2018-09-07 Thread Jann Horn
On Sat, Sep 8, 2018 at 2:22 AM Dave Hansen wrote: > +* Kernel-mode access to the user address space should only occur > +* inside well-defined areas of code listed in the exception Actually, not areas, but single whitelisted instructions. It would probably be nice to say that

Re: [PATCH v2 7/8] KVM: PMU: support to save/restore the guest lbr stack on vCPU switching

2018-09-07 Thread Jann Horn
On Fri, Sep 7, 2018 at 4:28 PM Wei Wang wrote: > This patch adds support to KVM to save/restore the lbr stack on vCPU > context switching. > > When the guest sets the ACTIVE bit of MSR_KVM_PV_LBR_CTRL, a perf event > is created on the host for the related vCPU. This perf event ensures the > LBR

Re: [PATCH v2 7/8] KVM: PMU: support to save/restore the guest lbr stack on vCPU switching

2018-09-07 Thread Jann Horn
On Fri, Sep 7, 2018 at 4:28 PM Wei Wang wrote: > This patch adds support to KVM to save/restore the lbr stack on vCPU > context switching. > > When the guest sets the ACTIVE bit of MSR_KVM_PV_LBR_CTRL, a perf event > is created on the host for the related vCPU. This perf event ensures the > LBR

Smack: wrong-looking capable() check in smk_ptrace_rule_check()

2018-09-06 Thread Jann Horn
Hi! I noticed the following check in smk_ptrace_rule_check(): if (tracer_known->smk_known == tracee_known->smk_known) rc = 0; else if (smack_ptrace_rule == SMACK_PTRACE_DRACONIAN) rc = -EACCES; else

Smack: wrong-looking capable() check in smk_ptrace_rule_check()

2018-09-06 Thread Jann Horn
Hi! I noticed the following check in smk_ptrace_rule_check(): if (tracer_known->smk_known == tracee_known->smk_known) rc = 0; else if (smack_ptrace_rule == SMACK_PTRACE_DRACONIAN) rc = -EACCES; else

Re: [PATCH v6 4/5] seccomp: add support for passing fds via USER_NOTIF

2018-09-06 Thread Jann Horn
On Thu, Sep 6, 2018 at 5:29 PM Tycho Andersen wrote: > The idea here is that the userspace handler should be able to pass an fd > back to the trapped task, for example so it can be returned from socket(). [...] > diff --git a/Documentation/userspace-api/seccomp_filter.rst >

Re: [PATCH v6 4/5] seccomp: add support for passing fds via USER_NOTIF

2018-09-06 Thread Jann Horn
On Thu, Sep 6, 2018 at 5:29 PM Tycho Andersen wrote: > The idea here is that the userspace handler should be able to pass an fd > back to the trapped task, for example so it can be returned from socket(). [...] > diff --git a/Documentation/userspace-api/seccomp_filter.rst >

Re: [PATCH v6 3/5] seccomp: add a way to get a listener fd from ptrace

2018-09-06 Thread Jann Horn
On Thu, Sep 6, 2018 at 5:29 PM Tycho Andersen wrote: > > As an alternative to SECCOMP_FILTER_FLAG_GET_LISTENER, perhaps a ptrace() > version which can acquire filters is useful. There are at least two reasons > this is preferable, even though it uses ptrace: > > 1. You can control tasks that

Re: [PATCH v6 3/5] seccomp: add a way to get a listener fd from ptrace

2018-09-06 Thread Jann Horn
On Thu, Sep 6, 2018 at 5:29 PM Tycho Andersen wrote: > > As an alternative to SECCOMP_FILTER_FLAG_GET_LISTENER, perhaps a ptrace() > version which can acquire filters is useful. There are at least two reasons > this is preferable, even though it uses ptrace: > > 1. You can control tasks that

[PATCH] Yama: use READ_ONCE() when reading ptrace_scope

2018-09-06 Thread Jann Horn
serves as documentation for the reader. Signed-off-by: Jann Horn --- security/yama/yama_lsm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/security/yama/yama_lsm.c b/security/yama/yama_lsm.c index ffda91a4a1aa..3b18e4455f53 100644 --- a/security/yama/yama_lsm.c +++ b

[PATCH] Yama: use READ_ONCE() when reading ptrace_scope

2018-09-06 Thread Jann Horn
serves as documentation for the reader. Signed-off-by: Jann Horn --- security/yama/yama_lsm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/security/yama/yama_lsm.c b/security/yama/yama_lsm.c index ffda91a4a1aa..3b18e4455f53 100644 --- a/security/yama/yama_lsm.c +++ b

[tip:x86/urgent] x86/process: Don't mix user/kernel regs in 64bit __show_regs()

2018-09-06 Thread tip-bot for Jann Horn
Commit-ID: 9fe6299dde587788f245e9f7a5a1b296fad4e8c7 Gitweb: https://git.kernel.org/tip/9fe6299dde587788f245e9f7a5a1b296fad4e8c7 Author: Jann Horn AuthorDate: Fri, 31 Aug 2018 21:41:51 +0200 Committer: Thomas Gleixner CommitDate: Thu, 6 Sep 2018 14:33:12 +0200 x86/process: Don't mix

[tip:x86/urgent] x86/process: Don't mix user/kernel regs in 64bit __show_regs()

2018-09-06 Thread tip-bot for Jann Horn
Commit-ID: 9fe6299dde587788f245e9f7a5a1b296fad4e8c7 Gitweb: https://git.kernel.org/tip/9fe6299dde587788f245e9f7a5a1b296fad4e8c7 Author: Jann Horn AuthorDate: Fri, 31 Aug 2018 21:41:51 +0200 Committer: Thomas Gleixner CommitDate: Thu, 6 Sep 2018 14:33:12 +0200 x86/process: Don't mix

Re: [PATCH] x86/process: don't mix user/kernel regs in 64bit __show_regs

2018-09-06 Thread Jann Horn
On Fri, Aug 31, 2018 at 10:12 PM Andy Lutomirski wrote: > > On Fri, Aug 31, 2018 at 12:41 PM, Jann Horn wrote: > > When the kernel.print-fatal-signals sysctl has been enabled (I don't know > > whether anyone actually enables it), a simple userspace crash will cause >

Re: [PATCH] x86/process: don't mix user/kernel regs in 64bit __show_regs

2018-09-06 Thread Jann Horn
On Fri, Aug 31, 2018 at 10:12 PM Andy Lutomirski wrote: > > On Fri, Aug 31, 2018 at 12:41 PM, Jann Horn wrote: > > When the kernel.print-fatal-signals sysctl has been enabled (I don't know > > whether anyone actually enables it), a simple userspace crash will cause >

[PATCH] RDMA/ucma: check fd type in ucma_migrate_id()

2018-09-03 Thread Jann Horn
, some filesystems just cram numbers in there. Check the type of the supplied file descriptor to be safe, analogous to how other places in the kernel do it. Fixes: 88314e4dda1e ("RDMA/cma: add support for rdma_migrate_id()") Signed-off-by: Jann Horn --- Only compile-tested, because I don't hav

[PATCH] RDMA/ucma: check fd type in ucma_migrate_id()

2018-09-03 Thread Jann Horn
, some filesystems just cram numbers in there. Check the type of the supplied file descriptor to be safe, analogous to how other places in the kernel do it. Fixes: 88314e4dda1e ("RDMA/cma: add support for rdma_migrate_id()") Signed-off-by: Jann Horn --- Only compile-tested, because I don't hav

Re: [PATCH] reiserfs: propagate errors from fill_with_dentries properly

2018-09-03 Thread Jann Horn
On Thu, Aug 2, 2018 at 6:33 PM Jann Horn wrote: > > fill_with_dentries() failed to propagate errors up to > reiserfs_for_each_xattr() properly. Plumb them through. > > Note that reiserfs_for_each_xattr() is only used by > reiserfs_delete_xattrs() and reiserfs_chown_xatt

Re: [PATCH] reiserfs: propagate errors from fill_with_dentries properly

2018-09-03 Thread Jann Horn
On Thu, Aug 2, 2018 at 6:33 PM Jann Horn wrote: > > fill_with_dentries() failed to propagate errors up to > reiserfs_for_each_xattr() properly. Plumb them through. > > Note that reiserfs_for_each_xattr() is only used by > reiserfs_delete_xattrs() and reiserfs_chown_xatt

Re: [PATCH] firewire: nosy: don't read packets bigger than requested

2018-09-03 Thread Jann Horn
On Fri, Jul 6, 2018 at 5:16 PM Jann Horn wrote: > In general, accessing userspace memory beyond the length of the supplied > buffer in VFS read/write handlers can lead to both kernel memory corruption > (via kernel_read()/kernel_write(), which can e.g. be triggered via >

Re: [PATCH] firewire: nosy: don't read packets bigger than requested

2018-09-03 Thread Jann Horn
On Fri, Jul 6, 2018 at 5:16 PM Jann Horn wrote: > In general, accessing userspace memory beyond the length of the supplied > buffer in VFS read/write handlers can lead to both kernel memory corruption > (via kernel_read()/kernel_write(), which can e.g. be triggered via >

Re: [PATCH v13 10/13] x86/sgx: Add sgx_einit() for initializing enclaves

2018-09-03 Thread Jann Horn
On Mon, Sep 3, 2018 at 3:33 PM Jarkko Sakkinen wrote: > > From: Sean Christopherson > > Add a function to perform ENCLS(EINIT), which initializes an enclave, > which can be used by a driver for running enclaves and VMMs. > > Writing the LE hash MSRs is extraordinarily expensive, e.g. 3-4x slower

Re: [PATCH v13 10/13] x86/sgx: Add sgx_einit() for initializing enclaves

2018-09-03 Thread Jann Horn
On Mon, Sep 3, 2018 at 3:33 PM Jarkko Sakkinen wrote: > > From: Sean Christopherson > > Add a function to perform ENCLS(EINIT), which initializes an enclave, > which can be used by a driver for running enclaves and VMMs. > > Writing the LE hash MSRs is extraordinarily expensive, e.g. 3-4x slower

[tip:x86/core] lkdtm: Test copy_to_user() on bad kernel pointer under KERNEL_DS

2018-09-03 Thread tip-bot for Jann Horn
Commit-ID: bef459026b161fbc39d20dcba698ed0cfffbac38 Gitweb: https://git.kernel.org/tip/bef459026b161fbc39d20dcba698ed0cfffbac38 Author: Jann Horn AuthorDate: Tue, 28 Aug 2018 22:14:21 +0200 Committer: Thomas Gleixner CommitDate: Mon, 3 Sep 2018 15:12:10 +0200 lkdtm: Test copy_to_user

[tip:x86/core] lkdtm: Test copy_to_user() on bad kernel pointer under KERNEL_DS

2018-09-03 Thread tip-bot for Jann Horn
Commit-ID: bef459026b161fbc39d20dcba698ed0cfffbac38 Gitweb: https://git.kernel.org/tip/bef459026b161fbc39d20dcba698ed0cfffbac38 Author: Jann Horn AuthorDate: Tue, 28 Aug 2018 22:14:21 +0200 Committer: Thomas Gleixner CommitDate: Mon, 3 Sep 2018 15:12:10 +0200 lkdtm: Test copy_to_user

[tip:x86/core] x86/fault: BUG() when uaccess helpers fault on kernel addresses

2018-09-03 Thread tip-bot for Jann Horn
Commit-ID: 9da3f2b74054406f87dff7101a569217ffceb29b Gitweb: https://git.kernel.org/tip/9da3f2b74054406f87dff7101a569217ffceb29b Author: Jann Horn AuthorDate: Tue, 28 Aug 2018 22:14:20 +0200 Committer: Thomas Gleixner CommitDate: Mon, 3 Sep 2018 15:12:09 +0200 x86/fault: BUG() when

[tip:x86/core] x86/fault: Plumb error code and fault address through to fault handlers

2018-09-03 Thread tip-bot for Jann Horn
Commit-ID: 81fd9c18444ed1199b5a6f6776a395292d4256fb Gitweb: https://git.kernel.org/tip/81fd9c18444ed1199b5a6f6776a395292d4256fb Author: Jann Horn AuthorDate: Tue, 28 Aug 2018 22:14:19 +0200 Committer: Thomas Gleixner CommitDate: Mon, 3 Sep 2018 15:12:09 +0200 x86/fault: Plumb error

[tip:x86/core] x86/fault: BUG() when uaccess helpers fault on kernel addresses

2018-09-03 Thread tip-bot for Jann Horn
Commit-ID: 9da3f2b74054406f87dff7101a569217ffceb29b Gitweb: https://git.kernel.org/tip/9da3f2b74054406f87dff7101a569217ffceb29b Author: Jann Horn AuthorDate: Tue, 28 Aug 2018 22:14:20 +0200 Committer: Thomas Gleixner CommitDate: Mon, 3 Sep 2018 15:12:09 +0200 x86/fault: BUG() when

[tip:x86/core] x86/fault: Plumb error code and fault address through to fault handlers

2018-09-03 Thread tip-bot for Jann Horn
Commit-ID: 81fd9c18444ed1199b5a6f6776a395292d4256fb Gitweb: https://git.kernel.org/tip/81fd9c18444ed1199b5a6f6776a395292d4256fb Author: Jann Horn AuthorDate: Tue, 28 Aug 2018 22:14:19 +0200 Committer: Thomas Gleixner CommitDate: Mon, 3 Sep 2018 15:12:09 +0200 x86/fault: Plumb error

[tip:x86/core] x86/extable: Introduce _ASM_EXTABLE_UA for uaccess fixups

2018-09-03 Thread tip-bot for Jann Horn
Commit-ID: 75045f77f7a73e617494d7a1fcf4e9c1849cec39 Gitweb: https://git.kernel.org/tip/75045f77f7a73e617494d7a1fcf4e9c1849cec39 Author: Jann Horn AuthorDate: Tue, 28 Aug 2018 22:14:18 +0200 Committer: Thomas Gleixner CommitDate: Mon, 3 Sep 2018 15:12:09 +0200 x86/extable: Introduce

[tip:x86/core] x86/extable: Introduce _ASM_EXTABLE_UA for uaccess fixups

2018-09-03 Thread tip-bot for Jann Horn
Commit-ID: 75045f77f7a73e617494d7a1fcf4e9c1849cec39 Gitweb: https://git.kernel.org/tip/75045f77f7a73e617494d7a1fcf4e9c1849cec39 Author: Jann Horn AuthorDate: Tue, 28 Aug 2018 22:14:18 +0200 Committer: Thomas Gleixner CommitDate: Mon, 3 Sep 2018 15:12:09 +0200 x86/extable: Introduce

[tip:x86/core] x86/kprobes: Inline kprobe_exceptions_notify() into do_general_protection()

2018-09-03 Thread tip-bot for Jann Horn
Commit-ID: 76dee4a72849561f6ffacc357cfd0aa6081a Gitweb: https://git.kernel.org/tip/76dee4a72849561f6ffacc357cfd0aa6081a Author: Jann Horn AuthorDate: Tue, 28 Aug 2018 22:14:16 +0200 Committer: Thomas Gleixner CommitDate: Mon, 3 Sep 2018 15:12:08 +0200 x86/kprobes: Inline

[tip:x86/core] x86/kprobes: Stop calling fixup_exception() from kprobe_fault_handler()

2018-09-03 Thread tip-bot for Jann Horn
Commit-ID: e3e4d5019c2dd0f91600f6df377b215a73d506fe Gitweb: https://git.kernel.org/tip/e3e4d5019c2dd0f91600f6df377b215a73d506fe Author: Jann Horn AuthorDate: Tue, 28 Aug 2018 22:14:17 +0200 Committer: Thomas Gleixner CommitDate: Mon, 3 Sep 2018 15:12:08 +0200 x86/kprobes: Stop calling

[tip:x86/core] x86/kprobes: Inline kprobe_exceptions_notify() into do_general_protection()

2018-09-03 Thread tip-bot for Jann Horn
Commit-ID: 76dee4a72849561f6ffacc357cfd0aa6081a Gitweb: https://git.kernel.org/tip/76dee4a72849561f6ffacc357cfd0aa6081a Author: Jann Horn AuthorDate: Tue, 28 Aug 2018 22:14:16 +0200 Committer: Thomas Gleixner CommitDate: Mon, 3 Sep 2018 15:12:08 +0200 x86/kprobes: Inline

[tip:x86/core] x86/kprobes: Stop calling fixup_exception() from kprobe_fault_handler()

2018-09-03 Thread tip-bot for Jann Horn
Commit-ID: e3e4d5019c2dd0f91600f6df377b215a73d506fe Gitweb: https://git.kernel.org/tip/e3e4d5019c2dd0f91600f6df377b215a73d506fe Author: Jann Horn AuthorDate: Tue, 28 Aug 2018 22:14:17 +0200 Committer: Thomas Gleixner CommitDate: Mon, 3 Sep 2018 15:12:08 +0200 x86/kprobes: Stop calling

[tip:x86/core] x86/kprobes: Refactor kprobes_fault() like kprobe_exceptions_notify()

2018-09-03 Thread tip-bot for Jann Horn
Commit-ID: a980c0ef9f6d8c45445d6ed0f5836bb6941c8c91 Gitweb: https://git.kernel.org/tip/a980c0ef9f6d8c45445d6ed0f5836bb6941c8c91 Author: Jann Horn AuthorDate: Tue, 28 Aug 2018 22:14:15 +0200 Committer: Thomas Gleixner CommitDate: Mon, 3 Sep 2018 15:12:08 +0200 x86/kprobes: Refactor

[tip:x86/core] x86/kprobes: Refactor kprobes_fault() like kprobe_exceptions_notify()

2018-09-03 Thread tip-bot for Jann Horn
Commit-ID: a980c0ef9f6d8c45445d6ed0f5836bb6941c8c91 Gitweb: https://git.kernel.org/tip/a980c0ef9f6d8c45445d6ed0f5836bb6941c8c91 Author: Jann Horn AuthorDate: Tue, 28 Aug 2018 22:14:15 +0200 Committer: Thomas Gleixner CommitDate: Mon, 3 Sep 2018 15:12:08 +0200 x86/kprobes: Refactor

[PATCH] x86/process: don't mix user/kernel regs in 64bit __show_regs

2018-08-31 Thread Jann Horn
, FS_BASE and KERNEL_GS_BASE in this case. This also moves the bitness-specific logic from show_regs() into process_{32,64}.c. Signed-off-by: Jann Horn Fixes: 45807a1df9f5 ("vdso: print fatal signals") --- @Andy: Does this look like what you had in mind? Does this need a CC stable tag? I h

[PATCH] x86/process: don't mix user/kernel regs in 64bit __show_regs

2018-08-31 Thread Jann Horn
, FS_BASE and KERNEL_GS_BASE in this case. This also moves the bitness-specific logic from show_regs() into process_{32,64}.c. Signed-off-by: Jann Horn Fixes: 45807a1df9f5 ("vdso: print fatal signals") --- @Andy: Does this look like what you had in mind? Does this need a CC stable tag? I h

[tip:x86/urgent] x86/dumpstack: Don't dump kernel memory based on usermode RIP

2018-08-31 Thread tip-bot for Jann Horn
Commit-ID: 342db04ae71273322f0011384a9ed414df8bdae4 Gitweb: https://git.kernel.org/tip/342db04ae71273322f0011384a9ed414df8bdae4 Author: Jann Horn AuthorDate: Tue, 28 Aug 2018 17:49:01 +0200 Committer: Thomas Gleixner CommitDate: Fri, 31 Aug 2018 17:08:22 +0200 x86/dumpstack: Don't

[tip:x86/urgent] x86/dumpstack: Don't dump kernel memory based on usermode RIP

2018-08-31 Thread tip-bot for Jann Horn
Commit-ID: 342db04ae71273322f0011384a9ed414df8bdae4 Gitweb: https://git.kernel.org/tip/342db04ae71273322f0011384a9ed414df8bdae4 Author: Jann Horn AuthorDate: Tue, 28 Aug 2018 17:49:01 +0200 Committer: Thomas Gleixner CommitDate: Fri, 31 Aug 2018 17:08:22 +0200 x86/dumpstack: Don't

[PATCH v2] x86/dumpstack: fix address space casting in show_opcodes()

2018-08-31 Thread Jann Horn
__chk_range_not_ok directly. Fixes: a644cf538b11 ("x86/dumpstack: Don't dump kernel memory based on usermode RIP") Signed-off-by: Jann Horn --- arch/x86/kernel/dumpstack.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/dumpstack.c b/arch/

[PATCH v2] x86/dumpstack: fix address space casting in show_opcodes()

2018-08-31 Thread Jann Horn
__chk_range_not_ok directly. Fixes: a644cf538b11 ("x86/dumpstack: Don't dump kernel memory based on usermode RIP") Signed-off-by: Jann Horn --- arch/x86/kernel/dumpstack.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/dumpstack.c b/arch/

Re: [PATCH] x86/dumpstack: fix address space casting in show_opcodes()

2018-08-31 Thread Jann Horn
On Fri, Aug 31, 2018 at 10:27 AM Luc Van Oostenryck wrote: > > On Thu, Aug 30, 2018 at 09:47:36PM +0200, Jann Horn wrote: > > I sloppily passed a kernel-typed pointer to __range_not_ok(), and sparse > > doesn't like that. > > Make `prologue` a __user pointer (to pr

Re: [PATCH] x86/dumpstack: fix address space casting in show_opcodes()

2018-08-31 Thread Jann Horn
On Fri, Aug 31, 2018 at 10:27 AM Luc Van Oostenryck wrote: > > On Thu, Aug 30, 2018 at 09:47:36PM +0200, Jann Horn wrote: > > I sloppily passed a kernel-typed pointer to __range_not_ok(), and sparse > > doesn't like that. > > Make `prologue` a __user pointer (to pr

Re: [PATCH] x86/pkeys: Explicitly treat PK #PF on kernel address as a bad area

2018-08-30 Thread Jann Horn
On Tue, 7 Aug 2018 Dave Hansen wrote: > > On 08/07/2018 10:29 AM, Sean Christopherson wrote: > > if (unlikely(fault_in_kernel_space(address))) { > > + /* > > + * We should never encounter a protection keys fault on a > > + * kernel address as kernel

Re: [PATCH] x86/pkeys: Explicitly treat PK #PF on kernel address as a bad area

2018-08-30 Thread Jann Horn
On Tue, 7 Aug 2018 Dave Hansen wrote: > > On 08/07/2018 10:29 AM, Sean Christopherson wrote: > > if (unlikely(fault_in_kernel_space(address))) { > > + /* > > + * We should never encounter a protection keys fault on a > > + * kernel address as kernel

Re: [RFC PATCH v3 12/24] x86/mm: Modify ptep_set_wrprotect and pmdp_set_wrprotect for _PAGE_DIRTY_SW

2018-08-30 Thread Jann Horn
On Thu, Aug 30, 2018 at 11:01 PM Jann Horn wrote: > > On Thu, Aug 30, 2018 at 10:57 PM Yu-cheng Yu wrote: > > > > On Thu, 2018-08-30 at 22:44 +0200, Jann Horn wrote: > > > On Thu, Aug 30, 2018 at 10:25 PM Yu-cheng Yu > > > wrote: > > ... >

Re: [RFC PATCH v3 12/24] x86/mm: Modify ptep_set_wrprotect and pmdp_set_wrprotect for _PAGE_DIRTY_SW

2018-08-30 Thread Jann Horn
On Thu, Aug 30, 2018 at 11:01 PM Jann Horn wrote: > > On Thu, Aug 30, 2018 at 10:57 PM Yu-cheng Yu wrote: > > > > On Thu, 2018-08-30 at 22:44 +0200, Jann Horn wrote: > > > On Thu, Aug 30, 2018 at 10:25 PM Yu-cheng Yu > > > wrote: > > ... >

[PATCH] x86/dumpstack: fix address space casting in show_opcodes()

2018-08-30 Thread Jann Horn
pointer. Fixes: a644cf538b11 ("x86/dumpstack: Don't dump kernel memory based on usermode RIP") Signed-off-by: Jann Horn --- arch/x86/kernel/dumpstack.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpsta

[PATCH] x86/dumpstack: fix address space casting in show_opcodes()

2018-08-30 Thread Jann Horn
pointer. Fixes: a644cf538b11 ("x86/dumpstack: Don't dump kernel memory based on usermode RIP") Signed-off-by: Jann Horn --- arch/x86/kernel/dumpstack.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpsta

[tip:x86/urgent] x86/dumpstack: Don't dump kernel memory based on usermode RIP

2018-08-30 Thread tip-bot for Jann Horn
Commit-ID: a644cf538b1125410421584c68b2013fdbecbd79 Gitweb: https://git.kernel.org/tip/a644cf538b1125410421584c68b2013fdbecbd79 Author: Jann Horn AuthorDate: Tue, 28 Aug 2018 17:49:01 +0200 Committer: Thomas Gleixner CommitDate: Thu, 30 Aug 2018 13:10:09 +0200 x86/dumpstack: Don't

[tip:x86/urgent] x86/dumpstack: Don't dump kernel memory based on usermode RIP

2018-08-30 Thread tip-bot for Jann Horn
Commit-ID: a644cf538b1125410421584c68b2013fdbecbd79 Gitweb: https://git.kernel.org/tip/a644cf538b1125410421584c68b2013fdbecbd79 Author: Jann Horn AuthorDate: Tue, 28 Aug 2018 17:49:01 +0200 Committer: Thomas Gleixner CommitDate: Thu, 30 Aug 2018 13:10:09 +0200 x86/dumpstack: Don't

[tip:x86/urgent] x86/entry/64: Wipe KASAN stack shadow before rewind_stack_do_exit()

2018-08-30 Thread tip-bot for Jann Horn
Commit-ID: f12d11c5c184626b4befdee3d573ec8237405a33 Gitweb: https://git.kernel.org/tip/f12d11c5c184626b4befdee3d573ec8237405a33 Author: Jann Horn AuthorDate: Tue, 28 Aug 2018 20:40:33 +0200 Committer: Thomas Gleixner CommitDate: Thu, 30 Aug 2018 11:37:09 +0200 x86/entry/64: Wipe KASAN

[tip:x86/urgent] x86/entry/64: Wipe KASAN stack shadow before rewind_stack_do_exit()

2018-08-30 Thread tip-bot for Jann Horn
Commit-ID: f12d11c5c184626b4befdee3d573ec8237405a33 Gitweb: https://git.kernel.org/tip/f12d11c5c184626b4befdee3d573ec8237405a33 Author: Jann Horn AuthorDate: Tue, 28 Aug 2018 20:40:33 +0200 Committer: Thomas Gleixner CommitDate: Thu, 30 Aug 2018 11:37:09 +0200 x86/entry/64: Wipe KASAN

Re: [PATCH v2] x86/dumpstack: don't dump kernel memory based on usermode RIP

2018-08-29 Thread Jann Horn
On Wed, Aug 29, 2018 at 9:10 AM Borislav Petkov wrote: > > On Tue, Aug 28, 2018 at 05:49:01PM +0200, Jann Horn wrote: > > show_opcodes() is used both for dumping kernel instructions and for dumping > > user instructions. If userspace causes #PF by jumping to a kernel address

Re: [PATCH v2] x86/dumpstack: don't dump kernel memory based on usermode RIP

2018-08-29 Thread Jann Horn
On Wed, Aug 29, 2018 at 9:10 AM Borislav Petkov wrote: > > On Tue, Aug 28, 2018 at 05:49:01PM +0200, Jann Horn wrote: > > show_opcodes() is used both for dumping kernel instructions and for dumping > > user instructions. If userspace causes #PF by jumping to a kernel address

[PATCH v3 7/7] lkdtm: test copy_to_user() on bad kernel pointer under KERNEL_DS

2018-08-28 Thread Jann Horn
Test whether the kernel WARN()s when, under KERNEL_DS, a bad kernel pointer is used as "userspace" pointer. Should normally be used in "DIRECT" mode. Acked-by: Kees Cook Signed-off-by: Jann Horn --- drivers/misc/lkdtm/core.c | 1 + drivers/misc/lkdtm/lkdtm.h| 1 +

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