tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: racy acccess in kern_runq.c
On Fri, Dec 06, 2019 at 10:27:20AM +0100, Maxime Villard wrote:
> With 'worker_ci', there is an actual safety issue, because the compiler could
> split the accesses and the hardware may not use atomics by default like x86.
> This could cause random page faults; so it needs to be strictly atomic.
No I don't accept that.
The ability to load and store a native word sized int (and in more recent
years a pointer) with a single instruction is a fundamental assumption that
every operating system written in C rests upon.
If the compiler splits one of those acceses, then you are either using some
other data type, or have a broken compiler on your hands. If the compiler
is broken it's the compiler you should be looking at, not the program it
compiled. It's as simple as that.
https://www.gnu.org/software/libc/manual/html_node/Atomic-Types.html
Andrew
Home |
Main Index |
Thread Index |
Old Index