Bug 25954 - Missing context-synchronizing instructions in pkey_set on POWER
Summary: Missing context-synchronizing instructions in pkey_set on POWER
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: 2.32
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-08 20:03 UTC by Florian Weimer
Modified: 2023-07-02 16:08 UTC (History)
3 users (show)

See Also:
Host:
Target: powerpc64*
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Weimer 2020-05-08 20:03:02 UTC
Sandipan Das reported this bug against the kernel protection key self-tests:

“
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
”

<https://lore.kernel.org/linuxppc-dev/5f65cf37be993760de8112a88da194e3ccbb2bf8.1588959697.git.sandipan@linux.ibm.com/>

We need to add these additonal instructions to the pkey_set implementation in glibc, too.
Comment 1 Florian Weimer 2020-05-11 10:13:44 UTC
Patch posted: https://sourceware.org/pipermail/libc-alpha/2020-May/113779.html
Comment 2 Florian Weimer 2023-07-02 16:07:43 UTC
Fixed for 2.32 via:

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/>