Patch "sched/headers: Move 'struct sched_param' out of uapi, to work around glibc/musl breakage" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    sched/headers: Move 'struct sched_param' out of uapi, to work around glibc/musl breakage

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     sched-headers-move-struct-sched_param-out-of-uapi-to.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a2306ba0f6fc0cff62d3db4ab0a5fcb941d92de8
Author: Kir Kolyshkin <kolyshkin@xxxxxxxxx>
Date:   Mon Aug 7 20:03:57 2023 -0700

    sched/headers: Move 'struct sched_param' out of uapi, to work around glibc/musl breakage
    
    [ Upstream commit d844fe65f0957024c3e1b0bf2a0615246184d9bc ]
    
    Both glibc and musl define 'struct sched_param' in sched.h, while kernel
    has it in uapi/linux/sched/types.h, making it cumbersome to use
    sched_getattr(2) or sched_setattr(2) from userspace.
    
    For example, something like this:
    
            #include <sched.h>
            #include <linux/sched/types.h>
    
            struct sched_attr sa;
    
    will result in "error: redefinition of ‘struct sched_param’" (note the
    code doesn't need sched_param at all -- it needs struct sched_attr
    plus some stuff from sched.h).
    
    The situation is, glibc is not going to provide a wrapper for
    sched_{get,set}attr, thus the need to include linux/sched_types.h
    directly, which leads to the above problem.
    
    Thus, the userspace is left with a few sub-par choices when it wants to
    use e.g. sched_setattr(2), such as maintaining a copy of struct
    sched_attr definition, or using some other ugly tricks.
    
    OTOH, 'struct sched_param' is well known, defined in POSIX, and it won't
    be ever changed (as that would break backward compatibility).
    
    So, while 'struct sched_param' is indeed part of the kernel uapi,
    exposing it the way it's done now creates an issue, and hiding it
    (like this patch does) fixes that issue, hopefully without creating
    another one: common userspace software rely on libc headers, and as
    for "special" software (like libc), it looks like glibc and musl
    do not rely on kernel headers for 'struct sched_param' definition
    (but let's Cc their mailing lists in case it's otherwise).
    
    The alternative to this patch would be to move struct sched_attr to,
    say, linux/sched.h, or linux/sched/attr.h (the new file).
    
    Oh, and here is the previous attempt to fix the issue:
    
      https://lore.kernel.org/all/20200528135552.GA87103@xxxxxxxxxx/
    
    While I support Linus arguments, the issue is still here
    and needs to be fixed.
    
    [ mingo: Linus is right, this shouldn't be needed - but on the other
             hand I agree that this header is not really helpful to
             user-space as-is. So let's pretend that
             <uapi/linux/sched/types.h> is only about sched_attr, and
             call this commit a workaround for user-space breakage
             that it in reality is ... Also, remove the Fixes tag. ]
    
    Signed-off-by: Kir Kolyshkin <kolyshkin@xxxxxxxxx>
    Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
    Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
    Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230808030357.1213829-1-kolyshkin@xxxxxxxxx
    Stable-dep-of: 0664e2c311b9 ("sched/deadline: Fix warning in migrate_enable for boosted tasks")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 3d83cc397eac1..323aa1aaaf91e 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -63,7 +63,6 @@ struct robust_list_head;
 struct root_domain;
 struct rq;
 struct sched_attr;
-struct sched_param;
 struct seq_file;
 struct sighand_struct;
 struct signal_struct;
@@ -370,6 +369,10 @@ extern struct root_domain def_root_domain;
 extern struct mutex sched_domains_mutex;
 #endif
 
+struct sched_param {
+	int sched_priority;
+};
+
 struct sched_info {
 #ifdef CONFIG_SCHED_INFO
 	/* Cumulative counters: */
diff --git a/include/uapi/linux/sched/types.h b/include/uapi/linux/sched/types.h
index f2c4589d4dbfe..90662385689bb 100644
--- a/include/uapi/linux/sched/types.h
+++ b/include/uapi/linux/sched/types.h
@@ -4,10 +4,6 @@
 
 #include <linux/types.h>
 
-struct sched_param {
-	int sched_priority;
-};
-
 #define SCHED_ATTR_SIZE_VER0	48	/* sizeof first published struct */
 #define SCHED_ATTR_SIZE_VER1	56	/* add: util_{min,max} */
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux