Skip to content

Commit d5f2322

Browse files
drakenclimberjfvogel
authored andcommitted
clone3: Add padding for kABI
This commit cherry-picks the header changes from two recent upstream clone3 changes: 49cb2fc Adrian Reber fork: extend clone3() to support setting a PID ef2c41c Christian Brauner clone3: allow spawning processes into cgroups Note that the actual implementations were not backported in this commit; only the header changes that would affect the kABI were backported. Orabug: 30958591 Signed-off-by: Tom Hromatka <[email protected]> Reviewed-by: chris hyser <[email protected]>
1 parent 24acafe commit d5f2322

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

include/linux/sched/task.h

+14
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@ struct kernel_clone_args {
2626
unsigned long stack;
2727
unsigned long stack_size;
2828
unsigned long tls;
29+
/*
30+
* The following attributes were cherry-picked from commits
31+
* 49cb2fc42ce4b and ef2c41cf38a75 in Tejun Heo's "for-5.7" branch
32+
* in https://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git/
33+
*
34+
* Note that these values are currently unused but are reserved for
35+
* use if/when these clone3 features are added to UEK6.
36+
*/
37+
pid_t *set_tid;
38+
/* Number of elements in *set_tid */
39+
size_t set_tid_size;
40+
int cgroup;
41+
struct cgroup *cgrp;
42+
struct css_set *cset;
2943
};
3044

3145
/*

include/uapi/linux/sched.h

+32
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,25 @@
5959
* @tls: If CLONE_SETTLS is set, the tls descriptor
6060
* is set to tls.
6161
*
62+
* The following structure members are not yet utilized by UEK6.
63+
*
64+
* @set_tid: Pointer to an array of type *pid_t. The size
65+
* of the array is defined using @set_tid_size.
66+
* This array is used to select PIDs/TIDs for
67+
* newly created processes. The first element in
68+
* this defines the PID in the most nested PID
69+
* namespace. Each additional element in the array
70+
* defines the PID in the parent PID namespace of
71+
* the original PID namespace. If the array has
72+
* less entries than the number of currently
73+
* nested PID namespaces only the PIDs in the
74+
* corresponding namespaces are set.
75+
* @set_tid_size: This defines the size of the array referenced
76+
* in @set_tid. This cannot be larger than the
77+
* kernel's limit of nested PID namespaces.
78+
* @cgroup: If CLONE_INTO_CGROUP is specified set this to
79+
* a file descriptor for the cgroup.
80+
*
6281
* The structure is versioned by size and thus extensible.
6382
* New struct members must go at the end of the struct and
6483
* must be properly 64bit aligned.
@@ -72,10 +91,23 @@ struct clone_args {
7291
__aligned_u64 stack;
7392
__aligned_u64 stack_size;
7493
__aligned_u64 tls;
94+
/*
95+
* The following attributes were cherry-picked from commits
96+
* 49cb2fc42ce4b and ef2c41cf38a75 in Tejun Heo's "for-5.7" branch
97+
* in https://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git/
98+
*
99+
* Note that these values are currently unused but are reserved for
100+
* use if/when these clone3 features are added to UEK6.
101+
*/
102+
__aligned_u64 set_tid;
103+
__aligned_u64 set_tid_size;
104+
__aligned_u64 cgroup;
75105
};
76106
#endif
77107

78108
#define CLONE_ARGS_SIZE_VER0 64 /* sizeof first published struct */
109+
#define CLONE_ARGS_SIZE_VER1 80 /* sizeof second published struct */
110+
#define CLONE_ARGS_SIZE_VER2 88 /* sizeof third published struct */
79111

80112
/*
81113
* Scheduling policies

0 commit comments

Comments
 (0)