linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx.manpages@gmail.com>
To: Zach O'Keefe <zokeefe@google.com>
Cc: Yang Shi <shy828301@gmail.com>,
	linux-mm@kvack.org, linux-man@vger.kernel.org,
	Suren Baghdasaryan <surenb@google.com>,
	Minchan Kim <minchan@kernel.org>,
	Michael Kerrisk <mtk.manpages@gmail.com>
Subject: Re: [PATCH man-pages v2 3/4] process_madvise.2: CAP_SYS_ADMIN cleanup
Date: Fri, 21 Oct 2022 18:30:50 +0200	[thread overview]
Message-ID: <a3057ccf-786b-73a2-13fb-d264e7376a62@gmail.com> (raw)
In-Reply-To: <CAAa6QmT-4+Tx_VOVxGw+jO=Zh7+0NPLx8K+p0DsUd9WVoEvZNA@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2298 bytes --]

Hey Zach,

On 10/21/22 18:16, Zach O'Keefe wrote:
> Hey Alex!
> 
> Thanks for taking the time to review!
> 
> On Fri, Oct 21, 2022 at 5:41 AM Alejandro Colomar
> <alx.manpages@gmail.com> wrote:
>>
>> On 10/21/22 14:37, Alejandro Colomar wrote:
>>> On 10/19/22 01:50, Zach OKeefe wrote:
>>>> From: Zach O'Keefe <zokeefe@google.com>
>>>>
>>>> The initial commit of process_madvise(2) to man-pages project included
>>>> an error, indicating that CAP_SYS_ADMIN capability was required when, in
>>>> fact, CAP_SYS_NICE was the required capability.
>>>>
>>>> The initial commit of process_madvise(2) to Linux, commit ecb8ac8b1f14
>>>> ("mm/madvise: introduce process_madvise() syscall: an external memory
>>>> hinting API"), relied on PTRACE_MODE_ATTACH_FSCREDS (see ptrace(2)),
>>>> but was amended by commit 96cfe2c0fd23 ("mm/madvise: replace ptrace
>>>> attach requirement for process_madvise") which replaced this with a
>>>> combination of PTRACE_MODE_READ and CAP_SYS_NICE (PTRACE_MODE_READ to
>>>> prevent leaking ASLR metadata and CAP_SYS_NICE for influencing process
>>>> performance).
>>
>> [...]
>>
>>> If I understand the paragraph above, from 5.10 to 5.12 the capability required
>>> was CAP_SYS_ADMIN?
>>
>> Or was it CAP_SYS_PTRACE?
> 
> Starting in 5.10, there was no CAP_* capability requirement - only
> PTRACE_MODE_ATTACH_FSCREDS (aka PTRACE_MODE_ATTACH |
> PTRACE_MODE_REALCREDS). Now, my understanding of the algorithm
> employed for ptrace access mode checking isn't to be trusted, but
> AFAIK, a caller having CAP_SYS_PTRACE in the target's user namespace
> (directly or transitively) isn't required to pass this (though it
> makes it easier). ptrace(2) has an overview of the algorithm.
> 
> Starting in 5.12, CAP_SYS_NICE was added as a requirement, and the
> ptrace algorithm used changed to PTRACE_MODE_READ.

Understood.

> 
> If you think recording the differences in kernel versions in the
> man-page is important, let me know and I can amend this patch.

Yes; since it was live during 2 versions, I think we should at least mention it. 
  A couple of lines in NOTES might be enough.

Thanks,

Alex

> 
> Thanks,
> Zcah
> 
>> --
>> <http://www.alejandro-colomar.es/>

-- 
<http://www.alejandro-colomar.es/>

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-10-21 16:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18 23:50 [PATCH man-pages v2 0/4] Add MADV_COLLAPSE documentation Zach OKeefe
2022-10-18 23:50 ` [PATCH man-pages v2 1/4] madvise.2: update THP file/shmem documentation for +5.4 Zach OKeefe
2022-10-18 23:50 ` [PATCH man-pages v2 2/4] madvise.2: document reliable probe for advice support Zach OKeefe
2022-10-18 23:50 ` [PATCH man-pages v2 3/4] process_madvise.2: CAP_SYS_ADMIN cleanup Zach OKeefe
2022-10-19  0:11   ` Suren Baghdasaryan
2022-10-21 12:37   ` Alejandro Colomar
2022-10-21 12:41     ` Alejandro Colomar
2022-10-21 16:16       ` Zach O'Keefe
2022-10-21 16:30         ` Alejandro Colomar [this message]
2022-10-18 23:50 ` [PATCH man-pages v2 4/4] madvise.2: add documentation for MADV_COLLAPSE Zach OKeefe

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=a3057ccf-786b-73a2-13fb-d264e7376a62@gmail.com \
    --to=alx.manpages@gmail.com \
    --cc=linux-man@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=shy828301@gmail.com \
    --cc=surenb@google.com \
    --cc=zokeefe@google.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