public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Florian Weimer <fw@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] POWER: Add context-synchronizing instructions to pkey_write [BZ #25954]
Date: Mon, 11 May 2020 14:11:57 +0000 (GMT)	[thread overview]
Message-ID: <20200511141157.C902B386F468@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e627106266ad8785457fadbf5bf67ed604d2a353

commit e627106266ad8785457fadbf5bf67ed604d2a353
Author: Florian Weimer <fweimer@redhat.com>
Date:   Mon May 11 11:20:02 2020 +0200

    POWER: Add context-synchronizing instructions to pkey_write [BZ #25954]
    
    Sandipan Das reported that,
    
    "The Power ISA mandates that all writes to the Authority
    Mask Register (AMR) must always be preceded as well as
    succeeded by a context-synchronizing instruction. This
    applies to both the privileged and unprivileged variants
    of the Move To AMR instruction.
    
    This [requirement] is from Table 6 of Chapter 11 in page 1134 of Power
    ISA 3.0B. The document can be found here:
    <https://ibm.ent.box.com/s/1hzcwkwf8rbju5h9iyf44wm94amnlcrv>
    "
    
    See this kernel patch submission:
    
    <https://lore.kernel.org/linuxppc-dev/5f65cf37be993760de8112a88da194e3ccbb2bf8.1588959697.git.sandipan@linux.ibm.com/>

Diff:
---
 sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-pkey.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-pkey.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-pkey.h
index 623b073d5a..25d080c9a6 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-pkey.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-pkey.h
@@ -37,7 +37,7 @@ pkey_read (void)
 static inline void
 pkey_write (unsigned long int value)
 {
-  __asm__ volatile ("mtspr 13, %0" : : "r" (value));
+  __asm__ volatile ("isync; mtspr 13, %0; isync" : : "r" (value));
 }
 
 /* Number of the largest supported key.  This depends on the width of


                 reply	other threads:[~2020-05-11 14:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200511141157.C902B386F468@sourceware.org \
    --to=fw@sourceware.org \
    --cc=glibc-cvs@sourceware.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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).