mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-02 12:34:06 +00:00
userns: use union in {g,u}idmap struct
- Add a struct containing two pointer to extents and wrap both the static extent array and the struct into a union. This is done in preparation for bumping the {g,u}idmap limits for user namespaces. - Add brackets around anonymous union when using designated initializers to initialize members in order to please gcc <= 4.4. Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
This commit is contained in:
parent
e19b205be4
commit
aa4bf44dc8
2 changed files with 31 additions and 17 deletions
|
@ -12,13 +12,21 @@
|
||||||
|
|
||||||
#define UID_GID_MAP_MAX_EXTENTS 5
|
#define UID_GID_MAP_MAX_EXTENTS 5
|
||||||
|
|
||||||
|
struct uid_gid_extent {
|
||||||
|
u32 first;
|
||||||
|
u32 lower_first;
|
||||||
|
u32 count;
|
||||||
|
};
|
||||||
|
|
||||||
struct uid_gid_map { /* 64 bytes -- 1 cache line */
|
struct uid_gid_map { /* 64 bytes -- 1 cache line */
|
||||||
u32 nr_extents;
|
u32 nr_extents;
|
||||||
struct uid_gid_extent {
|
union {
|
||||||
u32 first;
|
struct uid_gid_extent extent[UID_GID_MAP_MAX_EXTENTS];
|
||||||
u32 lower_first;
|
struct {
|
||||||
u32 count;
|
struct uid_gid_extent *forward;
|
||||||
} extent[UID_GID_MAP_MAX_EXTENTS];
|
struct uid_gid_extent *reverse;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#define USERNS_SETGROUPS_ALLOWED 1UL
|
#define USERNS_SETGROUPS_ALLOWED 1UL
|
||||||
|
|
|
@ -26,26 +26,32 @@
|
||||||
struct user_namespace init_user_ns = {
|
struct user_namespace init_user_ns = {
|
||||||
.uid_map = {
|
.uid_map = {
|
||||||
.nr_extents = 1,
|
.nr_extents = 1,
|
||||||
.extent[0] = {
|
{
|
||||||
.first = 0,
|
.extent[0] = {
|
||||||
.lower_first = 0,
|
.first = 0,
|
||||||
.count = 4294967295U,
|
.lower_first = 0,
|
||||||
|
.count = 4294967295U,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
.gid_map = {
|
.gid_map = {
|
||||||
.nr_extents = 1,
|
.nr_extents = 1,
|
||||||
.extent[0] = {
|
{
|
||||||
.first = 0,
|
.extent[0] = {
|
||||||
.lower_first = 0,
|
.first = 0,
|
||||||
.count = 4294967295U,
|
.lower_first = 0,
|
||||||
|
.count = 4294967295U,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
.projid_map = {
|
.projid_map = {
|
||||||
.nr_extents = 1,
|
.nr_extents = 1,
|
||||||
.extent[0] = {
|
{
|
||||||
.first = 0,
|
.extent[0] = {
|
||||||
.lower_first = 0,
|
.first = 0,
|
||||||
.count = 4294967295U,
|
.lower_first = 0,
|
||||||
|
.count = 4294967295U,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
.count = ATOMIC_INIT(3),
|
.count = ATOMIC_INIT(3),
|
||||||
|
|
Loading…
Add table
Reference in a new issue