From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751521AbdIWL3i (ORCPT ); Sat, 23 Sep 2017 07:29:38 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:35605 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750766AbdIWL3g (ORCPT ); Sat, 23 Sep 2017 07:29:36 -0400 X-Google-Smtp-Source: AOwi7QCdnr4AasUlQdZlIf5xiq7wz+8RHFgl1AY/+rGuBo3P8smEEHK2ZlhMW9oUwFJZmj3fhaOUZg== Date: Sat, 23 Sep 2017 13:29:32 +0200 From: Ingo Molnar To: Eric Biggers Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, Andy Lutomirski , Dave Hansen , Dmitry Vyukov , Fenghua Yu , Kevin Hao , Oleg Nesterov , Wanpeng Li , Yu-cheng Yu , Michael Halcrow , Eric Biggers Subject: Re: [PATCH] x86/fpu: Simplify fpu__activate_fpstate_read() Message-ID: <20170923112932.yd7tmoh5kyyazv2t@gmail.com> References: <20170921185239.88398-1-ebiggers3@gmail.com> <20170922053314.wryoupq2vgrel24c@gmail.com> <20170922170724.GA103935@gmail.com> <20170923101733.kyq2avp6om2d2s3n@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170923101733.kyq2avp6om2d2s3n@gmail.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Ingo Molnar wrote: > > * Eric Biggers wrote: > > > On Fri, Sep 22, 2017 at 07:33:14AM +0200, Ingo Molnar wrote: > > > > > > * Eric Biggers wrote: > > > > > > > From: Eric Biggers > > > > > > > > This series fixes the bug found by syzkaller where the ptrace syscall > > > > can be used to set invalid bits in a task's FPU state. I also found > > > > that an equivalent bug was reachable using the sigreturn syscall, so the > > > > first patch fixes the bug in both cases. > > > > > > > > The other two patches start validating the other parts of the > > > > xstate_header and make it so that invalid FPU states can no longer be > > > > abused to leak the FPU registers of other processes. > > > > > > > > Changes since v2: > > > > - Use an exception handler to handle invalid FPU states > > > > (suggested by Andy Lutomirski) > > > > - Check the size of xstate_header.reserved at build time > > > > (suggested by Dave Hansen) > > > > > > > > Eric Biggers (3): > > > > x86/fpu: don't let userspace set bogus xcomp_bv > > > > x86/fpu: tighten validation of user-supplied xstate_header > > > > x86/fpu: reinitialize FPU registers if restoring FPU state fails > > > > > > > > arch/x86/include/asm/fpu/internal.h | 51 +++++++++++-------------------------- > > > > arch/x86/include/asm/fpu/xstate.h | 25 ++++++++++++++++++ > > > > arch/x86/kernel/fpu/regset.c | 20 +++++++-------- > > > > arch/x86/kernel/fpu/signal.c | 15 ++++++++--- > > > > arch/x86/kernel/fpu/xstate.c | 27 ++++++++------------ > > > > arch/x86/mm/extable.c | 24 +++++++++++++++++ > > > > 6 files changed, 94 insertions(+), 68 deletions(-) > > > > > > Ok - could you please rebase these to to tip:master that is at: > > > > > > git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git master > > > > > > In particular this has a WIP.x86/fpu branch with FPU fixes+changes queued up but > > > not merged upstream (yet), which conflict with these changes. I'd like to merge > > > them all together. > > > > > > > Working on it, but there is a problem with current tip. PTRACE_GETREGSET is > > causing the following warning: > > Yes, the warning should be harmless, and I fixed it locally earlier today - does > the patch below solve it for you as well? Note that this fix is now part of tip:master as well, so if you re-test -tip you should get all the latest fixes as well (including yours!). Thanks, Ingo From mboxrd@z Thu Jan 1 00:00:00 1970 Sender: Ingo Molnar Date: Sat, 23 Sep 2017 13:29:32 +0200 From: Ingo Molnar Message-ID: <20170923112932.yd7tmoh5kyyazv2t@gmail.com> References: <20170921185239.88398-1-ebiggers3@gmail.com> <20170922053314.wryoupq2vgrel24c@gmail.com> <20170922170724.GA103935@gmail.com> <20170923101733.kyq2avp6om2d2s3n@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170923101733.kyq2avp6om2d2s3n@gmail.com> Subject: [kernel-hardening] Re: [PATCH] x86/fpu: Simplify fpu__activate_fpstate_read() To: Eric Biggers Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, Andy Lutomirski , Dave Hansen , Dmitry Vyukov , Fenghua Yu , Kevin Hao , Oleg Nesterov , Wanpeng Li , Yu-cheng Yu , Michael Halcrow , Eric Biggers List-ID: * Ingo Molnar wrote: > > * Eric Biggers wrote: > > > On Fri, Sep 22, 2017 at 07:33:14AM +0200, Ingo Molnar wrote: > > > > > > * Eric Biggers wrote: > > > > > > > From: Eric Biggers > > > > > > > > This series fixes the bug found by syzkaller where the ptrace syscall > > > > can be used to set invalid bits in a task's FPU state. I also found > > > > that an equivalent bug was reachable using the sigreturn syscall, so the > > > > first patch fixes the bug in both cases. > > > > > > > > The other two patches start validating the other parts of the > > > > xstate_header and make it so that invalid FPU states can no longer be > > > > abused to leak the FPU registers of other processes. > > > > > > > > Changes since v2: > > > > - Use an exception handler to handle invalid FPU states > > > > (suggested by Andy Lutomirski) > > > > - Check the size of xstate_header.reserved at build time > > > > (suggested by Dave Hansen) > > > > > > > > Eric Biggers (3): > > > > x86/fpu: don't let userspace set bogus xcomp_bv > > > > x86/fpu: tighten validation of user-supplied xstate_header > > > > x86/fpu: reinitialize FPU registers if restoring FPU state fails > > > > > > > > arch/x86/include/asm/fpu/internal.h | 51 +++++++++++-------------------------- > > > > arch/x86/include/asm/fpu/xstate.h | 25 ++++++++++++++++++ > > > > arch/x86/kernel/fpu/regset.c | 20 +++++++-------- > > > > arch/x86/kernel/fpu/signal.c | 15 ++++++++--- > > > > arch/x86/kernel/fpu/xstate.c | 27 ++++++++------------ > > > > arch/x86/mm/extable.c | 24 +++++++++++++++++ > > > > 6 files changed, 94 insertions(+), 68 deletions(-) > > > > > > Ok - could you please rebase these to to tip:master that is at: > > > > > > git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git master > > > > > > In particular this has a WIP.x86/fpu branch with FPU fixes+changes queued up but > > > not merged upstream (yet), which conflict with these changes. I'd like to merge > > > them all together. > > > > > > > Working on it, but there is a problem with current tip. PTRACE_GETREGSET is > > causing the following warning: > > Yes, the warning should be harmless, and I fixed it locally earlier today - does > the patch below solve it for you as well? Note that this fix is now part of tip:master as well, so if you re-test -tip you should get all the latest fixes as well (including yours!). Thanks, Ingo