Re: [PATCH] mm/mincore: allow for making sys_mincore() privileged
From: Linus Torvalds
Date: Sat Jan 05 2019 - 15:17:40 EST
[ Crossed emails ]
On Sat, Jan 5, 2019 at 12:12 PM Jiri Kosina <jikos@xxxxxxxxxx> wrote:
>
> I am still not completely sure what to return in such cases though; we can
> either blatantly lie and always pretend that the pages are resident
That's what my untested patch did. Or maybe just claim they are all
not present?
And again, that patch was entirely untested, so it may be garbage and
have some fundamental problem. I also don't know exactly what rule
might make most sense, but "you can write to the file" certainly to me
implies that you also could know what parts of it are in-core.
Who actually _uses_ mincore()? That's probably the best guide to what
we should do. Maybe they open the file read-only even if they are the
owner, and we really should look at file ownership instead.
I tried to make that "can_do_mincore()" function easy to understand
and easy to just modify to some sane state.
Again, my patch is meant as a "perhaps something like this?" rather
than some "this is _exactly_ how it must be done". Take the patch as a
quick suggestion, not some final answer.
Linus