Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4187255imm; Tue, 11 Sep 2018 08:12:26 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZSP7CDm8WGVcTtS1oVz6MALQFWaOtoqxugFtq9kXdvHdE8w0nHlqCzPZV9l87P2zdPtnzz X-Received: by 2002:a62:8d84:: with SMTP id p4-v6mr30163009pfk.251.1536678746920; Tue, 11 Sep 2018 08:12:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536678746; cv=none; d=google.com; s=arc-20160816; b=GcGGy7IPt3eMUEjrbs1l24qM/PPh7hPoRiQ+kbHuQWCadvhBXnkcODnSpdX0dAoW37 nwGHdrfbhvQ81pNNkg6c89rDua0I0m1exJ/4sLzoEEzGsx32TiY72hw45MSqjtKXl3WZ QTrghxzZ6fQDv9/PxZqbRUzAqh9sU1DHjIbBqOEUKJNMIzwde2qX5IU+JtQNUDzjT/1w nezxspp1awl3tqLGX1U0r+bk+k8m2WMjx3udJpwZ/hEyuuUsHAypf5n9s+xnqTQn3dCp ft5H83RZfCyRF7X86UnZVPbtITYChZbOGdJzCh3jJ0aqp+MaU4kvXvlKR+Hws1JJH9Fw grug== 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 :in-reply-to:references:mime-version:dkim-signature; bh=c9WjvKjZHuVG0LZu3E2lqe/uvX/ZQt8RXccTeK9Yp2M=; b=jla9gVR0XAyG5IdDtivlKIPh5BQ86CK9UW/dDEv1zUl7a5Zn4J8g/kwK6jhRbLRoHL Nc5oWtNRcSDUpolo1L47KnwLh5nfevkH+Yb9y/MxdKFi1sSq+jAw9z3mF1YpVg/b1u8O qvP/KgMxUR+MIGyUxRgBKDGbEc8VCFi+FYYVK4pLuR+/tObPrOAlHOSmIAcXdNKRUCej rJE6xYjX9KVuGm9/tQEkU2z3wUNxTB93Znwx/KZ5ZIxXlUiVGF+mhK0D2fMzX+Ewp6S3 sZEzkb3n/an4PocvUXncLHL5Ewypgs2Kf5r9YWHVGSmxHHhfarIi6ckhkgQdov/dJN1m NBxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Pe8WAqsa; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h6-v6si16555251pls.150.2018.09.11.08.12.10; Tue, 11 Sep 2018 08:12:26 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Pe8WAqsa; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728107AbeIKULp (ORCPT + 99 others); Tue, 11 Sep 2018 16:11:45 -0400 Received: from mail-yb1-f170.google.com ([209.85.219.170]:35331 "EHLO mail-yb1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726840AbeIKULo (ORCPT ); Tue, 11 Sep 2018 16:11:44 -0400 Received: by mail-yb1-f170.google.com with SMTP id o17-v6so9462710yba.2; Tue, 11 Sep 2018 08:12:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=c9WjvKjZHuVG0LZu3E2lqe/uvX/ZQt8RXccTeK9Yp2M=; b=Pe8WAqsa3FHzq1em01qvlNmMXAtILNyLQGV+MAWPIkHNICqZD6pdp0Rjy72OlnsdV8 nBOpPiYm9eiRfu0PiNL6KtdnnS8F2tRxO713hmjwYlGFVcCmv/ARMh6ZwR9PwGFwPiCx qjB/hzUXn6mFjU50T0ZtKzv7c30gfqImax15A0WSqaKHgZ6DhXbXZpyd9h7pcT5jkHp7 K3K4fREhPVps3OmKJrjnd8iyHQ/hhAIXZI1emWYi5wU8MsPz7AK4LfBOdyJfkNGNVGbC Zki6fjCGIhbTdW0zi2oeXgy4wp9PemFWBbuJCM0fjdODeLI5oetLkmECsuEOYnPo9n5k AHqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=c9WjvKjZHuVG0LZu3E2lqe/uvX/ZQt8RXccTeK9Yp2M=; b=CWd5RadSgSaU9u8XSm/DHEv2SGh6LVGjqa40X3/36gw0iYoJeY5yhl7xAQv+cOe5KS GG3UfSWlE+LeaLoG7/ba3I6F1/uyp3pWhjDht8jSCtdQdw7KJzeRl8Uw6OW1vlpLnWVf MDRXwJ1uBM8BtkbrjvrB59gD1CUMHbr0e0U2OMySeQJxaASkyxxIP10p32442Gq6W1YY GtEzJ3R5DipTM7GGn55URAGJmkNXBv+t3CYDzVEZ/frbckglLt6J5Dx+grEP5VJF5Nvv 1gObVyQgqoCzVf+QLc0ZbB6ysMfv7BAdKuySIB1lHCTA1zDjecLWS98MqPA98CM3RCAW xZiA== X-Gm-Message-State: APzg51CeK7/3egV1R9Ol4P8UTe7kX3RxTvlDePV9FZ9CnresQ+dLdjMA J+Cw8k70ispCmwBmD/fuA7Tj8caYx1Jceva+6kw= X-Received: by 2002:a25:1a85:: with SMTP id a127-v6mr12847454yba.507.1536678719704; Tue, 11 Sep 2018 08:11:59 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Amir Goldstein Date: Tue, 11 Sep 2018 18:11:48 +0300 Message-ID: Subject: Re: Is it possible to add pid and comm members to the event structure to increase the display of user and thread information? To: nixiaoming@huawei.com Cc: Eric Paris , Robert Love , John McCutchan , Jan Kara , Al Viro , linux-kernel , linux-fsdevel 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 Tue, Sep 11, 2018 at 9:51 AM Nixiaoming wrote: > > Inotify api cannot display information about users and processes. > That is, you can only know that the file event is generated, but you don't know who triggered the event, which is not conducive to fault location. > Is it possible to add pid and comm members to the event structure to increase the display of user and thread information? > "Is it possible?" is not the only relevant question. I suppose your patch can sort of works, but it exposes information to potentially unpriveleged processes, even exposes pid values outside of the process pid namespace. While those issues could be addressed, you can't change the format struct inotify_event without breaking existing applications. I guess you are not using fanotify API, which already provides pid information (albiet tgid), because it lacks other functionality that you need? Which functionality might that be? Is it directory modification events? If so than you might be interested in my effort to add support for those events to fanotify: https://github.com/amir73il/fsnotify-utils/wiki/Super-block-root-watch Your support, should you choose to offer it, could be in the form of testing patches and/or just by putting forward your use case as an example for the need of an extended fanotify API. Thanks, Amir.