mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Eric W. Biederman" <ebiederm@xmission.com>
To: Luis Chamberlain <mcgrof@kernel.org>
Cc: Zhang Yuchen <zhangyuchen.lcr@bytedance.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	David Howells <dhowells@redhat.com>,
	Deepa Dinamani <deepa.kernel@gmail.com>,
	Christoph Hellwig <hch@lst.de>,
	Muchun Song <songmuchun@bytedance.com>,
	linux-api@vger.kernel.org, keescook@chromium.org,
	yzaikin@google.com, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: Re: [RFC] proc: fix create timestamp of files in proc
Date: Thu, 21 Jul 2022 12:45:42 -0500	[thread overview]
Message-ID: <87wnc6nyux.fsf@email.froward.int.ebiederm.org> (raw)
In-Reply-To: <Ytl772fRS74eIneC@bombadil.infradead.org> (Luis Chamberlain's message of "Thu, 21 Jul 2022 09:16:47 -0700")

Luis Chamberlain <mcgrof@kernel.org> writes:

> On Thu, Jul 21, 2022 at 04:16:17PM +0800, Zhang Yuchen wrote:
>> A user has reported a problem that the /proc/{pid} directory
>> creation timestamp is incorrect.
>
> The directory?

A bit of history that I don't think made it to the git log is that
procps uses the /proc/<pid> directory, to discover the uid and gid of the
process.

I have memories of Albert Cahalan reporting regressions because I
had tweaked the attributes of proc in ways that I expected no
one would care about and caused a regression in procps.

So it is not unreasonable for people to have used proc in surprising
ways.

I took a quick read through procps and it looks like procps reads
/proc/<pid>/stat to get the start_time of the process.


Which leads us to this quality of implementation issue that the time
on the inode of a proc directory is the first time that someone read
the directory and observed the file.  Which does not need to be anything
at all related to the start time.

I think except for the symlinks and files under /proc/pid/fd and
/proc/pid/fdinfo there is a very good case for making all of the files
/proc/pid have a creation time of equal to the creation of the process
in question.  Although the files under /proc/pid/task/ need to have
a time equal to the creation time of the thread in question.

Improving the quality of implementation requires caring enough to make
that change, and right now I don't.

At the same time I would say the suggested patch is a bad idea.
Any application that breaks because we hard set the timestamp on a proc
file or directory to the beginning of time is automatically counts as a
regression.

Since the entire point of the patch is to break applications that are
doing things wrong, aka cause regressions I don't think the patch
make sense.

So I would vote for understanding what the problem user is doing.  Then
either proc can be improved to better support users, or we can do
nothing.

Except for explaining the history and how people have legitimately used
implementation details of proc before, I am not really interested.  But
I do think we can do better.

Eric


  reply	other threads:[~2022-07-21 17:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-21  8:16 Zhang Yuchen
2022-07-21 16:16 ` Luis Chamberlain
2022-07-21 17:45   ` Eric W. Biederman [this message]
2022-07-21 19:47     ` Luis Chamberlain
2022-07-22  3:43   ` Muchun Song
2022-07-22  9:17     ` Yuchen Zhang
2022-07-22 16:08     ` Luis Chamberlain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wnc6nyux.fsf@email.froward.int.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=deepa.kernel@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=hch@lst.de \
    --cc=keescook@chromium.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=songmuchun@bytedance.com \
    --cc=torvalds@linux-foundation.org \
    --cc=yzaikin@google.com \
    --cc=zhangyuchen.lcr@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®