Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp883891imm; Thu, 31 May 2018 11:04:15 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIhFkjioLSdBVve51Ms7ISb8IpMQHghypLHHPS6QIPaw0Fa9mWiYrdWrIFSPPnOFge2Ku0G X-Received: by 2002:a17:902:1004:: with SMTP id b4-v6mr7817318pla.82.1527789855405; Thu, 31 May 2018 11:04:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527789855; cv=none; d=google.com; s=arc-20160816; b=wn4ffGtojnGXXhEYTFdQbSLeojsM7anb0j7rNhraNVZXYQ2Mrez2nu/EQU6ViGiMSu VXFCCjVGYZydgvJVqA3agClnNckuAe9lStkuUg8vwFtMi87nPXnsiqW4Z9/ByQ1eSAgf wXkODnB4wjw1DYJoqidRe3fVW/7FI+61djXcES3kKm7YB3ncpGJqW753E9rhnLUpusrE 6tDxnnnSABbASRLz15BrHcByCiy8ylyO5V9rGzFmhCEHmMaH9ym5lXMf5aKB/0a5EBNu nlMGNSJjAlopxaDy4iu+x1t43MePPEYUA/wv1FIByBLUR43BnEagBaPpCMBbuWBup8aU ODhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:mime-version:user-agent :message-id:in-reply-to:date:references:cc:to:from :arc-authentication-results; bh=NY0JPDhQmu+WE67fEgwNb0FGD3rzWRMk8dx3cnfZqcQ=; b=qGRNcPK+qMkOi0mCSkBa5zcJV/wg4vfLTC37DEz6WhSgMuliajKp2pAZsdbbyiIaoc u1oIJu2JNutK9jj1oCjfO6SeEYL4B82WHmFnjzkNCeWRqfnazFb9efTj9P7/5K/hQMEG Zho2jqiKQ/Wn5bWr0YWSM1QlLoRs/O1c0CuTIlBLKfl9LnPhDNnREO9XsYIYG1FYF5ES juXi7c4sZCWBLwGXoahggo9NE5wDAES6oTT5CR5hE2ZaDOrNWBfUuGREZqrXcBlNhxtC CGfUpnMqOnfUUnrT1fyiFLEVwx8LZbJjep6HlmM3wS99AQglYxPf+VqDGjj61xK8lVh3 cZ7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 60-v6si7632595ple.65.2018.05.31.11.04.01; Thu, 31 May 2018 11:04:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756053AbeEaSDB (ORCPT + 99 others); Thu, 31 May 2018 14:03:01 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:59814 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755879AbeEaSCz (ORCPT ); Thu, 31 May 2018 14:02:55 -0400 Received: from in02.mta.xmission.com ([166.70.13.52]) by out02.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fORuY-0000uD-KV; Thu, 31 May 2018 12:02:54 -0600 Received: from 97-119-124-205.omah.qwest.net ([97.119.124.205] helo=x220.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fORuJ-000223-8P; Thu, 31 May 2018 12:02:54 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: "Michael Kerrisk \(man-pages\)" Cc: Konstantin Khlebnikov , Nagarathnam Muthusamy , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, Jann Horn , Serge Hallyn , Oleg Nesterov , Andy Lutomirski , Prakash Sangappa , Andrew Morton References: <152286911105.615669.14053871624892399807.stgit@buzz> <87h8oqhagl.fsf@xmission.com> <112c7cac-1982-3a2e-ffc0-878bc5ae4bb6@yandex-team.ru> <71d8d32b-0f59-d418-0ee4-fcc7782646ae@gmail.com> Date: Thu, 31 May 2018 13:02:33 -0500 In-Reply-To: <71d8d32b-0f59-d418-0ee4-fcc7782646ae@gmail.com> (Michael Kerrisk's message of "Fri, 27 Apr 2018 14:15:01 +0200") Message-ID: <871sdrem9y.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1fORuJ-000223-8P;;;mid=<871sdrem9y.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=97.119.124.205;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX19WchxKttDi/S7kD0ycYLhtnoaRbn2X8TM= X-SA-Exim-Connect-IP: 97.119.124.205 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa07.xmission.com X-Spam-Level: X-Spam-Status: No, score=-0.2 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,TVD_RCVD_IP,T_TM2_M_HEADER_IN_MSG autolearn=disabled version=3.4.1 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.4999] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;"Michael Kerrisk \(man-pages\)" X-Spam-Relay-Country: X-Spam-Timing: total 15033 ms - load_scoreonly_sql: 0.83 (0.0%), signal_user_changed: 6 (0.0%), b_tie_ro: 3.2 (0.0%), parse: 0.96 (0.0%), extract_message_metadata: 17 (0.1%), get_uri_detail_list: 2.4 (0.0%), tests_pri_-1000: 4.9 (0.0%), tests_pri_-950: 1.71 (0.0%), tests_pri_-900: 1.43 (0.0%), tests_pri_-400: 30 (0.2%), check_bayes: 29 (0.2%), b_tokenize: 12 (0.1%), b_tok_get_all: 8 (0.1%), b_comp_prob: 3.7 (0.0%), b_tok_touch_all: 2.9 (0.0%), b_finish: 0.72 (0.0%), tests_pri_0: 205 (1.4%), check_dkim_signature: 0.82 (0.0%), check_dkim_adsp: 3.7 (0.0%), tests_pri_500: 14760 (98.2%), poll_dns_idle: 14752 (98.1%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH RFC v5] pidns: introduce syscall translate_pid X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "Michael Kerrisk (man-pages)" writes: > On 04/05/2018 09:02 AM, Konstantin Khlebnikov wrote: >> On 05.04.2018 01:29, Eric W. Biederman wrote: >>> Nagarathnam Muthusamy writes: >>> >>>> On 04/04/2018 12:11 PM, Konstantin Khlebnikov wrote: >>>>> Each process have different pids, one for each pid namespace it belongs. >>>>> When interaction happens within single pid-ns translation isn't required. >>>>> More complicated scenarios needs special handling. >>>>> >>>>> For example: >>>>> - reading pid-files or logs written inside container with pid namespace >>>>> - attaching with ptrace to tasks from different pid namespace >>>>> - passing pids across pid namespaces in any kind of API >>>>> >>>>> Currently there are several interfaces that could be used here: >>>>> >>>>> Pid namespaces are identified by inode number of /proc/[pid]/ns/pid. >>> >>> Using the inode number in interfaces is not an option. Especially not >>> withou referencing the device number for the filesystem as well. >> >> This is supposed to be single-instance fs, >> not part of proc but referenced but its magic "symlinks". >> >> Device numbers are not mentioned in "man namespaces". > > Thanks for the heads-up! > > That was a bug in the man-page. ioctl_ns(2) already says the right thing. > Now I patches namespaces(7), as below. Acked-by: "Eric W. Biederman" For the changes to namespaces.7. I suspect you have already applied them by now, but if not. Eric > Cheers, > > Michael > > diff --git a/man7/namespaces.7 b/man7/namespaces.7 > index 725ebaff6..3c155de7e 100644 > --- a/man7/namespaces.7 > +++ b/man7/namespaces.7 > @@ -154,11 +154,14 @@ In Linux 3.7 and earlier, these files were visible as hard links. > Since Linux 3.8, > .\" commit bf056bfa80596a5d14b26b17276a56a0dcb080e5 > they appear as symbolic links. > -If two processes are in the same namespace, then the inode numbers of their > +If two processes are in the same namespace, > +then the device IDs and inode numbers of their > .IR /proc/[pid]/ns/xxx > symbolic links will be the same; an application can check this using the > +.I stat.st_dev > +and > .I stat.st_ino > -field returned by > +fields returned by > .BR stat (2). > The content of this symbolic link is a string containing > the namespace type and inode number as in the following example: