Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1746956imu; Sun, 18 Nov 2018 08:04:09 -0800 (PST) X-Google-Smtp-Source: AJdET5fdowQLXemt9MVNuw4gfL5QwyRsQDS0pkQBhpO0mMFo52/YYDPaVXrOe1e1lqOlyCtcnl7u X-Received: by 2002:a17:902:b68d:: with SMTP id c13mr18887681pls.102.1542557049739; Sun, 18 Nov 2018 08:04:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542557049; cv=none; d=google.com; s=arc-20160816; b=woVsBdvSmnWzzRl/ov1at7c+lJ5NsvqJmNoEFliHf1oZFZlw4+0j8ZSxXeSRt4GXr5 NhXzyMiJVd1/Ex4pyO3f7WRd1SnaAf2pPra16aN8QxJA+IOS3QSDMLsgw0jw0GPl7gmq 6v83iNUCK6SLzzgkjxwBvidKETezOW7mvkClL+cwapAP6Ff58ajh9gYbhHa7037GXu/O BxOrvhQJAPpFv1DyipxHeVaVZlbSPEEaTFXCT8IOa9NLER+Wo4b0jrjepj+cOoZRPlSZ 7FxqWmQUEgUYST/DCK/WYeMcWGEfkK+Y5/zYUT4nmSCDWT11MJXL0ioqsD4hZwkvKbIT cwLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=gRfyDfiiU8nLoSYxo7HvgBdNLY/gqZEp2pdSSXhnYbg=; b=hjVxzYRGeP9+7T2dSbuCrqwIpjGG0w6zRyW4AG6YzoLyYHRe8d7BwO9EA6ai/JuauF So2KEAxdx3iG4kF9wSpQ3UNxQ3pDmcJeP0tBPq85VilU2X+3K/KNLqCrt4gzxn1K7zLQ DiwrvoTLGpIqeSIs0zAtSTnn+6vGsMbCIiQ+K21+tgXWdJKckpLlpBpxzCH/z1cplgNW YjsMrntmqimTp8F23nGKuzwfusN7sPTk7Jkw0mRUMv3qs2eAcROLXJGiWs9Hn04cUgrX KPura5MI/JCckgtD2CO4GsyOM55GDwObOGpTk8eUEhUnNriE18xpdM2Rj7jWn70f/GX7 lB2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=bvQj4EyP; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w23si3913056pgc.250.2018.11.18.08.03.54; Sun, 18 Nov 2018 08:04:09 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=bvQj4EyP; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727503AbeKSCX4 (ORCPT + 99 others); Sun, 18 Nov 2018 21:23:56 -0500 Received: from mail-ua1-f65.google.com ([209.85.222.65]:39295 "EHLO mail-ua1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726804AbeKSCX4 (ORCPT ); Sun, 18 Nov 2018 21:23:56 -0500 Received: by mail-ua1-f65.google.com with SMTP id k10so9887079ual.6 for ; Sun, 18 Nov 2018 08:03:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=gRfyDfiiU8nLoSYxo7HvgBdNLY/gqZEp2pdSSXhnYbg=; b=bvQj4EyP2MeBuJTOYfXrOGP2M4G0MoXjLadOTCYVzVUds02wtiEm74DGc94bq+zyj+ DzSRwaREiDGvGWs7RpavnORb5sDSvOZLzXvAD6vY2oWGfiM5gjrpnShfWY5TMXDkp6dg Hv1lbPrioAnOgQPZG+z2gwwcbISipsGU7K0QoKJl8Q2I18orU0iANBEI9aShx2VLuHqj J9i2Z1jdJd4Ng5L/Jfvxx3KWQwEZdKf8hzYAxvVMFbjDfyQXA1/Mwci5e6ztZorKm7fr 6G5q4fnzzYfCzbwgtIzl5olUC+X9IRsNXXeTYxpIQM1F+a3wIK0wjrlQcAmzeVDL+y53 XJvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=gRfyDfiiU8nLoSYxo7HvgBdNLY/gqZEp2pdSSXhnYbg=; b=WHKLGBnnnkjucY3f9TNebBXrtuZMUBeqr1NUuMRJdFGdUB88AhWy75WJBhr6lGTuF7 8QjY/Ab6DZJ32GKrUAZRjelKdNTnbCV6PFlupO/W51yvf1IXSv3PRvjCowY0+VQOei84 2g8UoKO6OI7GaLr9x8L+4pRTufQ2cGBmtx1xtmnAuwDLSCn6PspU+DIqzCNhHXGPqoHB 567sAadC60tXEC2ObYFHbP8a1QvWJVfj0CaOfA2qDiXCq3Q15wgwyI/oGezFzj759BjD W69RSQmK2xTTnMMkM5jA7uV4Hx04pYITpA3h94sj/zM1Hplpr4w/jsikZmFp37Bl5eti k0ew== X-Gm-Message-State: AGRZ1gLeVG4n17BqpI+jpmLdHqZv4SgtTdg87I+4aXOr16ihOjZ96mIN jdJnHG6q3rC4VJ5plAVZwMWVGchLpP4r8WF0xXKlEQ== X-Received: by 2002:a9f:2b44:: with SMTP id q4mr5431609uaj.126.1542556996603; Sun, 18 Nov 2018 08:03:16 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a67:f48d:0:0:0:0:0 with HTTP; Sun, 18 Nov 2018 08:03:15 -0800 (PST) In-Reply-To: <20181118111751.6142-1-christian@brauner.io> References: <20181118111751.6142-1-christian@brauner.io> From: Daniel Colascione Date: Sun, 18 Nov 2018 08:03:15 -0800 Message-ID: Subject: Re: [PATCH] proc: allow killing processes via file descriptors To: Christian Brauner Cc: "Eric W. Biederman" , linux-kernel , "Serge E. Hallyn" , Jann Horn , Andy Lutomirski , Andrew Morton , Oleg Nesterov , Aleksa Sarai , Al Viro , Linux FS Devel , Linux API , Tim Murray , Kees Cook Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Nov 18, 2018 at 3:17 AM, Christian Brauner wrote: > +static int proc_tgid_open(struct inode *inode, struct file *file) > +{ > + /* grab reference to struct pid */ > + file->private_data = get_pid(proc_pid(inode)); Why grab another reference to the struct pid when the inode already has one?