Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933312AbdC3K17 (ORCPT ); Thu, 30 Mar 2017 06:27:59 -0400 Received: from mail-eopbgr10099.outbound.protection.outlook.com ([40.107.1.99]:31376 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933024AbdC3K1w (ORCPT ); Thu, 30 Mar 2017 06:27:52 -0400 Authentication-Results: hallyn.com; dkim=none (message not signed) header.d=none;hallyn.com; dmarc=none action=none header.from=virtuozzo.com; Subject: [PATCH RESEND 0/2] Expose task pid_ns_for_children to userspace From: Kirill Tkhai To: , , , , , , , , , , , , , , Date: Thu, 30 Mar 2017 13:27:39 +0300 Message-ID: <149086931397.4388.9604947335273204415.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: AM5PR0601CA0040.eurprd06.prod.outlook.com (10.173.86.154) To VI1PR0802MB2288.eurprd08.prod.outlook.com (10.172.13.143) X-MS-Office365-Filtering-Correlation-Id: 242c06a2-4db5-424c-e3c5-08d4775766f4 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:VI1PR0802MB2288; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0802MB2288;3:1PTkTZg97k68yf0ybEFnuwizaSBDk6po8dF5a08a1twGKKaagm7SCZsSfhOCQ5MUk9s6zouqBBPgvZsH+9E9PACOYotBtPObKeyXVAO3pblEO/GbBCl88vQEDqzl3jrY/iBjG3eiXbL4w3AToxbc/SMP2W6MrJrULAtfezkVop7ridp/ONe/9a/9NAVJquvhCtQBjzie7Dz6JaQI+a/JSgH8hOnIZxvzN9i+feDU+m75FWXzZzDmWI/7DBF+DGDHYUCc91sPybOKGBU+gwu8YFngeA/WdWu3ai94mjs1xsuaDmqv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Y19XHmPEQaU6xbN8KS65bh8UKK9PVC/IaBIRygYhtCOUjcc+R3RXO+hGG/gYuA34Lh4eoZ38alNIETAK2cO/XDirvZyj5r6C1ZpQRjwQ1S5yM/XZAVD7481uSAaF7CYacQ0UpfHvTbH6Ec= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(201703131423075)(201702281528075)(201703061421075)(20161123562025)(20161123560025)(20161123564025)(20161123555025)(6072148);SRVR:VI1PR0802MB2288;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0802MB2288; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0802MB2288;4:NN+ZCkNaWlnnFVsKAImTs0GwbOotQWazprlng4ks829h3EJfk3CDzBk0KMO6JhfAdeNuoEPcqtNEe+amE44ciLUV9TpqJObIjXZlbeeo5xO3LTf0E1EukjFus4oCC2Vn+NkF8Fn0xYcdr5qFIMrD5rkB+RpwTuX77Dy1Hgl0nSLIE68HuEikjcXsN6o3A7Yzg4qMh60cQF7NhotUvALx3tUBY4UU2prLejmWmERlBfeKHd42i6IFurukVl+7BEWgx1XIH33/vyeoe7iTK1OHDzYxtusx3+Nd8TTenC66KGEOhTVKfoLIuuLExmLEMjoO+H2Ry8+M+/5lmCHWzkifdZ3lHJsiBhUIfKxIN769E1v/UBpS8S0wQrAL519Pel6sFUSBP0SMJ3u47lIaizY1cw9NZuyAih+Wh9QsuX2F5E3rLvHbTPGzq3iWScyn/nZJO2tzemEhUmFjQJZznHdaKvxrQzQO/Z6WxmfnUefBbGght6sMfVehUhjHpnzhzre1AC9d+5NIeC5Y0KqzooVMHV9gss+lAzESdm8IM6KenxtiybOfdbNFf8NYiclxfA0HOww+z3o7gipOdMM3eyA/g2QhAdaVIvMG82GYO8byquwX5GN6SUHqdxSgGdfAHj1DVOxBYQX2hE8MPA65nhUuib2aIH/LKxT7UxjVy0endNw= X-Forefront-PRVS: 02622CEF0A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(6069001)(39400400002)(39410400002)(39840400002)(39450400003)(2906002)(9686003)(38730400002)(54356999)(50986999)(103116003)(23676002)(53936002)(50466002)(55016002)(6506006)(8676002)(47776003)(83506001)(42186005)(7416002)(81166006)(66066001)(6666003)(61506002)(33646002)(3846002)(25786009)(6116002)(2201001)(86362001)(305945005)(4001350100001)(189998001)(230700001)(5660300001)(7736002)(921003)(1121003)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR0802MB2288;H:localhost.localdomain;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtWSTFQUjA4MDJNQjIyODg7MjM6YVdUb0NlWDZXUlZXcXM2d0ZYUDVLbWR6?= =?utf-8?B?TnVhUXpFaE1WZ2RLRStsOXhEbnIvbnFTaHhpdGFTYVdaM3NpNlRqSDJpOEcv?= =?utf-8?B?Tk5takJsTUxSME1PaXVSWHhqREFtdy9aT2NjamZ0aDVnc1dRc2VtQXBJRTAx?= =?utf-8?B?YUhwanExRkwwRENNbWRNYWZUSFZqRVc1TlNBYm0yeHdWaWdTNDVlc09hcVhN?= =?utf-8?B?U0wzRmRTbkNRWkVxeE5PSWx4UHd1M0YzcE1BczJvQ29Zcnk2YTBWeld1SklH?= =?utf-8?B?NWN2S0dYcXhMZjZIbEl4dUMxMFVLdkpxNXZodUVYVGhtakI5cEkvZVZ6MzQ0?= =?utf-8?B?NEU1UHVSVVdpZ3BEUHhzUk04MXMxdzByUlpZY3RBTnAxd2FMaURFREttMlI0?= =?utf-8?B?SXZPWmc0dzNLV0QzWCsxS3YxUHdvaVlJbzlSSUFEd0U0RVUyYWxiUnBNcHEw?= =?utf-8?B?ZHZNbUdlNXJYNDQrRUZwQU43c2pFWmRGdTVhSGpVT3VWT3o4UkhUcWFBYzlE?= =?utf-8?B?bzlBQ2t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Q?qaEHb4F0=3D?= X-Microsoft-Exchange-Diagnostics: 1;VI1PR0802MB2288;6:7o5Ocr6CNft9AAaMK6+LfbaqllZ0b87aH+KXkHBQtSRPVi147ycb2UHoni5J6AqIifQc7+UL43WTVy35FLj/sLTN37C/tRZOoZrYylJfXng0wxvMpSfU/BsCYBQ0fcU/9nLtv+QoLagL1fWsp7tcHrBXaIg7s5aONjeIcZiTfqRwvF/IZDMwYFenT1DuXp0Bzb5KWbr/I+9RzkjEYQhzJlzZlZwidx8SJbJ9htHLaiKjABUDmvXQYYbUVNJwemrm6CCTNc+14HvWAPCGxe98PzGujP9OzfYbM+ANpbaV2lpQI+X7/l/1HIBhddd4JE4qJb4DKbbbiQ6UALaiQc1uxsNTfEot/AFEc9nEndONsMdpfj63aOVZ9Vd5hMmC9pyAB6YMDpknDaE2SsNmD1NgQQ==;5:FQKZo9fHE6IqPsRNwoNlg0gicx8GzL39fAR2fqTyi/GYm+W0XUIEsPii+EIIntz1TbHlx+zFY0OQuocJSyYnwJn2/iLe86e9zThdnbCLuQs24qWMooRKUVnDUeY56w+cw5NksvEEjkxl8OmyZyRwGw==;24:ar53NG0LynM0RSY8QdHavie58BFj/WUwbVsIa6jSQf8F+H5FqTwhOec3j4iOI+CK6aciwaQ9nLWWTSej6wLEdAZbUAb+HrgI579j0pI59GY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;VI1PR0802MB2288;7:ThyQqyDQEO/MLzKaRI58+azmpEpXs8pQu1XkdLRHO9xJIYdflcfCUCkBQOFeXYyCwvWNk8UfMyarsbuo01Ybk+j44um58cWsfm2YhDw7ajqlk6pry6m+zakDs53XN97wn3DZGB8ABwv2V12T/vumzZV8RjELNbObqeOjT02DFBDI+IczWeeVxs9zOH/Bvbo0oea698R8dTJlvgx2op3rNShfBACZgtKg4UGtRz+x0H1GqWrfEQX8/RFwr1F7ZYWLAtvbRmpe0y1kHRzdKXuMkBAPqkeBIYUOr/g31pofD1YI07GeIPVoY7stFNbDpEaW5bps7u73nxp2q7S+INJi/Q==;20:KbJpCjOXAkhwv01OH96JDV1HKyzFJvs0tkx2xMrfIz17Y/1uCYghUrQujLZTlYahhuyVO6y/h7vdLDzZuB8qw2AayGh3mc2SFnv57Qp5LPxumOhUIpmumMKrqIAg4aMhQxuN3174EU4kpfMj7WGxBAPCgrlOZDfppZzFd07sMnQ= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2017 10:27:42.7537 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2288 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1156 Lines: 31 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. If they have a custom pid_ns_for_children before dump, they must have the same ns after restore. Otherwise, restored task bumped into enviroment it does not expect. This patchset solves the problem. 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] --- Kirill Tkhai (2): ns: Allow ns_entries to have custom symlink content pidns: Expose task pid_ns_for_children to userspace fs/nsfs.c | 4 +++- fs/proc/namespaces.c | 1 + include/linux/proc_ns.h | 2 ++ kernel/pid_namespace.c | 25 +++++++++++++++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) -- Signed-off-by: Kirill Tkhai