1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

Merge pull request #29206 from mrc0mmand/lsan-followup

core: limit the LSan shenanigans to PID 1
This commit is contained in:
Mike Yuan 2023-09-18 23:00:04 +08:00 committed by GitHub
commit 8fbf0a214e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

2
.vimrc
View File

@ -18,4 +18,4 @@ set makeprg=GCC_COLORS=\ make
set tw=79
au BufRead,BufNewFile *.xml set tw=109 shiftwidth=2 smarttab
au FileType sh set tw=109 shiftwidth=4 smarttab
au FileType c set tw=109
au FileType c set tw=109 shiftwidth=8

View File

@ -3185,13 +3185,15 @@ finish:
* LSan check would not print any actionable information and would just crash
* PID 1. To make this a bit more helpful, let's try to open /dev/console,
* and if we succeed redirect LSan's report there. */
if (getpid_cached() == 1) {
_cleanup_close_ int tty_fd = -EBADF;
int tty_fd = open_terminal("/dev/console", O_WRONLY|O_NOCTTY|O_CLOEXEC);
if (tty_fd >= 0)
__sanitizer_set_report_fd((void*) (intptr_t) tty_fd);
tty_fd = open_terminal("/dev/console", O_WRONLY|O_NOCTTY|O_CLOEXEC);
if (tty_fd >= 0)
__sanitizer_set_report_fd((void*) (intptr_t) tty_fd);
__lsan_do_leak_check();
tty_fd = safe_close(tty_fd);
__lsan_do_leak_check();
}
#endif
if (r < 0)