arch/s390/include/asm/uaccess.h
Source file repositories/reference/linux-study-clean/arch/s390/include/asm/uaccess.h
File Facts
- System
- Linux kernel
- Corpus path
arch/s390/include/asm/uaccess.h- Extension
.h- Size
- 13070 bytes
- Lines
- 485
- Domain
- Architecture Layer
- Bucket
- arch/s390
- Inferred role
- Architecture Layer: implementation source
- Status
- source 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
Dependency Surface
linux/pgtable.hasm/asm-extable.hasm/processor.hasm/extable.hasm/facility.hasm-generic/access_ok.hasm/asce.hlinux/instrumented.h
Detected Declarations
function raw_copy_from_userfunction raw_copy_to_userfunction copy_from_user_keyfunction copy_to_user_keyfunction __clear_userfunction clear_user
Annotated Snippet
#ifndef __S390_UACCESS_H
#define __S390_UACCESS_H
/*
* User space memory access functions
*/
#include <linux/pgtable.h>
#include <asm/asm-extable.h>
#include <asm/processor.h>
#include <asm/extable.h>
#include <asm/facility.h>
#include <asm-generic/access_ok.h>
#include <asm/asce.h>
#include <linux/instrumented.h>
void debug_user_asce(int exit);
#ifdef CONFIG_KMSAN
#define uaccess_kmsan_or_inline noinline __maybe_unused __no_sanitize_memory
#else
#define uaccess_kmsan_or_inline __always_inline
#endif
#define INLINE_COPY_USER
static uaccess_kmsan_or_inline __must_check unsigned long
raw_copy_from_user(void *to, const void __user *from, unsigned long size)
{
unsigned long osize;
int cc;
while (1) {
osize = size;
asm_inline volatile(
" lhi %%r0,%[spec]\n"
"0: mvcos %[to],%[from],%[size]\n"
"1: nopr %%r7\n"
CC_IPM(cc)
EX_TABLE_UA_MVCOS_FROM(0b, 0b)
EX_TABLE_UA_MVCOS_FROM(1b, 0b)
: CC_OUT(cc, cc), [size] "+d" (size), [to] "=Q" (*(char *)to)
: [spec] "I" (0x81), [from] "Q" (*(const char __user *)from)
: CC_CLOBBER_LIST("memory", "0"));
if (__builtin_constant_p(osize) && osize <= 4096)
return osize - size;
if (likely(CC_TRANSFORM(cc) == 0))
return osize - size;
size -= 4096;
to += 4096;
from += 4096;
}
}
static uaccess_kmsan_or_inline __must_check unsigned long
raw_copy_to_user(void __user *to, const void *from, unsigned long size)
{
unsigned long osize;
int cc;
while (1) {
osize = size;
asm_inline volatile(
" llilh %%r0,%[spec]\n"
"0: mvcos %[to],%[from],%[size]\n"
"1: nopr %%r7\n"
CC_IPM(cc)
EX_TABLE_UA_MVCOS_TO(0b, 0b)
EX_TABLE_UA_MVCOS_TO(1b, 0b)
: CC_OUT(cc, cc), [size] "+d" (size), [to] "=Q" (*(char __user *)to)
: [spec] "I" (0x81), [from] "Q" (*(const char *)from)
: CC_CLOBBER_LIST("memory", "0"));
if (__builtin_constant_p(osize) && osize <= 4096)
return osize - size;
if (likely(CC_TRANSFORM(cc) == 0))
return osize - size;
size -= 4096;
to += 4096;
from += 4096;
}
}
unsigned long __must_check
_copy_from_user_key(void *to, const void __user *from, unsigned long n, unsigned long key);
static __always_inline unsigned long __must_check
copy_from_user_key(void *to, const void __user *from, unsigned long n, unsigned long key)
{
if (check_copy_size(to, n, false))
n = _copy_from_user_key(to, from, n, key);
return n;
Annotation
- Immediate include surface: `linux/pgtable.h`, `asm/asm-extable.h`, `asm/processor.h`, `asm/extable.h`, `asm/facility.h`, `asm-generic/access_ok.h`, `asm/asce.h`, `linux/instrumented.h`.
- Detected declarations: `function raw_copy_from_user`, `function raw_copy_to_user`, `function copy_from_user_key`, `function copy_to_user_key`, `function __clear_user`, `function clear_user`.
- Atlas domain: Architecture Layer / arch/s390.
- Implementation status: source 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.