Received: by 10.223.164.221 with SMTP id h29csp1174616wrb; Mon, 16 Oct 2017 21:09:40 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDQ/uAqhHopeVZzRn0zuDnb2EzYdmLX+JSQ/ovBg3KvySg1pAYdO6ZA9aXguec1i6hWCPrb X-Received: by 10.84.217.206 with SMTP id d14mr10794325plj.62.1508213380624; Mon, 16 Oct 2017 21:09:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508213380; cv=none; d=google.com; s=arc-20160816; b=qA+xoC9qAB+rUvHWt1497bloPPwuFYV3syU+DCx91BMxxysjwZfZj/CayAU5rgz6kZ DqoyJxe2WWqbDgQzeoeWCQPTPcVuqJMAnFV19BbZpcXhZxmf1+uCUddUk4KwGc7WxYGH nOeo+vToQiVH6eM6c8MYdC+cb9EzrhlVSC9EcXjh87yumS5Y3/PGPmWvgOQhlzbsOonu pzkce+fh9FN/ExB5LjQ+89QLq80z89GSH8O27cIh8NofdcBIWM6MwDPQ2mYoidjwl3Pw 4QqtdvPYOaopr6NljqZNNaVD6ZM78X8Ce9uYcqRo3kzpOc2QdfqlqLeT9CR8kJ7pcNqh Z5Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=dsbai3f2xILiEczKJWptWmQ7zbgF45lN/A90BWNhYvA=; b=VQ2I4oGCRHn3pJ3U372UCyMm6j/nsiStjVCpWSv8E9ys4+fcNK+RiX97NMWOfMt1sd gCz6Wiu07JyaIphnGJzNOxeAtsTVgpTPomzlcwEu5sP8bBRLc3tSS+b5QiKs4QCwnwJs xyBo6N5fGrYqZDU9cn4sGyBPinSu7FSdGBdKQCrmpqN9CFyfEi91aN8v8mlPTLsQ5+uU 3y37ou/m5r4QpGD6ZHDFrnv+51GV5/L+bgJp70xq8ScKxpokjdwoV/94eV0z2dpVJSXd kgwoKSdqg40HzJ7vTx7MQnqfMtUVPCrS0RMJfmlLqRcf89/OE3g0CPFJlBJ+vZQPbMWJ qeBA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b1si5499349pld.697.2017.10.16.21.09.26; Mon, 16 Oct 2017 21:09:40 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756114AbdJPWK7 (ORCPT + 99 others); Mon, 16 Oct 2017 18:10:59 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:31824 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754256AbdJPWK5 (ORCPT ); Mon, 16 Oct 2017 18:10:57 -0400 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v9GMApne004775 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Oct 2017 22:10:51 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v9GMAoso018221 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Oct 2017 22:10:50 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v9GMAnxa014906; Mon, 16 Oct 2017 22:10:49 GMT Received: from [10.132.93.82] (/10.132.93.82) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 16 Oct 2017 15:10:49 -0700 Subject: Re: [PATCH v4] pidns: introduce syscall translate_pid To: Andrew Morton , Konstantin Khlebnikov Cc: Oleg Nesterov , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, Serge Hallyn , "Eric W. Biederman" , Eugene Syromiatnikov , prakash sangappa References: <150788678482.924140.11785205105514746135.stgit@buzz> <20171013160514.GA27812@redhat.com> <3bdb5341-9ae6-265a-ce5b-45c2cfc76fad@yandex-team.ru> <20171016143628.b2ef80a9ef16d4345889b4d9@linux-foundation.org> From: Nagarathnam Muthusamy Message-ID: Date: Mon, 16 Oct 2017 15:07:52 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20171016143628.b2ef80a9ef16d4345889b4d9@linux-foundation.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/16/2017 02:36 PM, Andrew Morton wrote: > On Sat, 14 Oct 2017 11:17:47 +0300 Konstantin Khlebnikov wrote: > >>>>> pid_t translate_pid(pid_t pid, int source, int target); >>>>> >>>>> This syscall converts pid from source pid-ns into pid in target pid-ns. >>>>> If pid is unreachable from target pid-ns it returns zero. >>>>> >>>>> Pid-namespaces are referred file descriptors opened to proc files >>>>> /proc/[pid]/ns/pid or /proc/[pid]/ns/pid_for_children. Negative argument >>>>> refers to current pid namespace, same as file /proc/self/ns/pid. >>>>> >>>>> Kernel expose virtual pids in /proc/[pid]/status:NSpid, but backward >>>>> translation requires scanning all tasks. Also pids could be translated >>>>> by sending them through unix socket between namespaces, this method is >>>>> slow and insecure because other side is exposed inside pid namespace. >> Andrew asked why we might need this. >> >> Such conversion is required for interaction between processes across pid-namespaces. >> For example to identify process in container by pid file looking from outside. >> >> Two years ago I've solved this in project of mine with monstrous code which >> forks couple times just to convert pid, lucky for me performance wasn't important. > That's a single user who needed this a single time, and found a > userspace-based solution anyway. This is not exactly compelling! > > Is there a stronger case to be made? How does this change benefit our > users? Sell it to us! Oracle database is planning to use pid namespace for sandboxing database instances and they need an API similar to translate_pid to effectively translate process IDs from other pid namespaces. Prakash (cced in mail) can provide more details on this usecase. Thanks, Nagarathnam. From 1581463896850208177@xxx Tue Oct 17 00:51:40 +0000 2017 X-GM-THRID: 1581133950441644275 X-Gmail-Labels: Inbox,Category Forums