arch/arm64/kernel/mte.c

Source file repositories/reference/linux-study-clean/arch/arm64/kernel/mte.c

File Facts

System
Linux kernel
Corpus path
arch/arm64/kernel/mte.c
Extension
.c
Size
16525 bytes
Lines
660
Domain
Architecture Layer
Bucket
arch/arm64
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.

Dependency Surface

Detected Declarations

Annotated Snippet

subsys_initcall(register_mte_tcf_preferred_sysctl);

/*
 * Return 0 on success, the number of bytes not probed otherwise.
 */
size_t mte_probe_user_range(const char __user *uaddr, size_t size)
{
	const char __user *end = uaddr + size;
	char val;

	__raw_get_user(val, uaddr, efault);

	uaddr = PTR_ALIGN(uaddr, MTE_GRANULE_SIZE);
	while (uaddr < end) {
		/*
		 * A read is sufficient for mte, the caller should have probed
		 * for the pte write permission if required.
		 */
		__raw_get_user(val, uaddr, efault);
		uaddr += MTE_GRANULE_SIZE;
	}
	(void)val;

	return 0;

efault:
	return end - uaddr;
}

Annotation

Implementation Notes