public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Dmitry Safonov <dsafonov@virtuozzo.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Dmitry Safonov <0x7f454c46@gmail.com>,
	Shuah Khan <shuah@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@suse.de>,
	X86 ML <x86@kernel.org>,
	"open list:KERNEL SELFTEST FRAMEWORK" 
	<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCHv3] x86/selftests: add clobbers for int80 on x86_64
Date: Mon, 13 Feb 2017 20:30:34 +0100	[thread overview]
Message-ID: <20170213193034.GA12346@gmail.com> (raw)
In-Reply-To: <CALCETrXuN3zOTKTScas+Tj=7Xzm_DTEDyuL-toxp=4+i-=HX6w@mail.gmail.com>


* Andy Lutomirski <luto@amacapital.net> wrote:

> On Mon, Feb 13, 2017 at 2:13 AM, Dmitry Safonov <dsafonov@virtuozzo.com> 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 <luto@kernel.org>
> 
> 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

  reply	other threads:[~2017-02-13 19:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-13 10:13 [PATCHv3] x86/selftests: add clobbers for int80 on x86_64 Dmitry Safonov
2017-02-13 19:06 ` Andy Lutomirski
2017-02-13 19:30   ` Ingo Molnar [this message]
2017-02-13 22:18   ` hpa
2017-02-17 17:03     ` Andy Lutomirski
2017-03-01  9:47 ` [tip:x86/urgent] x86/selftests: Add " tip-bot for Dmitry Safonov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170213193034.GA12346@gmail.com \
    --to=mingo@kernel.org \
    --cc=0x7f454c46@gmail.com \
    --cc=bp@suse.de \
    --cc=dsafonov@virtuozzo.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=shuah@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox