On 24.02.2020 12:14, Mouse wrote: >> Forbidding NULL pointer arithmetic is not just for C purists trolls. >> It is now in C++ mainstream and already in C2x draft. > > Then those are not suitable languages for OS implementations. > > I'm with campbell and mrg on this one. It is not appropriate to twist > NetBSD's code into a pretzel to work around "bugs" created by language > committees deciding to give compilers new latitutde to "optimize" > meaningful code into trash. > This battle is lost for C and not be fought on a downstream user of a C compiler (Matt Thomas insisted at some point to get the kernel buildable with C++ and patched it for this..). A compiler once being smart enough can introduce ILL/SEGV traps into code that performs operations on NULL pointers. This already bitten us when we were registering a handler at address 0x0 for the kernel code, GCC changed the operation into a cpu trap. (IIRC it was in the sparc code.) Looking at it from the proper perspective, the only rumpkernel reported NULL->0 arithmetic is performed by the pserialize macros. Once we will patch them, the problem can go away. So claim about twisting the kernel code or churn is exaggeration. RUST is better defined that C and is indeed used in OS development these days (there are startups doing OS development in RUST, e.g. https://github.com/oxidecomputer).
Description: OpenPGP digital signature