From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 009A1C43441 for ; Mon, 19 Nov 2018 19:39:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BC94220870 for ; Mon, 19 Nov 2018 19:39:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="btvBDjJI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BC94220870 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730310AbeKTGFB (ORCPT ); Tue, 20 Nov 2018 01:05:01 -0500 Received: from mail-ua1-f67.google.com ([209.85.222.67]:33430 "EHLO mail-ua1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730062AbeKTGFB (ORCPT ); Tue, 20 Nov 2018 01:05:01 -0500 Received: by mail-ua1-f67.google.com with SMTP id t8so3425027uap.0 for ; Mon, 19 Nov 2018 11:39:55 -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=9xsZE38xTUYiZ4BKZgkLAGyvdXvx5lZL/HRMO8epTiU=; b=btvBDjJICEVVHuTSGDLx9vnFm+1QxyVLRKFe9qu5rh+AYmkRrjfKO0OzE1g770M5K0 tENUnZmpfV4lwrHU7ElPcqPKqlYVPARvAnJleqvvDiBD7gEJ/g2LY7HUcI1BPz1ixp+w l1spdoWo2C5eXljl97ogYVtDp27ttOUDuwvAE6Ma6p9HZ4hVAyD68Qpyy3bZQUTfhW65 2pqb+XMehSaKqm0f0DGX1rQYuyltIlqraD92j0yAuxllfw2ikqrp88eCkSbfWMHCm/Rh 9q4YKA+jXHZVI6dL8bwvS46yhAOwGA//dJJ0S3ToR4SNHYnkoOUAsg6jJ/XOwWHy/ern aMNg== 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=9xsZE38xTUYiZ4BKZgkLAGyvdXvx5lZL/HRMO8epTiU=; b=ga+XrbPnCwBP3N4cCCbwWNDVMKJay8pmPACsT85HggK81sPf0h/cT9ab6DaQtg/rS6 DPHdVlmJMGOsBRcPYnita7MK6GwV/fuhVM8PezlNcgspEMxMTAI10SOA3RhbqIUTeyJR nsKlP/KVAmViL3wmU3CGlZKi4sdVh4xoJAXK53GvUbsjSG/ncTntahWo7qBdaUtmasp8 pkCDkxMJ5yt/T9SxHOVxP6avZt/lAh2xH9msOlYr+IO0TBbE2gvyqOro+Y2EjAwVFjQ+ +HUVQ7S6xhoJaWJ4xVnhUoDdVSc0qnBPFFbr8vzSAq5L5Q6lZTcXLrIvqmx2KnMJ3o32 ks+g== X-Gm-Message-State: AGRZ1gLz8EN4Sc5pKFYY9/80O6sNvQKDj1IfKdldg7ssWvCKBRfN0GYW oOVqwNiPxlDbT+537bKO50Y5LQCT5LKRIl3I8+aezg== X-Google-Smtp-Source: AJdET5fxMsnKg3INeyhRgZ0FNraROixfXpm/Mm7mVOH+lKavdzHPlE3awQ4r6n2yNsUOv5aaqGnIp8fogSW5ALlG/10= X-Received: by 2002:ab0:225a:: with SMTP id z26mr10672112uan.100.1542656394542; Mon, 19 Nov 2018 11:39:54 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a67:f48d:0:0:0:0:0 with HTTP; Mon, 19 Nov 2018 11:39:53 -0800 (PST) In-Reply-To: <20181119193128.hv7z4j52ajrue2jr@brauner.io> References: <20181119103241.5229-1-christian@brauner.io> <20181119103241.5229-3-christian@brauner.io> <20181119182902.fadw6qiu3eepndm3@brauner.io> <87o9ak28nl.fsf@xmission.com> <20181119193128.hv7z4j52ajrue2jr@brauner.io> From: Daniel Colascione Date: Mon, 19 Nov 2018 11:39:53 -0800 Message-ID: Subject: Re: [PATCH v1 2/2] signal: add procfd_signal() syscall 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 , linux-man , 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 Yep. That's also what I was talking about, FWIW. On Mon, Nov 19, 2018 at 11:31 AM, Christian Brauner wrote: > On Mon, Nov 19, 2018 at 01:02:06PM -0600, Eric W. Biederman wrote: >> Christian Brauner writes: >> >> > On Mon, Nov 19, 2018 at 07:59:24AM -0800, Daniel Colascione wrote: >> >> You never addressed my comment on the previous patch about your use of >> > >> > Sorry, that thread exploded so quickly that I might have missed it. >> > >> >> private_data here. Why can't you use the struct pid reference that's >> >> already in the inode? >> > >> > If that's what people prefer we can probably use that. There was >> > precedent for stashing away such data in fs/proc/base.c already for >> > various other things including user namespaces and struct mm so I >> > followed this model. A prior version of my patch (I didn't send out) did >> > retrive the inode via proc_pid() in .open() took an additional reference >> > via get_pid() and dropped it in .release(). Do we prefer that? >> >> If you are using proc// directories as your file descriptors, you >> don't need to add an open or a release method at all. The existing file >> descriptors hold a reference to the inode which holds a reference the >> the struct pid. >> >> The only time you need to get a reference is when you need a task >> and kill_pid_info already performs that work for you. > > Oh, I see what you and Andy are saying now. Sweet, that means we can > trim down the patch even more. Less code, less headache. > > Thanks! > >> >> So using proc_pid is all you need to do to get the pid from the existing >> file descriptors. >> >> Eric >>