From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934457AbbI1RFU (ORCPT ); Mon, 28 Sep 2015 13:05:20 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:51756 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934418AbbI1RFE (ORCPT ); Mon, 28 Sep 2015 13:05:04 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Konstantin Khlebnikov Cc: linux-api@vger.kernel.org, containers@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Roman Gushchin , Serge Hallyn , Oleg Nesterov , Chen Fan , Andrew Morton , Linus Torvalds , =?utf-8?Q?St=C3=A9phane?= Graber References: <20150925135246.27620.97496.stgit@buzz> <20150925135247.27620.37109.stgit@buzz> Date: Mon, 28 Sep 2015 11:57:39 -0500 In-Reply-To: <20150925135247.27620.37109.stgit@buzz> (Konstantin Khlebnikov's message of "Fri, 25 Sep 2015 16:52:47 +0300") Message-ID: <87d1x25vng.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/T3z3CODh45KCXy9in6BpzytUQDwcjK3I= X-SA-Exim-Connect-IP: 67.3.201.231 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 * [sa05 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa05 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Konstantin Khlebnikov X-Spam-Relay-Country: X-Spam-Timing: total 652 ms - load_scoreonly_sql: 0.06 (0.0%), signal_user_changed: 5 (0.8%), b_tie_ro: 3.9 (0.6%), parse: 1.40 (0.2%), extract_message_metadata: 12 (1.9%), get_uri_detail_list: 2.1 (0.3%), tests_pri_-1000: 4.1 (0.6%), tests_pri_-950: 1.00 (0.2%), tests_pri_-900: 0.77 (0.1%), tests_pri_-400: 18 (2.8%), check_bayes: 17 (2.7%), b_tokenize: 4.7 (0.7%), b_tok_get_all: 6 (0.9%), b_comp_prob: 1.69 (0.3%), b_tok_touch_all: 3.1 (0.5%), b_finish: 0.69 (0.1%), tests_pri_0: 599 (91.9%), tests_pri_500: 6 (0.9%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH RFC v3 2/2] pidns: introduce syscall getvpid 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 Konstantin Khlebnikov writes: > If pid is negative then getvpid() returns pid of parent task for -pid. Now that I am noticing this. I don't think I have seen any discussion about justifying a syscall getting another processes parent pid. My apologies if I just missed it. Why do we want the the parent pid? We can we usefully do with it? Is proc really that bad of an interface? Fetching a parent pid feels like a separate logical operation from pid translation. Which makes me a bit uneasy about this part of the conversation. > Examples: > getvpid(pid, ns, -1) - get pid in our pid namespace > getvpid(pid, -1, ns) - get pid in container > getvpid(pid, -1, ns) > 0 - is pid is reachable from container? > getvpid(1, ns1, ns2) > 0 - is ns1 inside ns2? > getvpid(1, ns1, ns2) == 0 - is ns1 outside ns2? > getvpid(1, ns, -1) - get init task of pid-namespace > getvpid(-1, ns, -1) - get reaper of init task in parent pid-namespace > getvpid(-pid, -1, -1) - get ppid by pid As I step back and pay attention to this case I am half wondering if perhaps what would be most useful is a file descriptor that refers to a pid and an updated set of system calls that takes pid file descriptors instead of pids. Something like: getpidfd(int pidnsfd, pid_t pid); waitfd(int pidfd, int *status, int options, struct rusage *rusage); killfd(int pidfd, int sig); clonefd(...); And perhaps: pid_nr_ns(int pidnsfd, int pidfd); parentfd(int pidfd); Eric