public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] prctl.2: Document PR_SET_MDWE and PR_GET_MDWE
@ 2023-10-11 11:47 Florent Revest
  2023-10-11 15:13 ` Catalin Marinas
  2023-10-14 22:32 ` Alejandro Colomar
  0 siblings, 2 replies; 4+ messages in thread
From: Florent Revest @ 2023-10-11 11:47 UTC (permalink / raw)
  To: alx; +Cc: linux-man, joey.gouly, akpm, keescook, catalin.marinas,
	Florent Revest

Memory-Deny-Write-Execute is a W^X process control originally introduced
by Joey Gouly. I'm the author of the PR_MDWE_NO_INHERIT flag.

Signed-off-by: Florent Revest <revest@chromium.org>
---

Diff since v1:
- Use semantic newlines
- Document that PR_MDWE_NO_INHERIT requires PR_MDWE_REFUSE_EXEC_GAIN
- Use "bit mask" instead of "bitmask" according to the style guide
- Removed an empty comment line

 man2/prctl.2 | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/man2/prctl.2 b/man2/prctl.2
index d845b0905..83060edd9 100644
--- a/man2/prctl.2
+++ b/man2/prctl.2
@@ -2041,6 +2041,36 @@ the copy will be truncated.
 Return (as the function result)
 the full length of the auxiliary vector.
 \fIarg4\fP and \fIarg5\fP must be 0.
+.TP
+.BR PR_SET_MDWE " (since Linux 6.3)"
+.\" commit b507808ebce23561d4ff8c2aa1fb949fe402bc61
+Set the calling process' Memory-Deny-Write-Execute protection mask.
+Once protection bits are set,
+they can not be changed.
+.IR arg2
+must be a bit mask of:
+.RS
+.TP
+.B PR_MDWE_REFUSE_EXEC_GAIN
+New memory mapping protections can't be writable and executable.
+Non-executable mappings can't become executable.
+.TP
+.B PR_MDWE_NO_INHERIT " (since Linux 6.6)"
+.\" commit 2a87e5520554034e8c423479740f95bea4a086a0
+Do not propagate MDWE protection to child processes on
+.BR fork (2).
+Setting this bit requires setting
+.B PR_MDWE_REFUSE_EXEC_GAIN
+too.
+.RE
+.TP
+.BR PR_GET_MDWE " (since Linux 6.3)"
+.\" commit b507808ebce23561d4ff8c2aa1fb949fe402bc61
+Return (as the function result) the Memory-Deny-Write-Execute protection mask
+of the calling process.
+(See
+.B PR_SET_MDWE
+for information on the protection mask bits.)
 .SH RETURN VALUE
 On success,
 .BR PR_CAP_AMBIENT + PR_CAP_AMBIENT_IS_SET ,
-- 
2.42.0.655.g421f12c284-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] prctl.2: Document PR_SET_MDWE and PR_GET_MDWE
  2023-10-11 11:47 [PATCH v2] prctl.2: Document PR_SET_MDWE and PR_GET_MDWE Florent Revest
@ 2023-10-11 15:13 ` Catalin Marinas
  2023-10-14 22:31   ` Alejandro Colomar
  2023-10-14 22:32 ` Alejandro Colomar
  1 sibling, 1 reply; 4+ messages in thread
From: Catalin Marinas @ 2023-10-11 15:13 UTC (permalink / raw)
  To: Florent Revest; +Cc: alx, linux-man, joey.gouly, akpm, keescook

On Wed, Oct 11, 2023 at 01:47:44PM +0200, Florent Revest wrote:
> Memory-Deny-Write-Execute is a W^X process control originally introduced
> by Joey Gouly. I'm the author of the PR_MDWE_NO_INHERIT flag.
> 
> Signed-off-by: Florent Revest <revest@chromium.org>

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] prctl.2: Document PR_SET_MDWE and PR_GET_MDWE
  2023-10-11 15:13 ` Catalin Marinas
@ 2023-10-14 22:31   ` Alejandro Colomar
  0 siblings, 0 replies; 4+ messages in thread
From: Alejandro Colomar @ 2023-10-14 22:31 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: Florent Revest, linux-man, joey.gouly, akpm, keescook

[-- Attachment #1: Type: text/plain, Size: 473 bytes --]

On Wed, Oct 11, 2023 at 04:13:08PM +0100, Catalin Marinas wrote:
> On Wed, Oct 11, 2023 at 01:47:44PM +0200, Florent Revest wrote:
> > Memory-Deny-Write-Execute is a W^X process control originally introduced
> > by Joey Gouly. I'm the author of the PR_MDWE_NO_INHERIT flag.
> > 
> > Signed-off-by: Florent Revest <revest@chromium.org>
> 
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>

Thanks for the review!

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

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] prctl.2: Document PR_SET_MDWE and PR_GET_MDWE
  2023-10-11 11:47 [PATCH v2] prctl.2: Document PR_SET_MDWE and PR_GET_MDWE Florent Revest
  2023-10-11 15:13 ` Catalin Marinas
