-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ubsan claims the generated code has UB #18
Comments
clang's ubsan doesn't like the generated code, gcc is OK. I don't know if the UB is real or not, so for now disable only clang's sanitizer, assuming it is a false-positive. See thkukuk/rpcsvc-proto#18 Also disable unused variable warnings, as the generated code has unused variables.
RPC is over 40 years old and deprecated since at mininum 2 decades. It's no surprise that modern compilers don't like that old, autogenerated code anymore. Adjust the autogenerated code so that modern compilers like it again and don't re-generate them anymore. And look for something better than RPC. |
What is "better than RPC"? |
clang's ubsan doesn't like the generated code, gcc is OK. I don't know if the UB is real or not, so for now disable only clang's sanitizer, assuming it is a false-positive. See thkukuk/rpcsvc-proto#18 Also disable unused variable warnings, as the generated code has unused variables.
I have this rpc template file:
https://github.com/dosemu2/dosemu2/blob/6af6ea929550e00563223575a3f9bf007927ba75/src/base/lib/fsrpc/fsrpc.x
on which I do
rpcgen -N -M fsrpc.x
.If compiled with clang
-fsanitize=undefined
,then on start-up I am getting this:
The generated function looks like this:
The problematic spot is:
retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
local
is defined as:bool_t (*local)(char *, void *, struct svc_req *);
I believe ubsan dislikes the fact that
the function has
char **
as the firstarg, but is called via the pointer which
has
char *
as a first arg. If I changethe definition of
local
to usechar **
then this function no longer results in
UB, but all others do, as they only have
a single pointer in the first arg.
The text was updated successfully, but these errors were encountered: