Skip to content
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

Address sanitizer give a hint that it's a NULL pointer dereference rather than zero page #1626

Open
jonnygrant opened this issue Feb 24, 2023 · 4 comments

Comments

@jonnygrant
Copy link

Hello

Currently a NULL pointer dereference gives this error

"Hint: address points to the zero page" Seems a bit of an obscure hint. Could it be changed to just say "NULL pointer dereference" ? That would then follow industry best practice, and CERT, MISRA documentation.

Here is an example:

https://godbolt.org/z/rbG8daz7v

AddressSanitizer:DEADLYSIGNAL

==1==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x0000004010ae bp 0x000000000000 sp 0x7fff9258d908 T0)
==1==The signal is caused by a READ memory access.
==1==Hint: address points to the zero page.
#0 0x4010ae in f(char const*) /app/example.cpp:3
#1 0x4010ae in main /app/example.cpp:10
#2 0x7f7a269e2082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
#3 0x40111d in _start (/app/output.s+0x40111d) (BuildId: bc76a83b79c8b3362b3131001354fa809f091c45)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /app/example.cpp:3 in f(char const*)
==1==ABORTING

@vitalybuka
Copy link
Contributor

you are probably looking for -fsanitize=null

for "Address sanitizer" it was signal handler, with some signal context, and we want to print signals in consistent way

@vitalybuka vitalybuka closed this as not planned Won't fix, can't repro, duplicate, stale Feb 25, 2023
@jonnygrant
Copy link
Author

you are probably looking for -fsanitize=null

for "Address sanitizer" it was signal handler, with some signal context, and we want to print signals in consistent way

Hello, Yes I used -fsanitize=null, but it only outputs a runtime error, there's no backtrace.

It seems printing a reasonable hint "NULL pointer dereference" is clearer. It would then be consistent across the whole sanitizer suite, and compilers such as clang and gcc. As a software engineer, we've not worked with anyone who calls that the "zero page". Kind regards.

@vitalybuka vitalybuka reopened this Feb 26, 2023
@vitalybuka
Copy link
Contributor

I didn't realize it's only about the "hint".

@jonnygrant
Copy link
Author

Thank you Vitaly, Would be great if the output was is as follows

==1==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x0000004010ae bp 0x000000000000 sp 0x7fff9258d908 T0)
==1==The signal is caused by a READ memory access.
==1==Hint: NULL pointer dereference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants