All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] admin-guide/hw-vuln/core-scheduling: fix return type of PR_SCHED_CORE_GET
@ 2024-04-23 10:34 Thomas Weißschuh
  2024-04-23 13:20 ` Chris Hyser
  2024-04-24 19:04 ` Jonathan Corbet
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Weißschuh @ 2024-04-23 10:34 UTC (permalink / raw)
  To: Thomas Gleixner, Borislav Petkov, Peter Zijlstra, Josh Poimboeuf,
	Pawan Gupta, Jonathan Corbet, Joel Fernandes (Google),
	Chris Hyser, Josh Don
  Cc: linux-doc, linux-kernel, stable, Thomas Weißschuh

sched_core_share_pid() copies the cookie to userspace with
put_user(id, (u64 __user *)uaddr), expecting 64 bits of space.
The "unsigned long" datatype that is documented in core-scheduling.rst
however is only 32 bits large on 32 bit architectures.

Document "unsigned long long" as the correct data type that is always
64bits large.

This matches what the selftest cs_prctl_test.c has been doing all along.

Fixes: 0159bb020ca9 ("Documentation: Add usecases, design and interface for core scheduling")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/util-linux/df7a25a0-7923-4f8b-a527-5e6f0064074d@t-8ch.de/
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 Documentation/admin-guide/hw-vuln/core-scheduling.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/admin-guide/hw-vuln/core-scheduling.rst b/Documentation/admin-guide/hw-vuln/core-scheduling.rst
index cf1eeefdfc32..a92e10ec402e 100644
--- a/Documentation/admin-guide/hw-vuln/core-scheduling.rst
+++ b/Documentation/admin-guide/hw-vuln/core-scheduling.rst
@@ -67,8 +67,8 @@ arg4:
     will be performed for all tasks in the task group of ``pid``.
 
 arg5:
-    userspace pointer to an unsigned long for storing the cookie returned by
-    ``PR_SCHED_CORE_GET`` command. Should be 0 for all other commands.
+    userspace pointer to an unsigned long long for storing the cookie returned
+    by ``PR_SCHED_CORE_GET`` command. Should be 0 for all other commands.
 
 In order for a process to push a cookie to, or pull a cookie from a process, it
 is required to have the ptrace access mode: `PTRACE_MODE_READ_REALCREDS` to the

---
base-commit: 71b1543c83d65af8215d7558d70fc2ecbee77dcf
change-id: 20240423-core-scheduling-cookie-b0551c40b086

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>


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

* Re: [PATCH] admin-guide/hw-vuln/core-scheduling: fix return type of PR_SCHED_CORE_GET
  2024-04-23 10:34 [PATCH] admin-guide/hw-vuln/core-scheduling: fix return type of PR_SCHED_CORE_GET Thomas Weißschuh
@ 2024-04-23 13:20 ` Chris Hyser
  2024-04-24 19:04 ` Jonathan Corbet
  1 sibling, 0 replies; 3+ messages in thread
From: Chris Hyser @ 2024-04-23 13:20 UTC (permalink / raw)
  To: Thomas Weißschuh, Thomas Gleixner, Borislav Petkov,
	Peter Zijlstra, Josh Poimboeuf, Pawan Gupta, Jonathan Corbet,
	Joel Fernandes (Google),
	Josh Don
  Cc: linux-doc, linux-kernel, stable

On 4/23/24 06:34, Thomas Weißschuh wrote:

> sched_core_share_pid() copies the cookie to userspace with
> put_user(id, (u64 __user *)uaddr), expecting 64 bits of space.
> The "unsigned long" datatype that is documented in core-scheduling.rst
> however is only 32 bits large on 32 bit architectures.
>
> Document "unsigned long long" as the correct data type that is always
> 64bits large.
>
> This matches what the selftest cs_prctl_test.c has been doing all along.
>
> Fixes: 0159bb020ca9 ("Documentation: Add usecases, design and interface for core scheduling")
> Cc: stable@vger.kernel.org
> Link: https://lore.kernel.org/util-linux/df7a25a0-7923-4f8b-a527-5e6f0064074d@t-8ch.de/
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
>   Documentation/admin-guide/hw-vuln/core-scheduling.rst | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/admin-guide/hw-vuln/core-scheduling.rst b/Documentation/admin-guide/hw-vuln/core-scheduling.rst
> index cf1eeefdfc32..a92e10ec402e 100644
> --- a/Documentation/admin-guide/hw-vuln/core-scheduling.rst
> +++ b/Documentation/admin-guide/hw-vuln/core-scheduling.rst
> @@ -67,8 +67,8 @@ arg4:
>       will be performed for all tasks in the task group of ``pid``.
>   
>   arg5:
> -    userspace pointer to an unsigned long for storing the cookie returned by
> -    ``PR_SCHED_CORE_GET`` command. Should be 0 for all other commands.
> +    userspace pointer to an unsigned long long for storing the cookie returned
> +    by ``PR_SCHED_CORE_GET`` command. Should be 0 for all other commands.
>   


