From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-f193.google.com ([209.85.215.193]:44895 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727639AbeKTF4o (ORCPT ); Tue, 20 Nov 2018 00:56:44 -0500 Received: by mail-pg1-f193.google.com with SMTP id t13so5606096pgr.11 for ; Mon, 19 Nov 2018 11:31:40 -0800 (PST) Date: Mon, 19 Nov 2018 20:31:31 +0100 From: Christian Brauner To: "Eric W. Biederman" Cc: Daniel Colascione , 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 Subject: Re: [PATCH v1 2/2] signal: add procfd_signal() syscall Message-ID: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87o9ak28nl.fsf@xmission.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 >