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

journal: inject UB to see how it goes #12524

Merged
merged 5 commits into from
May 12, 2019
Merged

Conversation

evverx
Copy link
Member

@evverx evverx commented May 9, 2019

Looks like UBSan reports are currently sent right to /dev/null,
which isn't very helpful.

@evverx
Copy link
Member Author

evverx commented May 10, 2019

Apparently the UBSan summary (which isn't very helpful either) was sent to the file specified in ASAN_OPTIONS=log_path=... (which is weird but given that gcc 5.4.0 is used there I'd say it's fine because it's visible at least). The backtrace was sent to /dev/null :-)

gcc (GCC) 8.3.0 is a little bit better in the sense that it can tell ASAN_OPTIONS=log_path and UBSAN_OPTIONS=log_path aprt but still sends backtraces to stderr (which is /dev/null for journald). clang version 8.0.0 works as expected. I'm not sure what to do about it. I'll try to come up with a kludge to make it work. In the meantime, I hope we'll never have to look at UBSan reports :-)

evverx added a commit to evverx/systemd that referenced this pull request May 10, 2019
…BSan)

Sometimes UBSan sends its reports to stderr regardless of what is specified in log_path
Let's try to catch them by redirecting stderr (and stdout just in case) to a file
See systemd#12524 (comment)
@evverx
Copy link
Member Author

evverx commented May 10, 2019

It's slowly getting better:

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/journal/journald.c:20 
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/journal/journald.c:20 
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/journal/journald.c:20 
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/journal/journald.c:20 
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/journal/journald.c:20 ../src/journal/journald.c:20:11: runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
    #0 0x40694c in main ../src/journal/journald.c:20
    #1 0x7f1fd756c82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #2 0x406788 in _start (/lib/systemd/systemd-journald+0x406788)
No journal files were found.

I think it's fair to say that journald is covered. PID1 isn't so straightforward unfortunately but it usually just so happens that it sends UBSan reports to the console (which is much better than /dev/null) so I'd prefer not to touch it for now so as not to break anything :-)

evverx added a commit to evverx/systemd that referenced this pull request May 10, 2019
…BSan)

Sometimes UBSan sends its reports to stderr regardless of what is specified in log_path
Let's try to catch them by redirecting stderr (and stdout just in case) to a file
See systemd#12524 (comment)
@evverx
Copy link
Member Author

evverx commented May 10, 2019

The last commit technically has nothing to do with UBSan reports but it should address a couple of test failures in #10171 and #12520.

evverx added a commit to evverx/systemd that referenced this pull request May 10, 2019
…BSan)

Sometimes UBSan sends its reports to stderr regardless of what is specified in log_path
Let's try to catch them by redirecting stderr (and stdout just in case) to a file
See systemd#12524 (comment)
so that they won't end up in /dev/null
…BSan)

Sometimes UBSan sends its reports to stderr regardless of what is specified in log_path
Let's try to catch them by redirecting stderr (and stdout just in case) to a file
See systemd#12524 (comment)
The idea is to move a couple of stages from Travis CI (which has been
overloaded since I added the "FuzzBuzz" stage) to Azure Pipelines.
@evverx
Copy link
Member Author

evverx commented May 12, 2019

I'll go ahead and merge it so that I can turn on our Azure Pipeline.

@evverx evverx merged commit 1328a4b into systemd:master May 12, 2019
@evverx
Copy link
Member Author

evverx commented May 12, 2019

Judging by https://dev.azure.com/evvers/systemd-systemd/_build/results?buildId=1 it seems to be working.

@evverx evverx deleted the UBSan-reports branch May 12, 2019 02:31
edevolder pushed a commit to edevolder/systemd that referenced this pull request Jun 26, 2019
…BSan)

Sometimes UBSan sends its reports to stderr regardless of what is specified in log_path
Let's try to catch them by redirecting stderr (and stdout just in case) to a file
See systemd#12524 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

1 participant