Received: by 10.223.164.221 with SMTP id h29csp1052275wrb; Mon, 16 Oct 2017 17:51:41 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBf2nDPqWOVv7jMN4qyxBVxp3gaeulzHQIfNLawNXQQEjAgyA84JtfuX+sjvvV8FAPaEp/4 X-Received: by 10.84.233.68 with SMTP id k4mr10257899plt.416.1508201500965; Mon, 16 Oct 2017 17:51:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508201500; cv=none; d=google.com; s=arc-20160816; b=V2NvvJUyNcm7/nG4M+ASWlTSOOWUq6FsqbWo9o4IRXZXhhobWS+uvS6BKKg5Hzhmtk RzLeIpwQ63+mdnxNNjLbh0qTRAUfS2HbziKh5RC8PxyXg/CPWIt/pyBkVvfvYDCYtA/6 6M3F5Hc4ynTP/E8TJaLpVWbGubRvf1owfw5muiFSHGJlFiqr/hzInxSSUQ92A2tFETZ7 p+F5L4er085oK5H/7oZmDezIxtQeMEBsdm6I+BQahi6KmW6FGNzutz9BDpOZcDz9QH7J yYwVD/p1hYdTlRxwf4Ghf/iD3uphNm2bJH+Z+Mn4rmR/ks6vVoXS9r/YS7jF9qD0NDCA 3Wlw== 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=O+GMZlTsM7boOBxk89ddVJdzLVwvO+s84nqtr1xUoIw=; b=WCJqMC7oSuh69w7oSm5GZsf6H/uVXOWr9KPMLe1nB9Oi7WIIEI+6begjtU4dsvbr3c mw1LDrkFXH1jHGUOIDx92UBlqhLsdrcK8Q+y/xpOZU4bB7UlBF/T7NrDCkDP47mT3Qpk mKx63JhnByryOihPe1kUPWBVCy0P8PFuNpkhRm9uVdrZCtOghzcJU28D5df6557QMOF3 4ScCmwckiHS4abSBOg6jdtIffd+MXXtI+dweZchqGfOBuMT1XPWQzxl51W6v7fpcvAM0 swShYTDL598Z2D+N18Joz+hueftFfjo0BXvBqAu7wuaRPTBXlUQ3/pgTTXu9GZv4p6Jp i0zg== 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 n9si274030plp.715.2017.10.16.17.51.26; Mon, 16 Oct 2017 17:51: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 S932105AbdJPVIO (ORCPT + 99 others); Mon, 16 Oct 2017 17:08:14 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:39632 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753785AbdJPVIN (ORCPT ); Mon, 16 Oct 2017 17:08:13 -0400 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v9GL84eL006881 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Oct 2017 21:08:04 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v9GL83TK030455 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Oct 2017 21:08:04 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v9GL829J032393; Mon, 16 Oct 2017 21:08:03 GMT Received: from [10.132.93.82] (/10.132.93.82) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 16 Oct 2017 14:08:02 -0700 Subject: Re: [PATCH v4] pidns: introduce syscall translate_pid To: Oleg Nesterov , Konstantin Khlebnikov Cc: linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Morton , Serge Hallyn , "Eric W. Biederman" , Eugene Syromiatnikov References: <150788678482.924140.11785205105514746135.stgit@buzz> <20171013160514.GA27812@redhat.com> <3bdb5341-9ae6-265a-ce5b-45c2cfc76fad@yandex-team.ru> <20171016162436.GB4142@redhat.com> From: Nagarathnam Muthusamy Message-ID: <6bba1416-746c-0636-9c6d-d2c9d8934dc6@oracle.com> Date: Mon, 16 Oct 2017 14:05:05 -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: <20171016162436.GB4142@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/16/2017 09:24 AM, Oleg Nesterov wrote: > On 10/13, Konstantin Khlebnikov wrote: >> >> On 13.10.2017 19:05, Oleg Nesterov wrote: >>> I won't insist, but this suggests we should add a new helper, >>> get_ns_by_fd_type(fd, type), and convert get_net_ns_by_fd() to use it >>> as well. >> That was in v3. >> >> I'll prefer to this later, separately. And replace fget with fdget which >> allows to do this without atomic operations if task is single-threaded. > OK, agreed, > >>> Stupid question. Can't we make a simpler API which doesn't need /proc/ ? >>> I mean, >>> >>> sys_translate_pid(pid_t pid, pid_t source_pid, pid_t target_pid) >>> { >>> struct pid_namespace *source_ns, *target_ns; >>> >>> source_ns = task_active_pid_ns(find_task_by_vpid(source_pid)); >>> target_ns = task_active_pid_ns(find_task_by_vpid(target_pid)); >>> >>> ... >>> } >>>> Yes, this is more limited... Do you have a use-case when this is not enough? >> That was in v1 but considered too racy. > Hmm, I don't understand... > > Yes sure, this is racy but open("/proc/$pid/ns/pid") is racy too? > > OK, once you do fd=open("/proc/$pid/ns/pid") you can use this fd even after > its owner exits, while find_task_by_vpid() will fail or find another task if > this pid was already reused. > > But once again, do you have a use-case when this is important? I believe that in V1 Eric pointed out that pid in general is not a clean way to represent namespace. (https://lkml.org/lkml/2015/9/22/1087) Few old interfaces used pid only because at that time there was no better way to represent namespaces. > >> But we could merge both ways: >> >> source >= 0 - pidns fs >> source < 0 - task_pid = -source > But for what? I must have missed something... > > Oleg. > From 1581457862849118861@xxx Mon Oct 16 23:15:46 +0000 2017 X-GM-THRID: 1581133950441644275 X-Gmail-Labels: Inbox,Category Forums