Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp845378img; Wed, 20 Mar 2019 12:06:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyjxJduZsGZJ4l3W3MPXx3RHIiSI0k12lsF1vv7NisWTZ1RxZTceNZv5UbMgrIgEt0k1eJF X-Received: by 2002:a62:388c:: with SMTP id f134mr9448047pfa.156.1553108790894; Wed, 20 Mar 2019 12:06:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553108790; cv=none; d=google.com; s=arc-20160816; b=KEP+GABiDrRWT+Hn7TPICkkFpXzMK/OIkFPoL2cq1Com7kLtu+sGGzJC/Hy24qG7ct C8nyR3vVj3AEU3F+u7i+1kp/8gp+yj/mM3LxUPlqR+zE4Et1LwsDyHUmX17YvrebLT9D f6zZpkAVQ0VX8+O/ty27+M7g3fUcXCz68JBGAb/htX3Y2ML9GCb08VZPOJW8Y1latIA4 JpZ4j3oopLyPK+kenN2QLwXliLx+iV1kD+CDZYPk5OWelWo8oGlFyqlAAwvIHW5oeUjn /Kjpzt3wPavOOWfG1W8sQA6OZ9ABDN2ZpBbVLE2fmE3HhDw4pa2dDY8fw0NYD2GnDEz8 UvIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=kbRqbVV5kw769/+To/WvZ4/vR3WITf8k+DFdVkCPyaw=; b=nEwERY7id4RUwEIBcNrXWWSo+TXvpE6j/a0n80aWVY2fvkgb0YbWOePAP6EtWpf3YB tLhKnkK2O7/2mzQxoCrXlRFsfyGKhtA45hsmaA8CQdjqfnT4GaKrldqa/pV5zLFDLezE CNx1HpOBmojFG+E5XQo1C1OBtQ7cVfEfNcJbvV6hb1iktkgqyTcIhIAGJLLFDPbJsX9t 7QXtHSTdlavMJnQShpvDJQpySUdcCwBSs+h/Ygffs0KnDqg5zo+vGx0dKq9YvvzLVHCx JsuFbzXAzZgnlS5TMGd76kv3DHVTpvpU7hojb9gZ+gi7WN+4/1aEbm9v0vCZP5XQe49l 2mGA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s8si2219419pgp.140.2019.03.20.12.06.15; Wed, 20 Mar 2019 12:06:30 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726896AbfCTTF2 (ORCPT + 99 others); Wed, 20 Mar 2019 15:05:28 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:52414 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726006AbfCTTF2 (ORCPT ); Wed, 20 Mar 2019 15:05:28 -0400 Received: from localhost.localdomain (c-73-223-200-170.hsd1.ca.comcast.net [73.223.200.170]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 6FE4D49C8; Wed, 20 Mar 2019 19:05:27 +0000 (UTC) Date: Wed, 20 Mar 2019 12:05:25 -0700 From: Andrew Morton To: Masatake YAMATO Cc: linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, Kees Cook Subject: Re: [PATCH RESEND] eventfd: prepare id to userspace via fdinfo Message-Id: <20190320120525.3ed8d21648ea8a573bbd4acf@linux-foundation.org> In-Reply-To: <20190320092929.14628-1-yamato@redhat.com> References: <20190320092929.14628-1-yamato@redhat.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 20 Mar 2019 18:29:29 +0900 Masatake YAMATO wrote: > Finding endpoints of an IPC channel is one of essential task to > understand how a user program works. Procfs and netlink socket provide > enough hints to find endpoints for IPC channels like pipes, unix > sockets, and pseudo terminals. However, there is no simple way to find > endpoints for an eventfd file from userland. An inode number doesn't > hint. Unlike pipe, all eventfd files share the same inode object. > > To provide the way to find endpoints of an eventfd file, this patch > adds "eventfd-id" field to /proc/PID/fdinfo of eventfd as identifier. > Address for eventfd context is used as id. > > A tool like lsof can utilize the information to print endpoints. > > ... > > --- a/fs/eventfd.c > +++ b/fs/eventfd.c > @@ -297,6 +297,7 @@ static void eventfd_show_fdinfo(struct seq_file *m, struct file *f) > seq_printf(m, "eventfd-count: %16llx\n", > (unsigned long long)ctx->count); > spin_unlock_irq(&ctx->wqh.lock); > + seq_printf(m, "eventfd-id: %p\n", ctx); > } > #endif Is it a good idea to use a bare kernel address for this? How does this interact with printk pointer randomization and hashing?