From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753439AbbIPJve (ORCPT ); Wed, 16 Sep 2015 05:51:34 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:38634 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752465AbbIPJvc (ORCPT ); Wed, 16 Sep 2015 05:51:32 -0400 Date: Wed, 16 Sep 2015 11:51:28 +0200 From: Ingo Molnar To: Andy Lutomirski Cc: Frederic Weisbecker , Denys Vlasenko , Kees Cook , Borislav Petkov , X86 ML , Oleg Nesterov , Alexei Starovoitov , Steven Rostedt , Will Drewry , "linux-kernel@vger.kernel.org" , "H. Peter Anvin" , Linus Torvalds Subject: Re: [PATCH v4 RESEND] x86/asm/entry/32, selftests: Add 'test_syscall_vdso' test Message-ID: <20150916095128.GA12499@gmail.com> References: <1441641385-15937-1-git-send-email-dvlasenk@redhat.com> <55F1D447.6030703@redhat.com> <20150914081534.GA9274@gmail.com> <20150915055958.GA16947@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Andy Lutomirski wrote: > On Sep 14, 2015 11:00 PM, "Ingo Molnar" wrote: > > > > > > * Andy Lutomirski wrote: > > > > > On Sep 14, 2015 1:15 AM, "Ingo Molnar" wrote: > > > > > > > > > > > > * Denys Vlasenko wrote: > > > > > > > > > >> + /* INT80 syscall entrypoint can be used by > > > > > >> + * 64-bit programs too, unlike SYSCALL/SYSENTER. > > > > > >> + * Therefore it must preserve R12+ > > > > > >> + * (they are callee-saved registers in 64-bit C ABI). > > > > > >> + * > > > > > >> + * This was probably historically not intended, > > > > > >> + * but R8..11 are clobbered (cleared to 0). > > > > > >> + * IOW: they are the only registers which aren't > > > > > >> + * preserved across INT80 syscall. > > > > > >> + */ > > > > > >> + if (*r64 == 0 && num <= 11) > > > > > >> + continue; > > > > > > > > > > > > Ugh. I'll change my big entry patchset to preserve these and maybe to > > > > > > preserve all of the 64-bit regs. > > > > > > > > > > If you do that, this won't change the ABI: we don't _promise_ > > > > > to save them. If we accidentally do, that means nothing. > > > > > > > > Argh, that's dangerous nonsense! You _still_ don't seem to understand what the > > > > Linux ABI means and how to change code that implements it... > > > > > > I think Denys might be taking about R8-R11 here. If we change them > > > from clobbered to saved, that's probably fine. Certainly I have to > > > save R12-R15 -- my v1 is just buggy there. I was too deep in > > > __kernel_vsyscall when I wrote that code, and I wasn't thinking about > > > the raw int $0x80 entry variant. > > > > > > I'd be rather surprised if anything broke if we started preserving > > > R8-R11 instead of zeroing them. > > > > Well, read the statement: > > > > " If you do that, this won't change the ABI: we don't _promise_ > > to save them. If we accidentally do, that means nothing. " > > > > of _course_ it means everything: if we preserve R8-R11 and any app learns to rely > > on it, it becomes an ABI. > > Right, it changes the ABI in a way that we can't undo, but it probably > doesn't break the old ABI. it's unknown: user-space code might have (unknowingly) started relying on the zeroing behavior. If that happened (and let's hope it didn't - but there's no guarantee), then the zeroing behavior is an ABI too. > Certainly for v2, I'll try to preserve the old behavior exactly. If > we change it later to preserve all high regs, that'll be a separate > patch. Yeah, cleanly separating ABI-invariant patches from ABI-impacting ones (no matter how innocious the effect on the ABI looks) is a must. Thanks, Ingo