Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753229AbcCVWwn (ORCPT ); Tue, 22 Mar 2016 18:52:43 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:49882 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752851AbcCVWwk (ORCPT ); Tue, 22 Mar 2016 18:52:40 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Zhao Lei Cc: , , "'Mateusz Guzik'" , "'Kamezawa Hiroyuki'" References: <77053bb2bdd21489e09b6ef362044d283e1ba12b.1458305141.git.zhaolei@cn.fujitsu.com> <87twk0tlok.fsf@x220.int.ebiederm.org> <00fa01d18341$986e1880$c94a4980$@cn.fujitsu.com> <87shzkqmc8.fsf@x220.int.ebiederm.org> <00fb01d18359$b99df580$2cd9e080$@cn.fujitsu.com> <878u1bo772.fsf@x220.int.ebiederm.org> <010001d183db$7c0ae3e0$7420aba0$@cn.fujitsu.com> Date: Tue, 22 Mar 2016 17:42:41 -0500 In-Reply-To: <010001d183db$7c0ae3e0$7420aba0$@cn.fujitsu.com> (Zhao Lei's message of "Tue, 22 Mar 2016 09:38:06 +0800") Message-ID: <87lh5am8wu.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/lbminfoc10luJxwYoJEZ/sH7GlIjWmfo= X-SA-Exim-Connect-IP: 67.3.249.252 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.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa04 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa04 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Zhao Lei X-Spam-Relay-Country: X-Spam-Timing: total 676 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 3.1 (0.5%), b_tie_ro: 2.3 (0.3%), parse: 0.67 (0.1%), extract_message_metadata: 16 (2.4%), get_uri_detail_list: 2.8 (0.4%), tests_pri_-1000: 6 (0.9%), tests_pri_-950: 0.99 (0.1%), tests_pri_-900: 0.78 (0.1%), tests_pri_-400: 30 (4.5%), check_bayes: 30 (4.4%), b_tokenize: 7 (1.1%), b_tok_get_all: 9 (1.3%), b_comp_prob: 6 (0.9%), b_tok_touch_all: 3.5 (0.5%), b_finish: 0.61 (0.1%), tests_pri_0: 467 (69.1%), check_dkim_signature: 0.42 (0.1%), check_dkim_adsp: 3.1 (0.5%), tests_pri_500: 148 (21.9%), poll_dns_idle: 142 (21.0%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH v2 3/3] Make core_pattern support 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: 4558 Lines: 112 Zhao Lei writes: > Hi, Eric > >> -----Original Message----- >> From: Eric W. Biederman [mailto:ebiederm@xmission.com] >> Sent: Tuesday, March 22, 2016 5:25 AM >> To: Zhao Lei >> Cc: linux-kernel@vger.kernel.org; containers@lists.linux-foundation.org; >> 'Mateusz Guzik' ; 'Kamezawa Hiroyuki' >> >> Subject: Re: [PATCH v2 3/3] Make core_pattern support namespace >> >> Zhao Lei writes: >> >> > Hi, Eric >> > >> >> -----Original Message----- >> >> From: Eric W. Biederman [mailto:ebiederm@xmission.com] >> >> > Let me make a summarize: >> > You think this way is not acceptable, because the pipe program is running >> > in the panic-process's namespace context. >> >> Actually my view is that your patchset is not acceptable because it >> is implemented in a way that is not backwards compatible (AKA it can >> break existing configurations that remain unchanged) and your >> implementation does not appear in the least safe from malicious users. >> >> There is also a problem that your patchset is simply buggy for what it >> tries to implement, as using pid_ns_for_children and the multiple kbuild >> robot emails testifies. >> >> > And in my view, a pipe program in the host's top level namespace is also >> > a problem. >> > >> > Let us think a container, to make it act as a real machine, when a program >> > panic, linux kernel should dump it into the container's filesystem. >> > >> > For the kernel, to keep the current way of forking pipe program by kthread, >> > just let the pipe thread running in the container's namespace, instead the >> host, >> > may solve the problem in current kernel. >> > >> > What is your opinion? >> > >> > Btw, this patch is trying to solve the problem descripted in thread named: >> > "piping core dump to a program escapes container" in >> > >> http://lists.linuxfoundation.org/pipermail/containers/2015-December/036476. >> html >> > Maybe using a userspace tool can make container dump to anywhere, >> > but for kernel ifself, it is better to solve above problem if we can. >> >> I think it would be great to find a way to run a core dump helper and >> otherwise allow setting the core dump pattern in a container in a way >> that is safe from malicious users and does not break existing setups. >> > So, there is following problem: > 1: safe from malicious users > We can try to find a way to fork process which have no relationship > with the panic process. > 2: Bug in patch > It can be fixed, but I'd rather get a conclusion of this discussion > before fix. > 3: Backwards compatible > It maybe the biggest problem in discussion, this patch is used to let > container dump files into container, it is different with current action. > Before patch: > File type dump_pattern: dump to container > Pipe type dump_pattern: dump to host > After patch: > File type dump_pattern: dump to container > Pipe type dump_pattern: dump to container > The second design seems better but not compatible with current kernel, > but this patch can not fix to keep compatible because it is the patch's > function. > Maybe we can make some workagound, as: > a. Add a kernel config to let the old style as default. > b. keep old style, and add "||" for core_pattern, as > echo "|| /root/container_dumper" >/proc/sys/kernel/core_pattern > to dump to container. > > What is your opinion about it? There are two parts to backwards compatibility. 1) How should core patterns that are set outside of any container be treated? The patchset under discussion imported core patterns set outside of containers into containers completely trivially changing their behavior and breaking backwards compatibility. That is just not acceptable. 2) How should core patterns inside of containers be treated? There are corner cases that I am not thinking of that will cause regressions but I think we can reasonably assume that core patterns are not set inside of containers today. Assuming that is true, then setting a core pattern inside of a container is the only thing that the kernel needs to detect to handle working inside of a container. The practical question I see for this case is which parent process needs to be used for your core dump helper, and which set of namespaces that parent helper has. I will also remind people thinking about these issues that containers can be run recursisvely. Eric