-
Notifications
You must be signed in to change notification settings - Fork 273
Input validation problems with --function-pointer-restrictions-file
#6368
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
Comments
Taking a look. |
@avanhatt Could you please share the goto binary and the restrictions file? The type casts I'm able to make sense of and am working to fix, but the syntax error I cannot immediately relate to the use of |
Ah, I'm so sorry, looks like I was reading the error message in the 2nd issue wrong - the problem was I was passing the wrong file path, which Updating the description and working on attaching a standalone binary. |
@remi-delmas-3000 Do you have thoughts on this given your experiences with function pointer resolution? |
The documentation seems to say that function pointer restriction instructions must be function identifiers and not arbitrary expressions involving casts. So it does not look surprising that the replacement file fails to load. However, automatic function pointer removal (as opposed to manual restriction discussed here) is able to insert type casts on arguments (and also return values ?) when the replacement does not fully match the function pointer type being removed. Maybe casts could be inserted as needed when restriction is performed ? |
We had two instances of code generating an if-else sequence of function calls for function pointers. The code used with --restrict-function-pointer, however, was not able to cope with type mismatches. Make the code from remove_function_pointers re-usable in both contexts, enabling support for additional type casts. Fixes: diffblue#6368
[...]
This is now implemented in #6376. |
We had two instances of code generating an if-else sequence of function calls for function pointers. The code used with --restrict-function-pointer, however, was not able to cope with type mismatches. Make the code from remove_function_pointers re-usable in both contexts, enabling support for additional type casts. Fixes: diffblue#6368
Core fix of allowing function pointer casts in restrictions works for me in #6376! 🎉 Before:
With #6376:
However, I noticed the function name and call site were dropped from the cbmc assertion message: Before:
With #6376:
It would be great if both of these asserts had the location. |
We had two instances of code generating an if-else sequence of function calls for function pointers. The code used with --restrict-function-pointer, however, was not able to cope with type mismatches. Make the code from remove_function_pointers re-usable in both contexts, enabling support for additional type casts. Fixes: diffblue#6368
We had two instances of code generating an if-else sequence of function calls for function pointers. The code used with --restrict-function-pointer, however, was not able to cope with type mismatches. Make the code from remove_function_pointers re-usable in both contexts, enabling support for additional type casts. Fixes: diffblue#6368
We had two instances of code generating an if-else sequence of function calls for function pointers. The code used with --restrict-function-pointer, however, was not able to cope with type mismatches. Make the code from remove_function_pointers re-usable in both contexts, enabling support for additional type casts. Fixes: diffblue#6368
We had two instances of code generating an if-else sequence of function calls for function pointers. The code used with --restrict-function-pointer, however, was not able to cope with type mismatches. Make the code from remove_function_pointers re-usable in both contexts, enabling support for additional type casts. Fixes: diffblue#6368
We had two instances of code generating an if-else sequence of function calls for function pointers. The code used with --restrict-function-pointer, however, was not able to cope with type mismatches. Make the code from remove_function_pointers re-usable in both contexts, enabling support for additional type casts. Fixes: diffblue#6368
CBMC version: 5.30.1 (cbmc-5.30.1)
Operating system: Ubuntu 20.04.2
Exact command line resulting in the issue:
goto-instrument --function-pointer-restrictions-file restrictions
(within the context of the RMC tool).What behaviour did you expect:
CBMC to restrict function pointer branch analysis to the cases specified, as described in the documentation for function pointer descriptions here.
What happened instead:
I am running into two related problems with the
--function-pointer-restrictions-file
flag.(1) Casting
The functions I would like to restrict are a different type than the call site due to a cast in the source code to a function that takes a void pointer. The source code looks roughly like this:
However, if I try to pass
_Animal_noise
as a restriction, I get this error:However, if I try and include the cast in the restrictions file, it fails to parse:
The pointer itself does not have a symbol name to my understanding, because it is a struct field.
(2) . in function namewrong error, see belowIn a different example, some of my restricted function have..
in the name, and fail to parse:Example:Error:This is despite CBMC analyzing the file with these names fine without restrictions.The text was updated successfully, but these errors were encountered: