Thread (6 messages) 6 messages, 2 authors, 2020-09-30

[PATCH 1/2] sched_getattr.2: update to include changed size semantics

flat view
STALE2201d

From: Aleksa Sarai <hidden>
Date: 2020-09-29 22:36:07
Also in: linux-man
Subsystem: the rest · Maintainer: Linus Torvalds

Due to a userspace breakage, commit 1251201c0d34 ("sched/core: Fix
uclamp ABI bug, clean up and robustify sched_read_attr() ABI logic and
code") changed the semantics of sched_getattr(2) when the userspace
struct is smaller than the kernel struct. Now, any trailing non-zero
data in the kernel structure is ignored when copying to userspace. We
also document the original error code correctly (it was EFBIG not
E2BIG) in the BUGS section.

Ref: 1251201c0d34 ("sched/core: Fix uclamp ABI bug, clean up and
                    robustify sched_read_attr() ABI logic and code")
Signed-off-by: Aleksa Sarai <redacted>
---
 man2/sched_setattr.2 | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/man2/sched_setattr.2 b/man2/sched_setattr.2
index 2592a761a086..da0972a6a86d 100644
--- a/man2/sched_setattr.2
+++ b/man2/sched_setattr.2
@@ -286,10 +286,8 @@ structure,
 the additional bytes in the user-space structure are not touched.
 If the caller-provided structure is smaller than the kernel
 .I sched_attr
-structure and the kernel needs to return values outside the provided space,
-.BR sched_getattr ()
-fails with the error
-.BR E2BIG .
+structure, the kernel will silently not return any values which would be stored
+outside the provided space.
 As with
 .BR sched_setattr (),
 these semantics allow for future extensibility of the interface.
@@ -416,6 +414,16 @@ failed with the error
 instead of
 .BR E2BIG
 for the case described in ERRORS.
+.PP
+In Linux versions up to 5.3,
+.BR sched_getattr ()
+failed with the error
+.BR EFBIG
+if the in-kernel
+.IR sched_attr
+structure was larger than the
+.IR size
+passed by user space.
 .\" In Linux versions up to up 3.15,
 .\" FIXME . patch from Peter Zijlstra pending
 .\" .BR sched_setattr ()
-- 
2.28.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help