On Fri, Sep 11, 2020 at 12:40 PM Lakshmi Ramasubramanian <nramas@xxxxxxxxxxxxxxxxxxx> wrote: > > checkreqprot data member in selinux_state struct is accessed directly by > SELinux functions to get and set. This could cause unexpected read or > write access to this data member due to compiler optimizations and/or > compiler's reordering of access to this field. > > Add helper functions to get and set checkreqprot data member in > selinux_state struct. These helper functions use READ_ONCE and > WRITE_ONCE macros to ensure atomic read or write of memory for > this data member. > > Rename enforcing_enabled() to enforcing_get() to be consistent > with the corresponding set function name. I thought Paul said to only use the new names for checkreqprot_*() and not to touch enforcing_*()? I don't really care either way about the names but usually we wouldn't mix renaming of something else with the introduction of these new helpers in a single patch. FWIW, looking at the history, the enforcing functions were originally named is_enforcing() and set_enforcing() in aa8e712cee93d520e96a2ca8 ("selinux: wrap global selinux state") . Then Paul renamed them to enforcing_enabled() and enforcing_set() in e5a5ca96a42ca7eee19cf869 ("selinux: rename the {is,set}_enforcing() functions").