Comments (6)
Well, albeit slower, the use of atomics there could be removed and the existing mutex (spec->regex_compiled) be used within the mutex. Then their are no atomics. Not sure how badly that would affct performance, but I would wager it won't be noticeable.
from selinux.
Just using the mutex was deemed unacceptable for performance reasons by the Android team when the patch was first proposed that addressed the thread safety issues in selabel_lookup.
Not opposed to the use of syncs on older gcc.
from selinux.
Normal (non-atomic) accesses to 'spec->regex_compiled' would have equivalent effects to today's code.
Atomic accesses would only be needed if you were trying to implement thread-safe algorithm without any locks. But you're not; you're just doing a first pass "should we even attempt to lock?" filter. In the current code, the pre-lock accesses to regex_compiled will race whether atomic or not; it's the mutex that ensures safety.
from selinux.
Yes, I questioned the need for atomics in the original patch. At the time, the author of the patch said "I was thinking of that, but I figure I don't want to fix a multi threading issue by introducing a potential / even more subtle multi threading issue by relying on the compiler / architecture to do what I want. The atomics make it explicit that if compile_regex() returns success, that the regex is ready to be used, which isn't necessarily a guarantee that can be made across architectures without them."
If that's a bogus argument, then I'm open to a patch to get rid of it, but probably ought to include the original author on that as well.
from selinux.
I'm very very skeptical (see in particular POSIX 4.12 "Memory Synchronization"), but as an incremental improvement I'll just address the build issue.
from selinux.
I guess I'll submit to [email protected] too, but that list doesn't seem to have public archives so I wouldn't be able to include a link here.
0001-Fix-build-break-around-_atomic-with-GCC-4.7.patch.txt
from selinux.
Related Issues (20)
- bad gpg signature HOT 4
- checkpolicy compilation error HOT 4
- selinux_restorecon.c comparison between signed and unsigned integer expressions
- Scope of boolean 'httpd_can_network_connect' & Django SELinux permissions
- libsepol:The libsepol package detects memory leaks and segmentation errors when tested by OSS-fuzz. HOT 4
- How Do I Select a Proper Number of Threads for Labeling? HOT 2
- Can use macro parameter for filecon path statment? HOT 1
- restore.c:(.text+0x229): undefined reference to `selinux_restorecon_parallel' HOT 1
- selinux-activate not working on RaspbianOS bullseye (version 11) HOT 1
- "semanage export" does not handle port definition modifications properly
- libselinux: off-by-one in setcon() family
- Question Regarding "semanage boolean": HOT 5
- Non-cached is_selinux_enabled() variant? HOT 1
- selinux 3.6 fails to compile against latest versions of musl HOT 1
- libselinux: selabel_digest -b x/media/db error HOT 1
- libsepol: new "all" op verifier in 3.6 does not check classcommon perms HOT 3
- Should ignoredirs apply to all subdirectories? HOT 5
- Compilation error on i386 HOT 1
- setfiles: Setting labels that are not in host policy when running unprivileged fails with EINVAL HOT 6
- cross-compilation error with buildroot
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from selinux.