Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752518AbbLUWBd (ORCPT ); Mon, 21 Dec 2015 17:01:33 -0500 Received: from out02.mta.xmission.com ([166.70.13.232]:47393 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752476AbbLUWBa (ORCPT ); Mon, 21 Dec 2015 17:01:30 -0500 From: ebiederm@xmission.com (Eric W. Biederman) To: Dongsheng Yang Cc: Al Viro , , LKML , , Kamezawa Hiroyuki 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> Date: Mon, 21 Dec 2015 15:52:11 -0600 In-Reply-To: <567798EC.1040304@cn.fujitsu.com> (Dongsheng Yang's message of "Mon, 21 Dec 2015 14:15:08 +0800") Message-ID: <87twnbzcz8.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-AID: U2FsdGVkX1+O5NbhbM+Uib3QK5mzEdTv+aXakn6vzFQ= X-SA-Exim-Connect-IP: 97.121.81.63 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4978] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa03 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa03 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Dongsheng Yang X-Spam-Relay-Country: X-Spam-Timing: total 861 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 3.8 (0.4%), b_tie_ro: 2.7 (0.3%), parse: 1.31 (0.2%), extract_message_metadata: 27 (3.1%), get_uri_detail_list: 4.0 (0.5%), tests_pri_-1000: 8 (0.9%), tests_pri_-950: 2.1 (0.2%), tests_pri_-900: 1.61 (0.2%), tests_pri_-400: 43 (5.0%), check_bayes: 41 (4.7%), b_tokenize: 14 (1.7%), b_tok_get_all: 14 (1.7%), b_comp_prob: 5 (0.6%), b_tok_touch_all: 2.8 (0.3%), b_finish: 0.85 (0.1%), tests_pri_0: 760 (88.3%), check_dkim_signature: 0.86 (0.1%), check_dkim_adsp: 4.5 (0.5%), tests_pri_500: 8 (0.9%), rewrite_mail: 0.00 (0.0%) Subject: Re: [Propose] Isolate core_pattern in mnt namespace. X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Wed, 24 Sep 2014 11:00:52 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3384 Lines: 79 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. 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/