[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+DvKQJYmWm6uP6k4HYdkuTdMX7=rSu34W2j-Vk8YcnWZVA-3w@mail.gmail.com>
Date: Fri, 26 Oct 2018 18:56:21 -0400
From: Daniel Micay <danielmicay@...il.com>
To: Andy Lutomirski <luto@...capital.net>
Cc: Dave Hansen <dave.hansen@...el.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
kernel list <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H . Peter Anvin" <hpa@...or.com>, X86 ML <x86@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Michael Ellerman <mpe@...erman.id.au>,
Will Deacon <will.deacon@....com>,
Andy Lutomirski <luto@...nel.org>, jroedel@...e.de
Subject: Re: [PATCH 1/2] x86/pkeys: copy pkey state at fork()
On Fri, 26 Oct 2018 at 18:12, Andy Lutomirski <luto@...capital.net> wrote:
>
>
>
> > On Oct 26, 2018, at 2:39 PM, Daniel Micay <danielmicay@...il.com> wrote:
> >
> > I ended up working around this with a pthread_atfork handler disabling
> > my usage of the feature in the child process for the time being. I
> > don't have an easy way to detect if the bug is present within a
> > library so
>
> Can you not just make sure that the fix is backported to all relevant kernels?
There are too many different distribution kernels and I won't be in
control of where the software is used.
> I suppose we could add a new flag for pkey_get() or something.
That would work, since I can apply the workaround (disabling the
feature in child processes) if I get EINVAL. The flag wouldn't need to
do anything, just existing and being tied to this patch so I have a
way to detect that I can safely use MPK after fork.
> > I'm going to need a kernel version check with a table of
> > kernel releases fixing the problem for each stable branch.
>
> That won’t work right on district kernels. Please don’t go there.
If it's backported to an earlier version, it will just mean missing a
chance to use it. I'm not going to assume that it behaves a certain
way based on having an old kernel, but rather I just won't use it in a
forked child on an older kernel version if I don't have a way to
detect the problem. It's for a few different uses in library code so
I can't have a runtime test trying to detect it with clone(...). I'd
definitely prefer a proper way to detect that I can use it after fork. I really
don't want to have a hack like that which is why I'm bringing it up.
Powered by blists - more mailing lists