Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3532991imu; Sun, 11 Nov 2018 17:20:16 -0800 (PST) X-Google-Smtp-Source: AJdET5dJl515cRGBa9wkepuMkT1YC0H83rSCQ7xgAVdN0c/7NmMiKsVeVCKL4tRG8dirMwxTN1vS X-Received: by 2002:a65:6447:: with SMTP id s7mr15514259pgv.226.1541985616260; Sun, 11 Nov 2018 17:20:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541985616; cv=none; d=google.com; s=arc-20160816; b=AAor+KCyC6YWblhrMkw6epXXkSxKseArjKz7BnrW14z9wmhWgnwa6LvbRVO7YuZyXG umQWgkuQgnQTEmOmbkM7KVRsgKZ+aIYfNpZr/wjh6xH9c7Ufur/Jl168Meu2IWbsOPNd v/yuyf+E7KlARC4ebmTtKqIe2xH2LOETozfS6a3Ziyo9oRA1byMvT1eAsuHfgdxVmc8y fVLC22EVM8BOj3WBJGr3SOB7tuvDf+X70wbYHxDKNWNJnhc9k5TC5P1Dk4p4WJtawpse PScR/wETHHdhIVSM4uG8ItQgHtitMpjnQ32OBuTYOQY/rGrpcbkB5Xywc41da3m2jfrV pytQ== 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; bh=jtT7rFRrg18EsEJx6E9hQN+Zca7Gu8lU4Np0QS2PqnQ=; b=IMGKAcbxX0tXgdoyHIabuiuWR3wStRR/mZXo/Mq46YXOeNxx7M0uoVyPe+VDKkgF9V zURn6Gr6jSn8eio+rZFcYCcIpwf9imvZS5OezQXxkoax1dtJu7DIZuApv/Jp288stJWA DwVgZUtwSLewY/y+LFQEEwdPDRvAPWEK4O8OI6Hr+cSWJb4IfyyG83/HYtEOMAw05ZkT aEtDmC5h7eZuaJnwjA8+L672yZyMFkH6j4jHu1wLLJx0ncB3jv5pqF00yQVIN8+ZL7O9 +O4v/9dhM+CSsqWuUMjSRn+U0rHLYIaZFqQ4WW5tAWrd6+9/L3SCUibeO+LjYp2GGYRS Dc6g== 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=xmission.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w4-v6si16140873plz.419.2018.11.11.17.20.01; Sun, 11 Nov 2018 17:20:16 -0800 (PST) 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=xmission.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729802AbeKLLKV (ORCPT + 99 others); Mon, 12 Nov 2018 06:10:21 -0500 Received: from out01.mta.xmission.com ([166.70.13.231]:33795 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726674AbeKLLKV (ORCPT ); Mon, 12 Nov 2018 06:10:21 -0500 Received: from in02.mta.xmission.com ([166.70.13.52]) by out01.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1gM0t6-0000zq-EH; Sun, 11 Nov 2018 18:19:36 -0700 Received: from 67-3-154-154.omah.qwest.net ([67.3.154.154] 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 1gM0t5-0007AX-ET; Sun, 11 Nov 2018 18:19:36 -0700 From: ebiederm@xmission.com (Eric W. Biederman) To: David Laight Cc: 'Daniel Colascione' , Tycho Andersen , linux-kernel , Tim Murray , Joel Fernandes , "Suren Baghdasaryan" , Aleksa Sarai , "Christian Brauner" , Kees Cook , Oleg Nesterov References: <20181029221037.87724-1-dancol@google.com> <20181031155912.45088-1-dancol@google.com> <20181031175448.GC2180@cisco> <20181031181717.GD2180@cisco> Date: Sun, 11 Nov 2018 19:19:30 -0600 In-Reply-To: (David Laight's message of "Thu, 1 Nov 2018 11:33:29 +0000") Message-ID: <87d0rbks7x.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=1gM0t5-0007AX-ET;;;mid=<87d0rbks7x.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=67.3.154.154;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+f9hP2PcpR7gGkNaAxwChOly4LZu7+WxM= X-SA-Exim-Connect-IP: 67.3.154.154 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on sa03.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.0 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * 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.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa03 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa03 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;David Laight X-Spam-Relay-Country: X-Spam-Timing: total 656 ms - load_scoreonly_sql: 0.06 (0.0%), signal_user_changed: 8 (1.2%), b_tie_ro: 4.3 (0.7%), parse: 2.3 (0.4%), extract_message_metadata: 31 (4.8%), get_uri_detail_list: 1.68 (0.3%), tests_pri_-1000: 25 (3.8%), tests_pri_-950: 2.7 (0.4%), tests_pri_-900: 2.2 (0.3%), tests_pri_-90: 31 (4.7%), check_bayes: 27 (4.1%), b_tokenize: 11 (1.6%), b_tok_get_all: 6 (1.0%), b_comp_prob: 4.0 (0.6%), b_tok_touch_all: 2.7 (0.4%), b_finish: 0.92 (0.1%), tests_pri_0: 520 (79.2%), check_dkim_signature: 1.19 (0.2%), check_dkim_adsp: 5 (0.8%), tests_pri_10: 3.9 (0.6%), tests_pri_500: 21 (3.3%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH v3] Implement /proc/pid/kill 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 David Laight writes: > From: Daniel Colascione >> Sent: 31 October 2018 19:33 > ... >> You can't do it today with kill. The idea that keeping a open file >> descriptor to a /proc/pid or a file within it prevents PID reuse is >> widespread, but incorrect. > > Is there a real good reason why that shouldn't be the case? > ie Holding a reference on the 'struct pid' being enough to stop reuse. > > A patch to do that would be more generally useful. Holding an open file descriptor to /proc/pid is enough to prevent pid reuse problems. If a pid number is reused a new 'struct pid' is generated. There is not 'struct pid' reuse. So in solving this the kernel data structure you would need to hold onto is a 'struct pid'. It is just necessary to add an interface to sending signals to that 'struct pid' and not looking up the 'struct pid' again by number. Eric