arch/powerpc/mm/nohash/kup.c

Source file repositories/reference/linux-study-clean/arch/powerpc/mm/nohash/kup.c

File Facts

System
Linux kernel
Corpus path
arch/powerpc/mm/nohash/kup.c
Extension
.c
Size
561 bytes
Lines
28
Domain
Architecture Layer
Bucket
arch/powerpc
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.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * This file contains the routines for initializing kernel userspace protection
 */

#include <linux/export.h>
#include <linux/init.h>
#include <linux/printk.h>
#include <linux/smp.h>

#include <asm/kup.h>
#include <asm/smp.h>

#ifdef CONFIG_PPC_KUAP
void setup_kuap(bool disabled)
{
	if (disabled) {
		if (smp_processor_id() == boot_cpuid)
			cur_cpu_spec->mmu_features &= ~MMU_FTR_KUAP;
		return;
	}

	pr_info("Activating Kernel Userspace Access Protection\n");

	prevent_user_access(KUAP_READ_WRITE);
}
#endif

Annotation

Implementation Notes