kernel/user_namespace.c
Source file repositories/reference/linux-study-clean/kernel/user_namespace.c
File Facts
- System
- Linux kernel
- Corpus path
kernel/user_namespace.c- Extension
.c- Size
- 36613 bytes
- Lines
- 1416
- Domain
- Core OS
- Bucket
- Scheduler, Processes, Timers, Sync, And Syscalls
- Inferred role
- Core OS: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/export.hlinux/nsproxy.hlinux/slab.hlinux/sched/signal.hlinux/user_namespace.hlinux/proc_ns.hlinux/highuid.hlinux/cred.hlinux/securebits.hlinux/security.hlinux/keyctl.hlinux/key-type.hkeys/user-type.hlinux/seq_file.hlinux/fs.hlinux/uaccess.hlinux/ctype.hlinux/projid.hlinux/fs_struct.hlinux/bsearch.hlinux/sort.hlinux/nstree.h
Detected Declarations
struct idmap_keyfunction dec_user_namespacesfunction set_cred_user_nsfunction enforced_nproc_rlimitfunction copy_credsfunction unshare_usernsfunction free_user_nsfunction __put_user_nsfunction cmp_map_idfunction map_id_range_down_maxfunction map_id_range_down_basefunction map_id_range_downfunction map_id_downfunction map_id_range_up_basefunction map_id_range_up_maxfunction map_id_range_upfunction map_id_upfunction uid_validfunction from_kuidfunction from_kuid_mungedfunction gid_validfunction from_kgidfunction from_kgid_mungedfunction projid_validfunction from_kprojidfunction from_kprojid_mungedfunction uid_m_showfunction gid_m_showfunction projid_m_showfunction m_stopfunction mappings_overlapfunction insert_extentfunction cmp_extents_forwardfunction cmp_extents_reversefunction sort_idmapsfunction verify_root_mapfunction map_writefunction proc_uid_map_writefunction proc_gid_map_writefunction proc_projid_map_writefunction new_idmap_permittedfunction uid_eqfunction proc_setgroups_showfunction proc_setgroups_writefunction userns_may_setgroupsfunction in_usernsfunction current_in_usernsfunction userns_put
Annotated Snippet
subsys_initcall(user_namespaces_init);
Annotation
- Immediate include surface: `linux/export.h`, `linux/nsproxy.h`, `linux/slab.h`, `linux/sched/signal.h`, `linux/user_namespace.h`, `linux/proc_ns.h`, `linux/highuid.h`, `linux/cred.h`.
- Detected declarations: `struct idmap_key`, `function dec_user_namespaces`, `function set_cred_user_ns`, `function enforced_nproc_rlimit`, `function copy_creds`, `function unshare_userns`, `function free_user_ns`, `function __put_user_ns`, `function cmp_map_id`, `function map_id_range_down_max`.
- Atlas domain: Core OS / Scheduler, Processes, Timers, Sync, And Syscalls.
- Implementation status: integration implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.