Yes you're right, that is what the test code actually does.


Reviewed-by: Chris Hyser <chris.hyser@oracle.com>


>   In order for a process to push a cookie to, or pull a cookie from a process, it
>   is required to have the ptrace access mode: `PTRACE_MODE_READ_REALCREDS` to the
>
> ---
> base-commit: 71b1543c83d65af8215d7558d70fc2ecbee77dcf
> change-id: 20240423-core-scheduling-cookie-b0551c40b086
>
> Best regards,

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

* Re: [PATCH] admin-guide/hw-vuln/core-scheduling: fix return type of PR_SCHED_CORE_GET
  2024-04-23 10:34 [PATCH] admin-guide/hw-vuln/core-scheduling: fix return type of PR_SCHED_CORE_GET Thomas Weißschuh
  2024-04-23 13:20 ` Chris Hyser
@ 2024-04-24 19:04 ` Jonathan Corbet
  1 sibling, 0 replies; 3+ messages in thread
From: Jonathan Corbet @ 2024-04-24 19:04 UTC (permalink / raw)
  To: Thomas Weißschuh, Thomas Gleixner, Borislav Petkov,
	Peter Zijlstra, Josh Poimboeuf, Pawan Gupta,
	Joel Fernandes (Google),
	Chris Hyser, Josh Don
  Cc: linux-doc, linux-kernel, stable, Thomas Weißschuh

Thomas Weißschuh <linux@weissschuh.net> writes:

> sched_core_share_pid() copies the cookie to userspace with
> put_user(id, (u64 __user *)uaddr), expecting 64 bits of space.
> The "unsigned long" datatype that is documented in core-scheduling.rst
> however is only 32 bits large on 32 bit architectures.
>
> Document "unsigned long long" as the correct data type that is always
> 64bits large.
>
> This matches what the selftest cs_prctl_test.c has been doing all along.
>
> Fixes: 0159bb020ca9 ("Documentation: Add usecases, design and interface for core scheduling")
> Cc: stable@vger.kernel.org
> Link: https://lore.kernel.org/util-linux/df7a25a0-7923-4f8b-a527-5e6f0064074d@t-8ch.de/
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
>  Documentation/admin-guide/hw-vuln/core-scheduling.rst | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/admin-guide/hw-vuln/core-scheduling.rst b/Documentation/admin-guide/hw-vuln/core-scheduling.rst
> index cf1eeefdfc32..a92e10ec402e 100644
> --- a/Documentation/admin-guide/hw-vuln/core-scheduling.rst
> +++ b/Documentation/admin-guide/hw-vuln/core-scheduling.rst
> @@ -67,8 +67,8 @@ arg4:
>      will be performed for all tasks in the task group of ``pid``.
>  
>  arg5:
> -    userspace pointer to an unsigned long for storing the cookie returned by
> -    ``PR_SCHED_CORE_GET`` command. Should be 0 for all other commands.
> +    userspace pointer to an unsigned long long for storing the cookie returned
> +    by ``PR_SCHED_CORE_GET`` command. Should be 0 for all other commands.
>  

Applied, thanks.

jon

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

end of thread, other threads:[~2024-04-24 19:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-23 10:34 [PATCH] admin-guide/hw-vuln/core-scheduling: fix return type of PR_SCHED_CORE_GET Thomas Weißschuh
2024-04-23 13:20 ` Chris Hyser
2024-04-24 19:04 ` Jonathan Corbet

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.