LKML Archive on
help / color / mirror / Atom feed
From: Daniel Micay <>
To: Dave Hansen <>
Cc: Dave Hansen <>,
	kernel list <>,
	Thomas Gleixner <>,
	Ingo Molnar <>, Borislav Petkov <>,
	"H . Peter Anvin" <>, X86 ML <>,
	Peter Zijlstra <>,
	Michael Ellerman <>,
	Will Deacon <>,
	Andy Lutomirski <>,
Subject: Re: [PATCH 1/2] x86/pkeys: copy pkey state at fork()
Date: Fri, 26 Oct 2018 17:39:08 -0400	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

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 I'm going to need a kernel version check with a table of
kernel releases fixing the problem for each stable branch.

It would be helpful if there was a new cpuinfo flag to check if the
MPK state is preserved on fork in addition to the existing ospke flag.
The problem will fade away over time but in my experience there are a
lot of people using distributions with kernels not incorporating all
of the stable fixes. I expect other people will run into the problem
once hardware with MPK is more widely available and other people try
to use it for various things like moving GC or assorted security
features. Someone will end up running software adopting it on an older
kernel with the problem.

The clobbering issue I found with MAP_FIXED_NOREPLACE isn't quite
as annoying because it was easy to make a runtime test usable in a library
to see if the feature works properly.

  reply	other threads:[~2018-10-26 21:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-26 19:51 Dave Hansen
2018-10-26 19:51 ` [PATCH 2/2] x86/selftests/pkeys: fork() to check for state being preserved Dave Hansen
2018-10-26 19:59 ` [PATCH 1/2] x86/pkeys: copy pkey state at fork() Dave Hansen
2018-10-26 21:39   ` Daniel Micay [this message]
2018-10-26 22:12     ` Andy Lutomirski
2018-10-26 22:56       ` Daniel Micay
2018-10-29  6:36         ` Ingo Molnar
2018-10-29  8:55           ` Daniel Micay
2018-11-20 21:14   ` Kees Cook
2019-01-09  0:56     ` Kees Cook

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH 1/2] x86/pkeys: copy pkey state at fork()' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).