lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <Ynt0J5daWq7swGP8@FVFF77S0Q05N>
Date:   Wed, 11 May 2022 09:30:31 +0100
From:   Mark Rutland <mark.rutland@....com>
To:     cuigaosheng <cuigaosheng1@...wei.com>
Cc:     Will Deacon <will@...nel.org>, catalin.marinas@....com,
        broonie@...nel.org, pcc@...gle.com, keescook@...omium.org,
        daniel.kiss@....com, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org, wangweiyang2@...wei.com,
        gongruiqi1@...wei.com
Subject: Re: [PATCH -next] arm64: add missing header dependencies

On Wed, May 11, 2022 at 09:39:55AM +0800, cuigaosheng wrote:
>     Do you know which commit is causing this error?
> 
> 9cce7a435f89 arm64: CPU support I got the error when building a module with
> processor.h on arm64 and the module calls the KSTK_ESP macro,

I assume that's an out-of-tree module?

Looking at v5.18-rc5, the only users of KSTK_ESP() on arm64 are built in:

| [mark@...rids:~/src/linux]% git grep KSTK_ESP
| arch/alpha/include/asm/processor.h:#define KSTK_ESP(tsk) \
| arch/arc/include/asm/processor.h:#define KSTK_ESP(tsk)   (task_pt_regs(tsk)->sp)
| arch/arm/include/asm/processor.h:#define KSTK_ESP(tsk)  task_pt_regs(tsk)->ARM_sp
| arch/arm64/include/asm/processor.h:#define KSTK_ESP(tsk)        user_stack_pointer(task_pt_regs(tsk))
| arch/csky/include/asm/processor.h:#define KSTK_ESP(tsk)         (task_pt_regs(tsk)->usp)
| arch/h8300/include/asm/processor.h:#define      KSTK_ESP(tsk)   ((tsk) == current ? rdusp() : (tsk)->thread.usp)
| arch/hexagon/include/asm/processor.h:#define KSTK_ESP(tsk) (pt_psp(task_pt_regs(tsk)))
| arch/ia64/include/asm/processor.h:#define KSTK_ESP(tsk)  ((tsk)->thread.ksp)
| arch/m68k/include/asm/processor.h:#define       KSTK_ESP(tsk)   ((tsk) == current ? rdusp() : (tsk)->thread.usp)
| arch/microblaze/include/asm/processor.h:#  define KSTK_ESP(task)        (task_sp(task))
| arch/mips/include/asm/processor.h:#define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29])
| arch/nios2/include/asm/processor.h:#define KSTK_ESP(tsk)        ((tsk)->thread.kregs->sp)
| arch/openrisc/include/asm/processor.h:#define KSTK_ESP(tsk)   (task_pt_regs(tsk)->sp)
| arch/parisc/include/asm/processor.h:#define KSTK_ESP(tsk)       ((tsk)->thread.regs.gr[30])
| arch/powerpc/include/asm/processor.h:#define KSTK_ESP(tsk)  ((tsk)->thread.regs? (tsk)->thread.regs->gpr[1]: 0)
| arch/riscv/include/asm/processor.h:#define KSTK_ESP(tsk)                (task_pt_regs(tsk)->sp)
| arch/s390/include/asm/processor.h:#define KSTK_ESP(tsk) (task_pt_regs(tsk)->gprs[15])
| arch/sh/include/asm/processor_32.h:#define KSTK_ESP(tsk)  (task_pt_regs(tsk)->regs[15])
| arch/sparc/include/asm/processor_32.h:#define KSTK_ESP(tsk)  ((tsk)->thread.kregs->u_regs[UREG_FP])
| arch/sparc/include/asm/processor_64.h:#define KSTK_ESP(tsk)  (task_pt_regs(tsk)->u_regs[UREG_FP])
| arch/um/include/asm/stacktrace.h:       return (unsigned long *)KSTK_ESP(task);
| arch/x86/include/asm/processor.h:#define KSTK_ESP(task)         (task_pt_regs(task)->sp)
| arch/x86/include/asm/processor.h:extern unsigned long KSTK_ESP(struct task_struct *task);
| arch/x86/kernel/process_64.c:unsigned long KSTK_ESP(struct task_struct *task)
| arch/x86/um/asm/processor.h:#define KSTK_ESP(tsk) KSTK_REG(tsk, HOST_SP)
| arch/xtensa/include/asm/processor.h:#define KSTK_ESP(tsk)               (task_pt_regs(tsk)->areg[1])
| fs/proc/array.c:                                esp = KSTK_ESP(task);
| mm/util.c:      return (vma->vm_start <= KSTK_ESP(t) && vma->vm_end >= KSTK_ESP(t));

... or is that module being added in another tree at the moment?

Thanks,
Mark.

> we can also add
> additional header file dependencies(linux/sched/task_stack.h) in the module to
> avoid this error. Maybe perfecting header file dependencies of processor.h is a
> better option? Thanks,
> 
> 在 2022/5/10 18:40, Will Deacon 写道:
> 
>     On Mon, May 09, 2022 at 02:17:51PM +0800, Gaosheng Cui wrote:
> 
>         We get one error when building module with processor.h:
> 
>         ./arch/arm64/include/asm/processor.h:263:36: error: implicit declaration of function ‘task_stack_page’;
>           ((struct pt_regs *)(THREAD_SIZE + task_stack_page(p)) - 1)
>         ./arch/arm64/include/asm/processor.h:266:42: note: in expansion of macro ‘task_pt_regs’
>          #define KSTK_ESP(tsk) user_stack_pointer(task_pt_regs(tsk))
> 
>         task_stack_page is declared in linux/sched/task_stack.h, so this patch
>         add the missing header dependencies.
> 
>         Signed-off-by: Gaosheng Cui <cuigaosheng1@...wei.com>
>         ---
>          arch/arm64/include/asm/processor.h | 1 +
>          1 file changed, 1 insertion(+)
> 
>     Do you know which commit is causing this error? I haven't seen any other
>     reports, but it's hard to know which tree should take your patch as it
>     stands.
> 
>     Thanks,
> 
>     Will
> 
> 
>         diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
>         index 73e38d9a540c..1c239841c4d6 100644
>         --- a/arch/arm64/include/asm/processor.h
>         +++ b/arch/arm64/include/asm/processor.h
>         @@ -28,6 +28,7 @@
>          #include <linux/build_bug.h>
>          #include <linux/cache.h>
>          #include <linux/init.h>
>         +#include <linux/sched/task_stack.h>
>          #include <linux/stddef.h>
>          #include <linux/string.h>
>          #include <linux/thread_info.h>
>         --
>         2.25.1
> 
> 
>     .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