From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 References: <1549628149-11881-1-git-send-email-elena.reshetova@intel.com> <1549628149-11881-2-git-send-email-elena.reshetova@intel.com> <20190208130544.GI32511@hirez.programming.kicks-ass.net> <2236FBA76BA1254E88B949DDB74E612BA4BB7580@IRSMSX102.ger.corp.intel.com> <20190208142642.GJ32511@hirez.programming.kicks-ass.net> <2236FBA76BA1254E88B949DDB74E612BA4BB96C5@IRSMSX102.ger.corp.intel.com> <2236FBA76BA1254E88B949DDB74E612BA4BBA73C@IRSMSX102.ger.corp.intel.com> <5E269FBC3009974381A340959F3135C95C8F78E5@hasmsx108.ger.corp.intel.com> <5E269FBC3009974381A340959F3135C95C8FE7E1@hasmsx108.ger.corp.intel.com> In-Reply-To: <5E269FBC3009974381A340959F3135C95C8FE7E1@hasmsx108.ger.corp.intel.com> From: Kees Cook Date: Thu, 21 Feb 2019 09:23:43 -0800 Message-ID: Subject: Re: [RFC PATCH] x86/entry/64: randomize kernel stack offset upon system call Content-Type: text/plain; charset="UTF-8" To: "Perla, Enrico" Cc: Andy Lutomirski , "Reshetova, Elena" , Andy Lutomirski , Jann Horn , Peter Zijlstra , "kernel-hardening@lists.openwall.com" , "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , "tytso@mit.edu" List-ID: On Thu, Feb 21, 2019 at 1:35 AM Perla, Enrico wrote: > > It does seem that using a flaw to attack one's own registers is rather > > pointless. Maybe we'll eat our words, but for now, I'd agree. > > > > You don't attack your own registers, you use them to load controlled data to the kernel and emulate structures or similar at any stage of an exploit, bypassing SMAP and co. Given all the rewriting of the syscall entry code over the last few years, perhaps I'm missing something. My understanding was that at syscall entry we do effectively this: - save pt_regs - clear all registers not needed for a syscall - run syscall - restore pt_regs (excepting syscall return value) I didn't think pt_regs got used during the syscall? In looking more closely, I see some current_pt_regs() in some paths, but again: what's the attack you're thinking of that isn't directly overlapped with existing control over registers at entry or via ptrace? -- Kees Cook