Skip to contentSkip to conversation

ARM: make <linux/uaccess.h> self-contained for ARM

PATCH In review Masahiro Yamada 2 participants 2 messages Sep 26, 2023 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: make <linux/uaccess.h> self-contained for ARM

When I compiled the following code for ARM, I encountered numerous errors.

[Test Code]

    #include <linux/compiler.h>
    #include <linux/uaccess.h>

    int foo(int *x, int __user *ptr)
    {
            return get_user(*x, ptr);
    }

To fix them, make some asm headers self-contained:

1. In arch/arm/include/asm/traps.h, include <linux/init.h> for __init, and <linux/linkage.h> for asmlinkage.

2. In arch/arm/include/asm/domain.h, include <linux/thread_info.h> for current_thread_info().

3. In arch/arm/include/asm/uaccess.h, include <linux/kernel.h> for

    might_fault().

---

KernelVersion: v6.6-rc1

 arch/arm/include/asm/domain.h  | 2 +-
 arch/arm/include/asm/traps.h   | 2 ++
 arch/arm/include/asm/uaccess.h | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)
arch/arm/include/asm/domain.h +1 -1
index 41536feb4392..d48859fdf32c 100644
@@ -8,8 +8,8 @@
 #define __ASM_PROC_DOMAIN_H
 
 #ifndef __ASSEMBLY__
+#include <linux/thread_info.h>
 #include <asm/barrier.h>
-#include <asm/thread_info.h>
 #endif
 
 /*
arch/arm/include/asm/traps.h +2 -0
index 0aaefe3e1700..d44df9eac170 100644
@@ -2,6 +2,8 @@
 #ifndef _ASMARM_TRAP_H
 #define _ASMARM_TRAP_H
 
+#include <linux/init.h>
+#include <linux/linkage.h>
 #include <linux/list.h>
 
 struct pt_regs;
arch/arm/include/asm/uaccess.h +1 -0
index bb5c81823117..6a2cc57f015a 100644
@@ -8,6 +8,7 @@
 /*
  * User space memory access functions
  */
+#include <linux/kernel.h>
 #include <linux/string.h>
 #include <asm/page.h>
 #include <asm/domain.h>
Signature · 1 line
2.39.2
#1 lore raw
Quoted 13 lines · Masahiro Yamada

When I compiled the following code for ARM, I encountered numerous errors.

[Test Code]

    #include <linux/compiler.h>
    #include <linux/uaccess.h>

    int foo(int *x, int __user *ptr)
    {
            return get_user(*x, ptr);
    }
Quoted 4 lines

To fix them, make some asm headers self-contained:

1. In arch/arm/include/asm/traps.h, include <linux/init.h> for __init, and <linux/linkage.h> for asmlinkage.

Please drop the __init marking instead of adding linux/init.h, it's not necessary.

Thanks.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!