arch/x86/lib/getuser.S
Source file repositories/reference/linux-study-clean/arch/x86/lib/getuser.S
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/lib/getuser.S- Extension
.S- Size
- 3540 bytes
- Lines
- 173
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- 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.
Dependency Surface
linux/export.hlinux/linkage.hlinux/objtool.hasm/page_types.hasm/errno.hasm/asm-offsets.hasm/thread_info.hasm/asm.hasm/smap.hasm/runtime-const.h
Detected Declarations
export __get_user_1export __get_user_2export __get_user_4export __get_user_8export __get_user_nocheck_1export __get_user_nocheck_2export __get_user_nocheck_4export __get_user_nocheck_8
Annotated Snippet
#include <linux/export.h>
#include <linux/linkage.h>
#include <linux/objtool.h>
#include <asm/page_types.h>
#include <asm/errno.h>
#include <asm/asm-offsets.h>
#include <asm/thread_info.h>
#include <asm/asm.h>
#include <asm/smap.h>
#include <asm/runtime-const.h>
#define ASM_BARRIER_NOSPEC ALTERNATIVE "", "lfence", X86_FEATURE_LFENCE_RDTSC
.macro check_range size:req
.if IS_ENABLED(CONFIG_X86_64)
RUNTIME_CONST_PTR USER_PTR_MAX, rdx
cmp %rdx, %rax
cmova %rdx, %rax
.else
cmp $TASK_SIZE_MAX-\size+1, %eax
jae .Lbad_get_user
sbb %edx, %edx /* array_index_mask_nospec() */
and %edx, %eax
.endif
.endm
.macro UACCESS op src dst
1: \op \src,\dst
_ASM_EXTABLE_UA(1b, __get_user_handle_exception)
.endm
.text
SYM_FUNC_START(__get_user_1)
ANNOTATE_NOENDBR
check_range size=1
ASM_STAC
UACCESS movzbl (%_ASM_AX),%edx
xor %eax,%eax
ASM_CLAC
RET
SYM_FUNC_END(__get_user_1)
EXPORT_SYMBOL(__get_user_1)
SYM_FUNC_START(__get_user_2)
ANNOTATE_NOENDBR
check_range size=2
ASM_STAC
UACCESS movzwl (%_ASM_AX),%edx
xor %eax,%eax
ASM_CLAC
RET
SYM_FUNC_END(__get_user_2)
EXPORT_SYMBOL(__get_user_2)
SYM_FUNC_START(__get_user_4)
ANNOTATE_NOENDBR
check_range size=4
ASM_STAC
UACCESS movl (%_ASM_AX),%edx
xor %eax,%eax
ASM_CLAC
RET
SYM_FUNC_END(__get_user_4)
EXPORT_SYMBOL(__get_user_4)
SYM_FUNC_START(__get_user_8)
ANNOTATE_NOENDBR
#ifndef CONFIG_X86_64
xor %ecx,%ecx
Annotation
- Immediate include surface: `linux/export.h`, `linux/linkage.h`, `linux/objtool.h`, `asm/page_types.h`, `asm/errno.h`, `asm/asm-offsets.h`, `asm/thread_info.h`, `asm/asm.h`.
- Detected declarations: `export __get_user_1`, `export __get_user_2`, `export __get_user_4`, `export __get_user_8`, `export __get_user_nocheck_1`, `export __get_user_nocheck_2`, `export __get_user_nocheck_4`, `export __get_user_nocheck_8`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: integration implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.