mirror of
https://github.com/torvalds/linux.git
synced 2026-10-23 07:11:03 +02:00
fs: make nop_mnt_idmap and invalid_mnt_idmap const
Make both static maps const so they end up in rodata. Any attempt to modify them now faults instead of silently corrupting the initial idmapping. Link: https://patch.msgid.link/20260901-work-idmap-const-v1-27-54ccd48e100b@kernel.org Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Seth Forshee <sforshee@kernel.org> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
This commit is contained in:
parent
025756ee7b
commit
04fcaedd25
|
|
@ -28,7 +28,7 @@ struct mnt_idmap {
|
|||
* mapping. This means that {g,u}id 0 is mapped to {g,u}id 0, {g,u}id 1 is
|
||||
* mapped to {g,u}id 1, [...], {g,u}id 1000 to {g,u}id 1000, [...].
|
||||
*/
|
||||
struct mnt_idmap nop_mnt_idmap = {
|
||||
const struct mnt_idmap nop_mnt_idmap = {
|
||||
.count = REFCOUNT_INIT(1),
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(nop_mnt_idmap);
|
||||
|
|
@ -37,7 +37,7 @@ EXPORT_SYMBOL_GPL(nop_mnt_idmap);
|
|||
* Carries the invalid idmapping of a full 0-4294967295 {g,u}id range.
|
||||
* This means that all {g,u}ids are mapped to INVALID_VFS{G,U}ID.
|
||||
*/
|
||||
struct mnt_idmap invalid_mnt_idmap = {
|
||||
const struct mnt_idmap invalid_mnt_idmap = {
|
||||
.count = REFCOUNT_INIT(1),
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(invalid_mnt_idmap);
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
struct mnt_idmap;
|
||||
struct user_namespace;
|
||||
|
||||
extern struct mnt_idmap nop_mnt_idmap;
|
||||
extern struct mnt_idmap invalid_mnt_idmap;
|
||||
extern const struct mnt_idmap nop_mnt_idmap;
|
||||
extern const struct mnt_idmap invalid_mnt_idmap;
|
||||
extern struct user_namespace init_user_ns;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user