@ 2023-10-14 22:32 ` Alejandro Colomar
  1 sibling, 0 replies; 4+ messages in thread
From: Alejandro Colomar @ 2023-10-14 22:32 UTC (permalink / raw)
  To: Florent Revest; +Cc: linux-man, joey.gouly, akpm, keescook, catalin.marinas

[-- Attachment #1: Type: text/plain, Size: 2674 bytes --]

Hi Florent,

On Wed, Oct 11, 2023 at 01:47:44PM +0200, Florent Revest wrote:
> Memory-Deny-Write-Execute is a W^X process control originally introduced
> by Joey Gouly. I'm the author of the PR_MDWE_NO_INHERIT flag.
> 
> Signed-off-by: Florent Revest <revest@chromium.org>
> ---

Patch applied.
<https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib&id=457ca4a9ae3eae9835a5c011851c4eb88b49d322>

Thanks,
Alex

> 
> Diff since v1:
> - Use semantic newlines
> - Document that PR_MDWE_NO_INHERIT requires PR_MDWE_REFUSE_EXEC_GAIN
> - Use "bit mask" instead of "bitmask" according to the style guide
> - Removed an empty comment line
> 
>  man2/prctl.2 | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/man2/prctl.2 b/man2/prctl.2
> index d845b0905..83060edd9 100644
> --- a/man2/prctl.2
> +++ b/man2/prctl.2
> @@ -2041,6 +2041,36 @@ the copy will be truncated.
>  Return (as the function result)
>  the full length of the auxiliary vector.
>  \fIarg4\fP and \fIarg5\fP must be 0.
> +.TP
> +.BR PR_SET_MDWE " (since Linux 6.3)"
> +.\" commit b507808ebce23561d4ff8c2aa1fb949fe402bc61
> +Set the calling process' Memory-Deny-Write-Execute protection mask.
> +Once protection bits are set,
> +they can not be changed.
> +.IR arg2

This should've been .I.  I've amended the patch:

diff --git a/man2/prctl.2 b/man2/prctl.2
index 83060edd9..de53acfb0 100644
--- a/man2/prctl.2
+++ b/man2/prctl.2
@@ -2047,7 +2047,7 @@ .SH DESCRIPTION
 Set the calling process' Memory-Deny-Write-Execute protection mask.
 Once protection bits are set,
 they can not be changed.
-.IR arg2
+.I arg2
 must be a bit mask of:
 .RS
 .TP

> +must be a bit mask of:
> +.RS
> +.TP
> +.B PR_MDWE_REFUSE_EXEC_GAIN
> +New memory mapping protections can't be writable and executable.
> +Non-executable mappings can't become executable.
> +.TP
> +.B PR_MDWE_NO_INHERIT " (since Linux 6.6)"
> +.\" commit 2a87e5520554034e8c423479740f95bea4a086a0
> +Do not propagate MDWE protection to child processes on
> +.BR fork (2).
> +Setting this bit requires setting
> +.B PR_MDWE_REFUSE_EXEC_GAIN
> +too.
> +.RE
> +.TP
> +.BR PR_GET_MDWE " (since Linux 6.3)"
> +.\" commit b507808ebce23561d4ff8c2aa1fb949fe402bc61
> +Return (as the function result) the Memory-Deny-Write-Execute protection mask
> +of the calling process.
> +(See
> +.B PR_SET_MDWE
> +for information on the protection mask bits.)
>  .SH RETURN VALUE
>  On success,
>  .BR PR_CAP_AMBIENT + PR_CAP_AMBIENT_IS_SET ,
> -- 
> 2.42.0.655.g421f12c284-goog
> 

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

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-10-14 22:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-11 11:47 [PATCH v2] prctl.2: Document PR_SET_MDWE and PR_GET_MDWE Florent Revest
2023-10-11 15:13 ` Catalin Marinas
2023-10-14 22:31   ` Alejandro Colomar
2023-10-14 22:32 ` Alejandro Colomar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox