Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756421AbbLWDU4 (ORCPT ); Tue, 22 Dec 2015 22:20:56 -0500 Received: from cn.fujitsu.com ([59.151.112.132]:26449 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1755168AbbLWDUx (ORCPT ); Tue, 22 Dec 2015 22:20:53 -0500 X-IronPort-AV: E=Sophos;i="5.20,346,1444665600"; d="scan'208";a="1881462" Message-ID: <567A1120.3070204@cn.fujitsu.com> Date: Wed, 23 Dec 2015 11:12:32 +0800 From: Dongsheng Yang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: "Eric W. Biederman" CC: Al Viro , , LKML , , Kamezawa Hiroyuki Subject: Re: [Propose] Isolate core_pattern in mnt namespace. References: <56729B3D.1040502@cn.fujitsu.com> <56760F05.3020308@cn.fujitsu.com> <20151220023712.GT20997@ZenIV.linux.org.uk> <567616D6.6060202@cn.fujitsu.com> <87fuyx1mfn.fsf@x220.int.ebiederm.org> <567798EC.1040304@cn.fujitsu.com> <87twnbzcz8.fsf@x220.int.ebiederm.org> In-Reply-To: <87twnbzcz8.fsf@x220.int.ebiederm.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.167.226.66] X-yoursite-MailScanner-ID: DD4CB41887DF.AB6A5 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: yangds.fnst@cn.fujitsu.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4612 Lines: 117 On 12/22/2015 05:52 AM, Eric W. Biederman wrote: > Dongsheng Yang writes: > >> On 12/20/2015 05:47 PM, Eric W. Biederman wrote: >>> Dongsheng Yang writes: >>> >>>> On 12/20/2015 10:37 AM, Al Viro wrote: >>>>> On Sun, Dec 20, 2015 at 10:14:29AM +0800, Dongsheng Yang wrote: >>>>>> On 12/17/2015 07:23 PM, Dongsheng Yang wrote: >>>>>>> Hi guys, >>>>>>> We are working on making core dump behaviour isolated in >>>>>>> container. But the problem is, the /proc/sys/kernel/core_pattern >>>>>>> is a kernel wide setting, not belongs to a container. >>>>>>> >>>>>>> So we want to add core_pattern into mnt namespace. What >>>>>>> do you think about it? >>>>>> >>>>>> Hi Eric, >>>>>> I found your patch about "net: Implement the per network namespace >>>>>> sysctl infrastructure", I want to do the similar thing >>>>>> in mnt namespace. Is that suggested way? >>>>> >>>>> Why mnt namespace and not something else? >>>> >>>> Hi Al, >>>> >>>> Well, because core_pattern indicates the path to store core file. >>>> In different mnt namespace, we would like to change the path with >>>> different value. >>>> >>>> In addition, Let's considering other namespaces: >>>> UTS ns: contains informations of kernel and arch, not proper for core_pattern. >>>> IPC ns: communication informations, not proper for core_pattern >>>> PID ns: core_pattern is not related with pid >>>> net ns: obviousely no. >>>> user ns: not proper too. >>>> >>>> Then I believe it's better to do this in mnt namespace. of course, >>>> core_pattern is just one example. After this infrastructure finished, >>>> we can implement more sysctls as per-mnt if necessary, I think. >>>> >>>> Al, what do you think about this idea? >>> >>> The hard part is not the sysctl. The hard part is starting the usermode >>> helper, in an environment that it can deal with. The mount namespace >>> really provides you with no help there. >> >> Do you mean the core dump helper? But I think I don't want to touch it >> in my development. I think I can use non-pipe way to get what I want, >> Let me try to explain what I want here. >> >> (1). introduce a --core-path option in docker run command to specify the >> path in host to store core file in one container. >> E.g: docker run --core-path=/core/test --name=test IMAGE >> >> (2). When the container starting, docker attach a volume to it, similar >> with "-v /core/test:/var/lib/docker/coredump". That means, the path of >> /var/lib/docker/coredump in container is a link to /core/test in host. >> >> (3). Set the /proc/sys/kernel/core_pattern in container as >> "/var/lib/docker/coredump". But that should not affect the core_pattern >> in host or other containers. >> >> Then I think I can collect the core files from each container and save >> them in the paths where I want. > > For your case that sounds like it would work. Unfortunately for this to > be generally applicable and to let the OS in the contianer control it's > fate the core dump pattern needs to be supported. > > Otherwise something clever in userspace that can be written now should > be sufficient to fill the gap. There is enough information for the user > mode helper to implement the policy you would like today. Hi Eric, To make sure I understand your point correctly: Do you mean we can write a userspace helper in host such as /usr/libexec/docker-pipe to get what I want? Yes, I would say, for my case, it would work. This helper can get the dump data from containers and dispatch them to different path such as /var/lib/docker/cores//. But there would be two problems in this solution. (1). It may affect core dump on host. Normally, other processes in host would not be happy to use a helper of docker-pipe for themselves. But host have to share the core_pattern with containers, can't config it by itself. (2). If there are some containers don't want to pass the core files to host, they can't set the core_pattern in this solution. IMO, we can get core files on host currently, by either non-pipe way I described above or the pipe way you suggested. But the problem is both of these methods would affect the core_pattern on host and other containers. So, I think the key point here is just isolating the core dump related sysctl in mnt namespace. Thanx Yang > > Eric > > > . > -- 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/