From: Sohil Mehta <sohil.mehta@intel.com> To: <ira.weiny@intel.com>, <linux-api@vger.kernel.org> Cc: Dave Hansen <dave.hansen@linux.intel.com>, "Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>, <x86@kernel.org>, <linuxppc-dev@lists.ozlabs.org>, <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>, <linux-kselftest@vger.kernel.org> Subject: Re: [RFC PATCH 3/6] testing/pkeys: Add additional test for pkey_alloc() Date: Thu, 16 Jun 2022 12:25:20 -0700 [thread overview] Message-ID: <b4f8ca28-f24a-d619-3682-d92fb35db56d@intel.com> (raw) In-Reply-To: <20220610233533.3649584-4-ira.weiny@intel.com> On 6/10/2022 4:35 PM, ira.weiny@intel.com wrote: > > +void test_pkey_alloc_on_unsupported_cpu(void) > +{ > + int test_pkey = sys_pkey_alloc(0, 0); > + > + dprintf1("pkey_alloc: %d (%d %s)\n", test_pkey, errno, > + strerror(errno)); > + pkey_assert(test_pkey < 0); > + pkey_assert(errno == ENOSPC); This assert fails on a kernel with CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS disabled. Since pkey_alloc() is an architecture dependent syscall, ENOSYS is returned instead of ENOSPC when support is disabled at compile time. See kernel/sys_ni.c This brings us to an interesting question. Should we have different return error codes when compile support is disabled vs when runtime support is missing? Here is the current behavior for pkey_alloc(): No compile time support -> return ENOSYS No runtime support (but compile time support present) -> return ENOSPC I would think applications would prefer the same error code. But, I am not sure if we can achieve this now due to ABI reasons. > +} > +
WARNING: multiple messages have this Message-ID (diff)
From: Sohil Mehta <sohil.mehta@intel.com> To: <ira.weiny@intel.com>, <linux-api@vger.kernel.org> Cc: x86@kernel.org, "Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>, Dave Hansen <dave.hansen@linux.intel.com>, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [RFC PATCH 3/6] testing/pkeys: Add additional test for pkey_alloc() Date: Thu, 16 Jun 2022 12:25:20 -0700 [thread overview] Message-ID: <b4f8ca28-f24a-d619-3682-d92fb35db56d@intel.com> (raw) In-Reply-To: <20220610233533.3649584-4-ira.weiny@intel.com> On 6/10/2022 4:35 PM, ira.weiny@intel.com wrote: > > +void test_pkey_alloc_on_unsupported_cpu(void) > +{ > + int test_pkey = sys_pkey_alloc(0, 0); > + > + dprintf1("pkey_alloc: %d (%d %s)\n", test_pkey, errno, > + strerror(errno)); > + pkey_assert(test_pkey < 0); > + pkey_assert(errno == ENOSPC); This assert fails on a kernel with CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS disabled. Since pkey_alloc() is an architecture dependent syscall, ENOSYS is returned instead of ENOSPC when support is disabled at compile time. See kernel/sys_ni.c This brings us to an interesting question. Should we have different return error codes when compile support is disabled vs when runtime support is missing? Here is the current behavior for pkey_alloc(): No compile time support -> return ENOSYS No runtime support (but compile time support present) -> return ENOSPC I would think applications would prefer the same error code. But, I am not sure if we can achieve this now due to ABI reasons. > +} > +
next prev parent reply other threads:[~2022-06-16 19:25 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-06-10 23:35 [RFC PATCH 0/6] User pkey minor bug fixes ira.weiny 2022-06-10 23:35 ` ira.weiny 2022-06-10 23:35 ` [RFC PATCH 1/6] testing/pkeys: Add command line options ira.weiny 2022-06-10 23:35 ` ira.weiny 2022-06-13 22:31 ` Sohil Mehta 2022-06-13 22:31 ` Sohil Mehta 2022-06-13 23:41 ` Ira Weiny 2022-06-13 23:41 ` Ira Weiny 2022-06-10 23:35 ` [RFC PATCH 2/6] testing/pkeys: Don't use uninitialized variable ira.weiny 2022-06-10 23:35 ` ira.weiny 2022-06-13 22:48 ` Sohil Mehta 2022-06-13 22:48 ` Sohil Mehta 2022-06-13 23:59 ` Ira Weiny 2022-06-13 23:59 ` Ira Weiny 2022-06-10 23:35 ` [RFC PATCH 3/6] testing/pkeys: Add additional test for pkey_alloc() ira.weiny 2022-06-10 23:35 ` ira.weiny 2022-06-16 19:25 ` Sohil Mehta [this message] 2022-06-16 19:25 ` Sohil Mehta 2022-06-16 20:24 ` Dave Hansen 2022-06-16 20:24 ` Dave Hansen 2022-06-10 23:35 ` [RFC PATCH 4/6] pkeys: Lift pkey hardware check " ira.weiny 2022-06-10 23:35 ` ira.weiny 2022-06-16 19:31 ` Sohil Mehta 2022-06-16 19:31 ` Sohil Mehta 2022-06-10 23:35 ` [RFC PATCH 5/6] pkeys: Up level pkey_free() checks ira.weiny 2022-06-10 23:35 ` ira.weiny 2022-06-13 9:14 ` Christophe Leroy 2022-06-13 9:14 ` Christophe Leroy 2022-06-10 23:35 ` [RFC PATCH 6/6] pkeys: Change mm_pkey_free() to void ira.weiny 2022-06-10 23:35 ` ira.weiny 2022-06-13 9:17 ` Christophe Leroy 2022-06-13 9:17 ` Christophe Leroy 2022-06-13 16:16 ` Ira Weiny 2022-06-13 16:16 ` Ira Weiny 2022-06-13 22:05 ` [RFC PATCH 0/6] User pkey minor bug fixes Sohil Mehta 2022-06-13 22:05 ` Sohil Mehta
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=b4f8ca28-f24a-d619-3682-d92fb35db56d@intel.com \ --to=sohil.mehta@intel.com \ --cc=aneesh.kumar@linux.ibm.com \ --cc=dave.hansen@linux.intel.com \ --cc=ira.weiny@intel.com \ --cc=linux-api@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-kselftest@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=linuxppc-dev@lists.ozlabs.org \ --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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.