[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c68f0f9b-2e56-6ca6-511d-58acd3d96ff2@intel.com>
Date: Wed, 3 Feb 2021 14:28:45 -0800
From: "Yu, Yu-cheng" <yu-cheng.yu@...el.com>
To: Dave Hansen <dave.hansen@...el.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, linux-mm@...ck.org,
linux-arch@...r.kernel.org, linux-api@...r.kernel.org,
Arnd Bergmann <arnd@...db.de>,
Andy Lutomirski <luto@...nel.org>,
Balbir Singh <bsingharora@...il.com>,
Borislav Petkov <bp@...en8.de>,
Cyrill Gorcunov <gorcunov@...il.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Eugene Syromiatnikov <esyr@...hat.com>,
Florian Weimer <fweimer@...hat.com>,
"H.J. Lu" <hjl.tools@...il.com>, Jann Horn <jannh@...gle.com>,
Jonathan Corbet <corbet@....net>,
Kees Cook <keescook@...omium.org>,
Mike Kravetz <mike.kravetz@...cle.com>,
Nadav Amit <nadav.amit@...il.com>,
Oleg Nesterov <oleg@...hat.com>, Pavel Machek <pavel@....cz>,
Peter Zijlstra <peterz@...radead.org>,
Randy Dunlap <rdunlap@...radead.org>,
"Ravi V. Shankar" <ravi.v.shankar@...el.com>,
Vedvyas Shanbhogue <vedvyas.shanbhogue@...el.com>,
Dave Martin <Dave.Martin@....com>,
Weijiang Yang <weijiang.yang@...el.com>,
Pengfei Xu <pengfei.xu@...el.com>
Subject: Re: [PATCH v18 24/25] x86/cet/shstk: Add arch_prctl functions for
shadow stack
On 2/3/2021 2:11 PM, Dave Hansen wrote:
> On 2/3/21 1:54 PM, Yu, Yu-cheng wrote:
>> On 1/29/2021 10:56 AM, Yu, Yu-cheng wrote:
>>> On 1/29/2021 9:07 AM, Dave Hansen wrote:
>>>> On 1/27/21 1:25 PM, Yu-cheng Yu wrote:
>>>>> + if (!IS_ENABLED(CONFIG_X86_CET))
>>>>> + return -EOPNOTSUPP;
>>>>
>>>> Let's ignore glibc for a moment. What error code *should* the kernel be
>>>> returning here? errno(3) says:
>>>>
>>>> EOPNOTSUPP Operation not supported on socket (POSIX.1)
>>>> ...
>>>> ENOTSUP Operation not supported (POSIX.1)
>>>>
>>>
>>> Yeah, other places in kernel use ENOTSUPP. This seems to be out of
>>> line. And since the issue is long-existing, applications already know
>>> how to deal with it. I should have made that argument. Change it to
>>> ENOTSUPP.
>>
>> When I make the change, checkpatch says...
>>
>> WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP
>> #128: FILE: arch/x86/kernel/cet_prctl.c:33:
>> + return -ENOTSUPP;
>>
>> Do we want to reconsider?
>
> I'm not sure I trust checkpatch over manpages. I had to google "SUSV4".
> I'm not sure it matters at *all* for a 100% Linux-specific interface.
>
> ENOTSUPP does seem less popular lately:
>
>> $ git diff v5.0.. kernel/ arch/ drivers/ | grep ^+.*return.*E.*NO.*SUP.*\; | grep -o -- -E.*\; | sort | uniq -c | sort -n
>> ... noise
>> 61 -EOPNOTSUPP);
>> 260 -ENOTSUPP;
>> 1577 -EOPNOTSUPP;
>
> but far from unused. That might be due to checkpatch spew more than
> anything.
>
Maybe I will keep it ENOTSUPP for now. If any logical reason should
come up, I will be happy to change it again. Thanks!
--
Yu-cheng
Powered by blists - more mailing lists