[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <878tygfzn0.fsf@x220.int.ebiederm.org>
Date: Tue, 07 Jun 2016 16:38:27 -0500
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Mateusz Guzik <mguzik@...hat.com>
Cc: Zhao Lei <zhaolei@...fujitsu.com>, linux-kernel@...r.kernel.org,
containers@...ts.linux-foundation.org,
Kamezawa Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Subject: Re: [PATCH v2 3/3] Write dump into container's filesystem for pipe_type core_pattern
Mateusz Guzik <mguzik@...hat.com> writes:
> On Tue, Jun 07, 2016 at 07:29:37PM +0800, Zhao Lei wrote:
>> In current system, when we set core_pattern to a pipe, both pipe program
>> and program's output are in host's filesystem.
>> But when we set core_pattern to a file, the container will write dump
>> into container's filesystem.
>>
>> For example, when we set following core_pattern:
>> # echo "|/my_dump_pipe %s %c %p %u %g %t e" >/proc/sys/kernel/core_pattern
>> and trigger a segment fault in a container, my_dump_pipe is searched from
>> host's filesystem, and it will write coredump into host's filesystem too.
>>
>> In a privileged container, user can destroy host system by following
>> command:
>> # # In a container
>> # echo "|/bin/dd of=/boot/vmlinuz" >/proc/sys/kernel/core_pattern
>> # make_dump
>>
>> Actually, all operation in a container should not change host's
>> environment, the container should use core_pattern as its private setting.
>> In detail, in core dump action:
>> 1: Search pipe program in container's fs namespace.
>> 2: Run pipe program in container's fs namespace to write coredump to it.
>>
>> This patch fixed above problem by running pipe program with container's
>> fs_root.
>>
>
> This does not look sufficient, but I can't easily verify.
>
> For instance, is the spawned process able to attach itself with ptrace
> to processes outside of the original container? Even if not, can it
> mount procfs and use /proc/pid/root of processes outside of said
> container?
>
> The spawned process should be subject to all limitations imposed on the
> container (which may mean it just must be in the container).
Pretty much.
The most constructive suggestion I have seen is to have the containers
init process logically fork in the kernel and spawn a process that way.
Anything that uses call_usermodehelper is trivially not safe because
of these concerns.
Eric
Powered by blists - more mailing lists