From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752678AbdBMTak (ORCPT ); Mon, 13 Feb 2017 14:30:40 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33503 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751617AbdBMTaj (ORCPT ); Mon, 13 Feb 2017 14:30:39 -0500 Date: Mon, 13 Feb 2017 20:30:34 +0100 From: Ingo Molnar To: Andy Lutomirski Cc: Dmitry Safonov , "linux-kernel@vger.kernel.org" , Dmitry Safonov <0x7f454c46@gmail.com>, Shuah Khan , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Andy Lutomirski , Borislav Petkov , X86 ML , "open list:KERNEL SELFTEST FRAMEWORK" Subject: Re: [PATCHv3] x86/selftests: add clobbers for int80 on x86_64 Message-ID: <20170213193034.GA12346@gmail.com> References: <20170213101336.20486-1-dsafonov@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Andy Lutomirski wrote: > On Mon, Feb 13, 2017 at 2:13 AM, Dmitry Safonov wrote: > > Kernel erases R8..R11 registers prior returning to userspace > > from int80: https://lkml.org/lkml/2009/10/1/164 > > > > GCC can reuse this registers and doesn't expect them to change > > during syscall invocation. I met this kind of bug in CRIU once > > gcc 6.1 and clang stored local variables in those registers > > and the kernel zerofied them during syscall: > > https://github.com/xemul/criu/commit/990d33f1a1cdd17bca6c2eb059ab3be2564f7fa2 > > > > By that reason I suggest to add those registers to clobbers > > in selftests. Also, as notted by Andy - removed unneeded clobber > > for flags in int 0x80 inline asm. > > Acked-by: Andy Lutomirski > > Although these days we could preserve these regs in the kernel at the cost of (I > think) 4 bytes of text and zero runtime overhead. I think we should try that... Thanks, Ingo