From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B1A4C2D0A3 for ; Tue, 3 Nov 2020 18:42:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D03E120870 for ; Tue, 3 Nov 2020 18:42:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D03E120870 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EA8D46B0036; Tue, 3 Nov 2020 13:42:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E58746B005D; Tue, 3 Nov 2020 13:42:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D490D6B0068; Tue, 3 Nov 2020 13:42:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0240.hostedemail.com [216.40.44.240]) by kanga.kvack.org (Postfix) with ESMTP id A7E766B0036 for ; Tue, 3 Nov 2020 13:42:30 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 3C27733CD for ; Tue, 3 Nov 2020 18:42:30 +0000 (UTC) X-FDA: 77443977660.16.crib48_070bc99272ba Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id 1CCFF100E690C for ; Tue, 3 Nov 2020 18:42:30 +0000 (UTC) X-HE-Tag: crib48_070bc99272ba X-Filterd-Recvd-Size: 4090 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Tue, 3 Nov 2020 18:42:27 +0000 (UTC) IronPort-SDR: WvhLijAy7vXiZIpy8fYkuAHRIecMJJ7k3dKQiEGAlpLHeGYCkaoawPH89eSeECCpJY91VT2bWu r/UqAIYDPK+A== X-IronPort-AV: E=McAfee;i="6000,8403,9794"; a="186957244" X-IronPort-AV: E=Sophos;i="5.77,448,1596524400"; d="scan'208";a="186957244" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2020 10:42:19 -0800 IronPort-SDR: NHUhhr4Ld0+ktxaexVqc9ly5ziPRS5Y+EjthlhRuorVcxAnBGj8aOQJlCSYv9leRTjjDuriVDY sxTjbk20XkgQ== X-IronPort-AV: E=Sophos;i="5.77,448,1596524400"; d="scan'208";a="528593430" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.147]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2020 10:42:19 -0800 Date: Tue, 3 Nov 2020 10:42:18 -0800 From: Ira Weiny To: Greg KH Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Peter Zijlstra , Dave Hansen , Fenghua Yu , x86@kernel.org, Dan Williams , Andrew Morton , 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 Message-ID: <20201103184218.GB1531489@iweiny-DESK2.sc.intel.com> References: <20201102205320.1458656-1-ira.weiny@intel.com> <20201102205320.1458656-6-ira.weiny@intel.com> <20201103065024.GC75930@kroah.com> <20201103175335.GA1531489@iweiny-DESK2.sc.intel.com> <20201103181407.GA83845@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201103181407.GA83845@kroah.com> User-Agent: Mutt/1.11.1 (2018-12-01) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Nov 03, 2020 at 07:14:07PM +0100, Greg KH wrote: > 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 > > > > > > > > [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. Sorry, I did not know that... Ok I'll look at the series because I probably have others I need to change. Thanks, Ira