Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1255254 > unrolled thread
| Started by | Shayan Pooya <shayan@liveve.org> |
|---|---|
| First post | 2015-10-25 00:00 +0200 |
| Last post | 2015-11-05 05:50 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
piping core dump to a program escapes container Shayan Pooya <shayan@liveve.org> - 2015-10-25 00:00 +0200
Re: piping core dump to a program escapes container Richard Weinberger <richard.weinberger@gmail.com> - 2015-11-01 21:30 +0100
Re: piping core dump to a program escapes container Shayan Pooya <shayan@liveve.org> - 2015-11-05 05:50 +0100
| From | Shayan Pooya <shayan@liveve.org> |
|---|---|
| Date | 2015-10-25 00:00 +0200 |
| Subject | piping core dump to a program escapes container |
| Message-ID | <qnf11-4vk-17@gated-at.bofh.it> |
I noticed the following core_pattern behavior in my linux box while running docker containers. I am not sure if it is bug, but it is inconsistent and not documented. If the core_pattern is set on the host, the containers will observe and use the pattern for dumping cores (there is no per cgroup core_pattern). According to core(5) for setting core_pattern one can: 1. echo "/tmp/cores/core.%e.%p" > /proc/sys/kernel/core_pattern 2. echo "|/bin/custom_core /tmp/cores/ %e %p " > /proc/sys/kernel/core_pattern The former pattern evaluates the /tmp/cores path in the container's filesystem namespace. Which means, the host does not see a core file in /tmp/cores. However, the latter evaluates the /bin/custom_core path in the global filesystem namespace. Moreover, if /bin/core decides to write the core to a path (/tmp/cores in this case as shown by the arg to custom_core), the path will be evaluated in the global filesystem namespace as well. The latter behaviour is counter-intuitive and error-prone as the container can fill up the core-file directory which it does not have direct access to (which means the core is also not accessible for debugging if someone only has access to the container). Currently, I work around this issue by detecting that the process is crashing from a container (by comparing the namespace pid to the global pid) and refuse to dump the core if it is from a container. Tested on Ubuntu (kernel 3.16) and Fedora (kernel 4.1). -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Richard Weinberger <richard.weinberger@gmail.com> |
|---|---|
| Date | 2015-11-01 21:30 +0100 |
| Message-ID | <qq7qi-4uL-11@gated-at.bofh.it> |
| In reply to | #1255254 |
On Sat, Oct 24, 2015 at 11:54 PM, Shayan Pooya <shayan@liveve.org> wrote: > I noticed the following core_pattern behavior in my linux box while > running docker containers. I am not sure if it is bug, but it is > inconsistent and not documented. > > If the core_pattern is set on the host, the containers will observe > and use the pattern for dumping cores (there is no per cgroup > core_pattern). According to core(5) for setting core_pattern one can: > > 1. echo "/tmp/cores/core.%e.%p" > /proc/sys/kernel/core_pattern > 2. echo "|/bin/custom_core /tmp/cores/ %e %p " > /proc/sys/kernel/core_pattern > > The former pattern evaluates the /tmp/cores path in the container's > filesystem namespace. Which means, the host does not see a core file > in /tmp/cores. > > However, the latter evaluates the /bin/custom_core path in the global > filesystem namespace. Moreover, if /bin/core decides to write the core > to a path (/tmp/cores in this case as shown by the arg to > custom_core), the path will be evaluated in the global filesystem > namespace as well. > > The latter behaviour is counter-intuitive and error-prone as the > container can fill up the core-file directory which it does not have > direct access to (which means the core is also not accessible for > debugging if someone only has access to the container). > > Currently, I work around this issue by detecting that the process is > crashing from a container (by comparing the namespace pid to the > global pid) and refuse to dump the core if it is from a container. IMHO this is another example of the question whether a container should be a full blown Linux system or not. In your opinion containers should own core_pattern and be able to install their own dump helpers. Currently this is not the case as this is setting is only writable by the global root. Others might argue that containers are not a full virtual Linux with all features and an administrator may want to collect cores from all containers. -- Thanks, //richard -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Shayan Pooya <shayan@liveve.org> |
|---|---|
| Date | 2015-11-05 05:50 +0100 |
| Message-ID | <qrkEO-1Qt-3@gated-at.bofh.it> |
| In reply to | #1260230 |
On Sun, Nov 1, 2015 at 12:25 PM, Richard Weinberger <richard.weinberger@gmail.com> wrote: > On Sat, Oct 24, 2015 at 11:54 PM, Shayan Pooya <shayan@liveve.org> wrote: >> I noticed the following core_pattern behavior in my linux box while >> running docker containers. I am not sure if it is bug, but it is >> inconsistent and not documented. >> >> If the core_pattern is set on the host, the containers will observe >> and use the pattern for dumping cores (there is no per cgroup >> core_pattern). According to core(5) for setting core_pattern one can: >> >> 1. echo "/tmp/cores/core.%e.%p" > /proc/sys/kernel/core_pattern >> 2. echo "|/bin/custom_core /tmp/cores/ %e %p " > /proc/sys/kernel/core_pattern >> >> The former pattern evaluates the /tmp/cores path in the container's >> filesystem namespace. Which means, the host does not see a core file >> in /tmp/cores. >> >> However, the latter evaluates the /bin/custom_core path in the global >> filesystem namespace. Moreover, if /bin/core decides to write the core >> to a path (/tmp/cores in this case as shown by the arg to >> custom_core), the path will be evaluated in the global filesystem >> namespace as well. >> >> The latter behaviour is counter-intuitive and error-prone as the >> container can fill up the core-file directory which it does not have >> direct access to (which means the core is also not accessible for >> debugging if someone only has access to the container). >> >> Currently, I work around this issue by detecting that the process is >> crashing from a container (by comparing the namespace pid to the >> global pid) and refuse to dump the core if it is from a container. > > IMHO this is another example of the question whether a container should > be a full blown Linux system or not. I'd like to use containers as a way for separating concerns (IMHO this is a popular use case for the containers, e.g. redhat's openshift). The processes running inside a namespace should be that namespace's problem. > In your opinion containers should own core_pattern and be able to install > their own dump helpers. Well, it is not just my opinion. That's the default behaviour for when you don't use a pipe in the core_pattern. The reason I'd say it is a bug is because the two options are not consistent. > Currently this is not the case as this is setting is only writable by > the global root. > Others might argue that containers are not a full virtual Linux with > all features and > an administrator may want to collect cores from all containers. I agree there are some value in the admin getting a notification if they choose to. The problem is that there is no clean mechanism for the admin to send the core dump back to the namespace of the process. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web