mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yu-cheng Yu <yu-cheng.yu@intel.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: X86 ML <x86@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@suse.de>,
	Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>,
	"Ravi V. Shankar" <ravi.v.shankar@intel.com>,
	Fenghua Yu <fenghua.yu@intel.com>
Subject: Re: [PATCH 04/10] x86/xsaves: Introduce a new check that allows correct xstates copy from kernel to user directly
Date: Mon, 22 Feb 2016 15:27:38 -0800	[thread overview]
Message-ID: <20160222232738.GB4259@test-lenovo> (raw)
In-Reply-To: <CALCETrWpetkx8gKDCMnfdf4oWGZUy5e8upZPY+_NiJGsQ8sB4w@mail.gmail.com>

On Mon, Feb 22, 2016 at 02:42:54PM -0800, Andy Lutomirski wrote:
> > +static int should_save_registers_directly(void)
> 
> I don't like the name of this function because:
> 
> > +{
> > +       /*
> > +        * In signal handling path, the kernel already checks if
> > +        * FPU instructions have been used before it calls
> > +        * copy_fpstate_to_sigframe(). We check this here again
> > +        * to detect any potential mis-use and saving invalid
> > +        * register values directly to a signal frame.
> > +        */
> > +       WARN_ONCE(!current->thread.fpu.fpstate_active,
> > +                 "direct FPU save with no math use\n");
> 
> ... Here "direct" seems to mean that we're asking whether to directly save ...
> 
> > +
> > +       /*
> > +        * In the case that we are using a compacted kernel
> > +        * xsave area, we can not copy the thread.fpu.state
> > +        * directly to userspace and *must* save it from the
> > +        * registers directly.
> > +        */
> 
> ... and here "directly" means *both* copying directly to userspace and
> saving using xsave directly.
> 
> So can you rename it to something with an obvious meaning like
> "may_memcpy_fpu_regs" or similar?

This function determines whether the kernel should do
copy_fpregs_to_sigframe(). Perhaps we can re-name it to
may_copy_fpregs_to_sigframe()?

--Yu-cheng

  reply	other threads:[~2016-02-22 23:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-22 18:58 Yu-cheng Yu
2016-02-22 22:42 ` Andy Lutomirski
2016-02-22 23:27   ` Yu-cheng Yu [this message]
2016-02-22 23:36     ` Andy Lutomirski

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=20160222232738.GB4259@test-lenovo \
    --to=yu-cheng.yu@intel.com \
    --cc=bp@suse.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=fenghua.yu@intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=ravi.v.shankar@intel.com \
    --cc=sai.praneeth.prakhya@intel.com \
    --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

all inboxes | Powered by JetHome®