diff options
author | Evgeny Vereshchagin <evvers@ya.ru> | 2016-12-25 14:17:22 +0300 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-12-25 12:17:22 +0100 |
commit | 08493e73bfc397fd7c7e24d97e4f56434eaac874 (patch) | |
tree | 494a3635857f855b4b408f6394398d454d16f723 | |
parent | 3a0a40d1667e53b623e891527871e9f3ee6cb7b4 (diff) |
test-selinux: place %m after %[sf] (#4977)
"%d (%m) %s\n" crashes asan: https://github.com/google/sanitizers/issues/759
So, let's place %m after %s
Fixes:
```
$ ./libtool --mode=execute ./test-selinux
...
============ test_misc ==========
ASAN:DEADLYSIGNAL
=================================================================
==2981==ERROR: AddressSanitizer: SEGV on unknown address 0x000041b58ab3 (pc 0x7fd9c55a0eb2 bp 0x7fffdc2f9640 sp 0x7fffdc2f8d68 T0)
#0 0x7fd9c55a0eb1 (/lib64/libasan.so.3+0xdeeb1)
#1 0x7fd9c5550bbf (/lib64/libasan.so.3+0x8ebbf)
#2 0x7fd9c5552cdd in __interceptor_vsnprintf (/lib64/libasan.so.3+0x90cdd)
#3 0x7fd9c5063715 in log_internalv src/basic/log.c:680
#4 0x7fd9c506390a in log_internal src/basic/log.c:697
#5 0x561d398181a2 in test_misc src/test/test-selinux.c:81
#6 0x561d398185e8 in main src/test/test-selinux.c:117
#7 0x7fd9c493a400 in __libc_start_main (/lib64/libc.so.6+0x20400)
#8 0x561d39817859 in _start (/home/vagrant/systemd-asan/.libs/lt-test-selinux+0x1859)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib64/libasan.so.3+0xdeeb1)
==2981==ABORTING
```
-rw-r--r-- | src/test/test-selinux.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/test-selinux.c b/src/test/test-selinux.c index 7545ad3764..b676c25913 100644 --- a/src/test/test-selinux.c +++ b/src/test/test-selinux.c @@ -56,7 +56,7 @@ static void test_loading(void) { n1 = now(CLOCK_MONOTONIC); r = mac_selinux_init(); n2 = now(CLOCK_MONOTONIC); - log_info_errno(r, "mac_selinux_init → %d (%m) %.2fs", r, (n2 - n1)/1e6); + log_info_errno(r, "mac_selinux_init → %d %.2fs (%m)", r, (n2 - n1)/1e6); } static void test_cleanup(void) { @@ -78,18 +78,18 @@ static void test_misc(const char* fname) { log_info("============ %s ==========", __func__); r = mac_selinux_get_our_label(&label); - log_info_errno(r, "mac_selinux_get_our_label → %d (%m), \"%s\"", + log_info_errno(r, "mac_selinux_get_our_label → %d, \"%s\" (%m)", r, strnull(label)); r = mac_selinux_get_create_label_from_exe(fname, &label2); - log_info_errno(r, "mac_selinux_create_label_from_exe → %d (%m), \"%s\"", + log_info_errno(r, "mac_selinux_create_label_from_exe → %d, \"%s\" (%m)", r, strnull(label2)); fd = socket(AF_INET, SOCK_DGRAM, 0); assert_se(fd >= 0); r = mac_selinux_get_child_mls_label(fd, fname, label2, &label3); - log_info_errno(r, "mac_selinux_get_child_mls_label → %d (%m), \"%s\"", + log_info_errno(r, "mac_selinux_get_child_mls_label → %d, \"%s\" (%m)", r, strnull(label3)); } |