syzkaller
syzkaller copied to clipboard
executor: marking function parameters volatile is deprecated in c++20
See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1152r0.html#parret
(To provide a context for those who might read it later: we declare pseudo syscall arguments as volatile to prevent constant propagation by the compiler when it compiles C reproducers).
Interesting. Does it produce warnings on any platform we support now?
We currently fall back on the default C++ standard that is assumed by a compiler (as we actually don't use any modern features in syz-executor at all), and these default versions are very far from c++20. Or am I wrong?
I fear it might be quite a pain to update all our pseudo syscalls so that they don't use volatile arguments. And who knows when (or whether) it is actually needed.
But if it's already important e.g. for Darwin, then yes, we could just fix this one for now. In this case it would be nice to also have a comment describing the motivation behind introducing an extra volatile variable - the code looks pretty confusing for those who don't know the context.
Maybe there is some combination of function attributes that we could add to pseudo syscalls that would prevent the constant propagation warnings. E.g. __attribute__((noinline, noclone))?
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes
There is a concern of adding more clutter to C reproducers, but volatile's also add clutter. Maybe we hide this under a define (along with static)?
I meant to leave this in draft form for now, sorry for the confusion.
In the last few weeks I build a POC for integrating SerenityOS into syzkaller: https://github.com/SerenityOS/serenity/issues/1025#issuecomment-914577016. This is nowhere near ready for up-streaming though, so I decided to not pursue this change for now.
SerenityOS is different from most other open source OSes in that it does provide some Ports, but generally aims to re-write everything you could imagine for a fully fledged desktop OS from scratch. They do so in a monorepo and C++. Hence there code is quite opinionated and they do use and require c++20 at the moment.