Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932842AbdCaJpw (ORCPT ); Fri, 31 Mar 2017 05:45:52 -0400 Received: from mail-eopbgr30127.outbound.protection.outlook.com ([40.107.3.127]:64287 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932316AbdCaJps (ORCPT ); Fri, 31 Mar 2017 05:45:48 -0400 Authentication-Results: hallyn.com; dkim=none (message not signed) header.d=none;hallyn.com; dmarc=none action=none header.from=virtuozzo.com; Subject: Re: [PATCH RESEND 2/2] pidns: Expose task pid_ns_for_children to userspace To: Andrei Vagin , Andrew Morton References: <149086931397.4388.9604947335273204415.stgit@localhost.localdomain> <149086967937.4388.471494976517194744.stgit@localhost.localdomain> <20170330150520.1bdf20e599ff464bda0776b9@linux-foundation.org> <20170331010409.GA22895@outlook.office365.com> CC: , , , , , , , , , , , , , From: Kirill Tkhai Message-ID: <0825f166-6f20-59a9-45a9-5ffe9009150e@virtuozzo.com> Date: Fri, 31 Mar 2017 12:45:40 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170331010409.GA22895@outlook.office365.com> Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1P190CA0018.EURP190.PROD.OUTLOOK.COM (10.172.123.28) To DB6PR0802MB2277.eurprd08.prod.outlook.com (10.172.227.150) X-MS-Office365-Filtering-Correlation-Id: 3b6dd50c-2bd4-485a-4430-08d4781ab3ee X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:DB6PR0802MB2277; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0802MB2277;3:B1FOXWBOPAqAvoE+AILGnImWleGFNo+IWqx6qT2U25sC7wNaJ/6e/m5ogrypbMk/X7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2pS0EZqhHPo/PXS3ER/Iew0qlsN7MRQc7OuNy0GM6ZiYNr/A/t2Cw0WSXMF29NaIWJpFLXrqMbZSaqiaCWSbgLvoJO6/AqVIFb51vWM/T2f74jLc49BgQ6AhuimDAJDdlxGuCk3I+8OIw/G4LX+qrPz7y5uAm596W0CzjxTnFgpeTh0x9UQiFukIqgf0jEpn47vbUlm5YoJ6aCL5KRsuH4fLojAWGsdusNWWbDMXS+3TI3bsBUARoH43Dm0Na18fmgjfZUu4qnlVV1l3axP0ehWXa2CzFpOOXlr0+a2si7O8vW2+KEc8Ohji2+0Ts7HwoWwwC0t7aN6/qd7lpnEyR0d6k0Qnm9We+21t3/VfFRnuAEubTpWI= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(84791874153150); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(6041248)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(20161123555025)(20161123560025)(20161123564025)(6072148);SRVR:DB6PR0802MB2277;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0802MB2277; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0802MB2277;4:Nt74b4QVQ+9hF2O0dGfPXk6hHkKfpWkuFn49Hi2Q/HOWM1niiG2Qsh5KUSnn2BoHtnzCD687t4DVfBoY6MHMJoGwVzbnT3Zu42mZ0Xwqsb+gukAnUYgv3wouyFvPBck2+JindKG+68dIzM7Obyh1Q9vGWEM+AqM0wjamqLB96a6xkMoim683jHG56K1c2PVNvCGR7gghKZRodQX+Jo5HyZQJ6dTLrkThGz8RHTLS3QGiPWAD4NH6ibLDJqKWjTIZkPK3dX4F720zWFZ//N95vjY0/eTPHIYnVlxWVXGIIowhRjcFEHCVNmfrSYkqf1oO/ohYiwxtkPTiAvl5j5wCp20Z9w4tSS6ba8tHZUzG56Ye5V7LuacKLuoJkd1W+3IqaFdT6SZpfp/5C9J1zk20MZdQ2+tYeyi+FN/6rjELO8hGQqSe9EsH35fVcQ3PWZ+vJtmVSQPHsggK+ogklWh4Ccud3t0LH/rThpa4uQJzo1ysnMsNpsE5g/7igbHDuBtKBHH+KnLCPyMP2mW70WHOLIekAh4IxE4LNCqyrhM8CkTPc81DIza3GQ57hNsMpqFfyF79TFkRdHL7p2cq199raLiZ3mE53bayUomu9VGYrxHHvbnIzLParUY7oPKyQ6sg9//c53qtkK9ehgi0hjCncExxEMKmYiRoVOowmQnHlrz4es1V+lLcTc0UKl/iknlREec2vRFWcJNJV68c/hqAq0XYCHKT6tk5mBnctU9t+PaCYbztFlVzF4o7KTwQ8HTANZdPvggaxMdBemnnWV8qJw== X-Forefront-PRVS: 02638D901B X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6049001)(6009001)(39830400002)(39450400003)(39400400002)(39410400002)(24454002)(53936002)(36756003)(50466002)(4326008)(47776003)(230700001)(189998001)(7416002)(25786009)(6306002)(6486002)(53546009)(54906002)(229853002)(2950100002)(6246003)(83506001)(65826007)(86362001)(38730400002)(23686003)(77096006)(31696002)(90366009)(81166006)(2906002)(8676002)(4001350100001)(6116002)(7736002)(3846002)(50986999)(54356999)(305945005)(76176999)(93886004)(5660300001)(31686004)(33646002)(42186005)(64126003)(65806001)(66066001)(65956001)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DB6PR0802MB2277;H:[172.16.25.3];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?koi8-r?Q?1;DB6PR0802MB2277;23:Y/Gkt3ZSVUt7TN8eQUSIvEVEQ9JVA4x9NwAz4W5iO?= =?koi8-r?Q?uHcqNkcvuQ1fop31KFocRwH+cBUU//D0byIdK04TFIBV32QydIWhLUPNaAL1RM?= =?koi8-r?Q?0pJBRONVJOGrIQq3z6STl4xrStlz7LPxLzWUDqp/EOsHV4+ajB/nuLYvCHgBHZ?= =?koi8-r?Q?BdC6maSYsHIfKD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ange-Diagnostics: 1;DB6PR0802MB2277;7:DEGhrwGqFHc6BXL0Nb9NvZ4SdGGgiV6GFy7KB3VK9oN1pdk+P3xlT2mG6DrW2NXwwsjUUWADge8uRJ3rCydMPx5fcjLT14rxXh4714XT01hVZA/qVIi7nFZG27aLw0TwGv2fWFj0pyo73JN6n0X7OTsNETQqRtVLEeM8JgACh8QHj3h4h3X/cXryhwOX7LEAq0LP9aHfqYY52c8uleI2KiZvFFoJcxrW0LprRJo/AevscIV+/mJOpey3Hd0W9l01hJiw/4aMhy+F9hAii6R1BS/jHNKzAPXCMUN9SrxCdl00gJoJFI5mnO2JTiy1FjGKIlVszrY0+gbvTk/h+I/Kvw==;20:ZXAGNN8qk/UJEE5pfYcwYKGLkNxW8rneqgUPU9/mJC4dDXWUh23aVQFRhoxuP6jlTBtl2BrBox9lL1iHESV2xUVDtOIH8TZ3lSWlxBUtuSAnjZsuCuWDg/N4DdeednjT0QxsiiUFlGafU31+Np6bWDUNEGUnkVZeM66ctMGiwAA= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2017 09:45:43.1327 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2277 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3101 Lines: 72 On 31.03.2017 04:04, Andrei Vagin wrote: > On Thu, Mar 30, 2017 at 03:05:20PM -0700, Andrew Morton wrote: >> On Thu, 30 Mar 2017 13:27:59 +0300 Kirill Tkhai wrote: >> >>> pid_ns_for_children set by a task is known only to the task itself, >>> and it's impossible to identify it from outside. >>> >>> It's a big problem for checkpoint/restore software like CRIU, >>> because it can't correctly handle tasks, that do setns(CLONE_NEWPID) >>> in proccess of their work. >>> >>> This patch solves the problem, and it exposes pid_ns_for_children >>> to ns directory in standard way with the name "pid_for_children": >>> >>> ~# ls /proc/5531/ns -l | grep pid >>> lrwxrwxrwx 1 root root 0 Jan 14 16:38 pid -> pid:[4026531836] >>> lrwxrwxrwx 1 root root 0 Jan 14 16:38 pid_for_children -> pid:[4026532286] >>> >>> --- a/fs/proc/namespaces.c >>> +++ b/fs/proc/namespaces.c >>> @@ -23,6 +23,7 @@ static const struct proc_ns_operations *ns_entries[] = { >>> #endif >>> #ifdef CONFIG_PID_NS >>> &pidns_operations, >>> + &pidns_for_children_operations, >>> #endif >> >> This interface should be documented somewhere under Documentation/. >> But I can't immediately find where the /proc/pid/ns/ pseudo-files are >> documented... > > I know that they are documented in man7/namespaces.7 > > https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/man7/namespaces.7#n187 I suggest the below patch, but it's too early for the man description till the feature is in mainline, because the man page requires commit id of the feature. [PATCH] namespaces.7: Document the /proc/[pid]/ns/pid_for_children file Signed-off-by: Kirill Tkhai --- man7/namespaces.7 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/man7/namespaces.7 b/man7/namespaces.7 index 6dfceaa2a..06041774f 100644 --- a/man7/namespaces.7 +++ b/man7/namespaces.7 @@ -125,6 +125,7 @@ lrwxrwxrwx. 1 mtk mtk 0 Apr 28 12:46 ipc \-> ipc:[4026531839] lrwxrwxrwx. 1 mtk mtk 0 Apr 28 12:46 mnt \-> mnt:[4026531840] lrwxrwxrwx. 1 mtk mtk 0 Apr 28 12:46 net \-> net:[4026531969] lrwxrwxrwx. 1 mtk mtk 0 Apr 28 12:46 pid \-> pid:[4026531836] +lrwxrwxrwx. 1 mtk mtk 0 Apr 28 12:46 pid_for_children -> pid:[4026531834] lrwxrwxrwx. 1 mtk mtk 0 Apr 28 12:46 user \-> user:[4026531837] lrwxrwxrwx. 1 mtk mtk 0 Apr 28 12:46 uts \-> uts:[4026531838] .fi @@ -186,7 +187,14 @@ This file is a handle for the network namespace of the process. .TP .IR /proc/[pid]/ns/pid " (since Linux 3.8)" .\" commit 57e8391d327609cbf12d843259c968b9e5c1838f -This file is a handle for the PID namespace of the process. +This file is a handle for the PID namespace of the process. It's +permanent during the whole process life. +.TP +.IR /proc/[pid]/ns/pid_for_children " (since Linux 4.12)" +.\" commit FIXME +This file is a handle for the PID namespace of a next born child +of the process. It's changed after unshare(2) and via setns(2), +so the file may differ from /proc/[pid]/ns/pid. .TP .IR /proc/[pid]/ns/user " (since Linux 3.8)" .\" commit cde1975bc242f3e1072bde623ef378e547b73f91