linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Ira Weiny <ira.weiny@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Andy Lutomirski <luto@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Fenghua Yu <fenghua.yu@intel.com>,
	x86@kernel.org, Dan Williams <dan.j.williams@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-nvdimm@lists.01.org, linux-mm@kvack.org,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH V2 05/10] x86/pks: Add PKS kernel API
Date: Tue, 3 Nov 2020 19:14:07 +0100	[thread overview]
Message-ID: <20201103181407.GA83845@kroah.com> (raw)
In-Reply-To: <20201103175335.GA1531489@iweiny-DESK2.sc.intel.com>

On Tue, Nov 03, 2020 at 09:53:36AM -0800, Ira Weiny wrote:
> On Tue, Nov 03, 2020 at 07:50:24AM +0100, Greg KH wrote:
> > On Mon, Nov 02, 2020 at 12:53:15PM -0800, ira.weiny@intel.com wrote:
> > > From: Fenghua Yu <fenghua.yu@intel.com>
> > > 
> 
> [snip]
> 
> > > diff --git a/include/linux/pkeys.h b/include/linux/pkeys.h
> > > index 2955ba976048..0959a4c0ca64 100644
> > > --- a/include/linux/pkeys.h
> > > +++ b/include/linux/pkeys.h
> > > @@ -50,4 +50,28 @@ static inline void copy_init_pkru_to_fpregs(void)
> > >  
> > >  #endif /* ! CONFIG_ARCH_HAS_PKEYS */
> > >  
> > > +#define PKS_FLAG_EXCLUSIVE 0x00
> > > +
> > > +#ifndef CONFIG_ARCH_HAS_SUPERVISOR_PKEYS
> > > +static inline int pks_key_alloc(const char * const pkey_user, int flags)
> > > +{
> > > +	return -EOPNOTSUPP;
> > > +}
> > > +static inline void pks_key_free(int pkey)
> > > +{
> > > +}
> > > +static inline void pks_mk_noaccess(int pkey)
> > > +{
> > > +	WARN_ON_ONCE(1);
> > 
> > So for panic-on-warn systems, this is ok to reboot the box?
> 
> I would not expect this to reboot the box no.  But it is a violation of the API
> contract.  If pky_key_alloc() returns an error calling any of the other
> functions is an error.
> 
> > 
> > Are you sure, that feels odd...
> 
> It does feel odd and downright wrong...  But there are a lot of WARN_ON_ONCE's
> out there to catch this type of internal programming error.  Is panic-on-warn
> commonly used?

Yes it is, and we are trying to recover from that as it is something
that you should recover from.  Properly handle the error and move on.

thanks,

greg k-h

  reply	other threads:[~2020-11-03 18:14 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-02 20:53 [PATCH V2 00/10] PKS: Add Protection Keys Supervisor (PKS) support ira.weiny
2020-11-02 20:53 ` [PATCH V2 01/10] x86/pkeys: Create pkeys_common.h ira.weiny
2020-11-02 20:53 ` [PATCH V2 02/10] x86/fpu: Refactor arch_set_user_pkey_access() for PKS support ira.weiny
2020-11-02 20:53 ` [PATCH V2 03/10] x86/pks: Enable Protection Keys Supervisor (PKS) ira.weiny
2020-11-02 20:53 ` [PATCH V2 04/10] x86/pks: Preserve the PKRS MSR on context switch ira.weiny
2020-11-02 20:53 ` [PATCH V2 05/10] x86/pks: Add PKS kernel API ira.weiny
2020-11-03  6:50   ` Greg KH
2020-11-03 17:53     ` Ira Weiny
2020-11-03 18:14       ` Greg KH [this message]
2020-11-03 18:42         ` Ira Weiny
2020-11-02 20:53 ` [PATCH V2 06/10] x86/entry: Move nmi entry/exit into common code ira.weiny
2020-11-04 22:06   ` [tip: core/entry] " tip-bot2 for Thomas Gleixner
2020-11-02 20:53 ` [PATCH V2 07/10] x86/entry: Pass irqentry_state_t by reference ira.weiny
2020-11-02 20:53 ` [PATCH V2 08/10] x86/entry: Preserve PKRS MSR across exceptions ira.weiny
2020-11-02 20:53 ` [PATCH V2 09/10] x86/fault: Report the PKRS state on fault ira.weiny
2020-11-02 20:53 ` [PATCH V2 10/10] x86/pks: Add PKS test code ira.weiny
2020-11-02 23:36 ` [PATCH V2 00/10] PKS: Add Protection Keys Supervisor (PKS) support Thomas Gleixner
2020-11-02 23:41   ` Thomas Gleixner
2020-11-04 17:46   ` Ira Weiny
2020-11-04 22:00     ` Thomas Gleixner
2020-11-04 22:45       ` Ira Weiny
2020-11-04 22:54         ` Ira Weiny

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=20201103181407.GA83845@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=fenghua.yu@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.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;
as well as URLs for NNTP newsgroup(s).