From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752897AbbFITOr (ORCPT ); Tue, 9 Jun 2015 15:14:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54767 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751582AbbFITOj (ORCPT ); Tue, 9 Jun 2015 15:14:39 -0400 Message-ID: <55773B1B.7040901@redhat.com> Date: Tue, 09 Jun 2015 21:14:35 +0200 From: Denys Vlasenko User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Andy Lutomirski CC: Ingo Molnar , Linus Torvalds , Steven Rostedt , Borislav Petkov , "H. Peter Anvin" , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , X86 ML , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 5/5] x86/asm/entry/32: Simplify ptrace register shuffling References: <1433876051-26604-1-git-send-email-dvlasenk@redhat.com> <1433876051-26604-5-git-send-email-dvlasenk@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/09/2015 08:59 PM, Andy Lutomirski wrote: > On Tue, Jun 9, 2015 at 11:54 AM, Denys Vlasenko wrote: >> Before this patch, we were clearing pt_regs->r8..r11 on stack. >> We can as well just store actual r8..r11 registers there: >> they came from userspace, we leak no information by showing them to ptrace. >> This allows to get rid of one insn ("xor %eax,%eax"). >> Not a big deal, but still... >> >> After call to syscall_trace_enter(), before this patch we were restoring >> clobbered registers and jump to code which converts 32-bit syscall >> ABI to 64-bit C ABI. This is unnecessary work, we can combine both >> steps into one (similar to what audit code does already). > > I think like zeroing it better. There's nothing wrong with zeroing > it, Yes, there is nothing wrong with zeroing. It just requires a bit more code. > and it makes testing (if we ever started testing this stuff) > easier, I think. Currently, we don't zero *all* high regs, only r8..10. (r11 is nonzero due to SYSRET ABI; r12..15 are preserved by virtue of being callee-saved regs).