|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
From 79efa8e7ab4282c8c5e3a917531d5c42452377a5 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
From: Evgeny Vereshchagin <evvers@ya.ru>
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
Date: Tue, 31 Jan 2017 19:04:20 +0300
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
Subject: [PATCH] coredump: really extract container cmdline (#5167)
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
Fixes:
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
```
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
root# systemd-nspawn -D ./cont/ --register=no /bin/sh -c '/bin/sh -c "kill -ABRT \$\$"'
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
...
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
Container cont failed with error code 134.
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
root# journalctl MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1 -o verbose | grep -i container_cmdline
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
...prints nothing...
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
...should be COREDUMP_CONTAINER_CMDLINE=systemd-nspawn -D ./cont/ --register=no /bin/sh -c /bin/sh -c "kill -ABRT \$\$"
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
```
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
Also, fixes CID #1368263
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
```
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
==352== 130 bytes in 1 blocks are definitely lost in loss record 1 of 2
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
==352== at 0x4C2ED5F: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
==352== by 0x4ED8581: greedy_realloc (alloc-util.c:57)
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
==352== by 0x4ECAAD5: get_process_cmdline (process-util.c:147)
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
==352== by 0x10E385: get_process_container_parent_cmdline (coredump.c:645)
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
==352== by 0x112949: process_kernel (coredump.c:1240)
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
==352== by 0x113003: main (coredump.c:1297)
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
==352==
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
```
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
(cherry picked from commit d3cba4eaf618ced1935a96e721b2fbcbad7694bb)
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
---
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
src/coredump/coredump.c | 6 +++++-
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
index 6bd0e925eb..1c5e72c835 100644
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
--- a/src/coredump/coredump.c
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
+++ b/src/coredump/coredump.c
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
@@ -642,7 +642,11 @@ static int get_process_container_parent_cmdline(pid_t pid, char** cmdline) {
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
if (r < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
return r;
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
- return get_process_cmdline(container_pid, 0, false, cmdline);
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
+ r = get_process_cmdline(container_pid, 0, false, cmdline);
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
+ if (r < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
+ return r;
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
+
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
+ return 1;
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
}
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
|
|
Zbigniew Jędrzejewski-Szmek |
5d6eed |
static int change_uid_gid(const char *context[]) {
|