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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAhV-H4YzfWXKjWwmA8co4qFjLm=jZggbD5dqq+OxntVH6OZrQ@mail.gmail.com>
Date: Thu, 20 Nov 2025 20:05:36 +0800
From: Huacai Chen <chenhuacai@...nel.org>
To: WANG Xuerui <kernel@...0n.name>
Cc: Huacai Chen <chenhuacai@...ngson.cn>, Arnd Bergmann <arnd@...db.de>, loongarch@...ts.linux.dev, 
	linux-arch@...r.kernel.org, Xuefeng Li <lixuefeng@...ngson.cn>, 
	Guo Ren <guoren@...nel.org>, Jiaxun Yang <jiaxun.yang@...goat.com>, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2 09/14] LoongArch: Adjust system call for 32BIT/64BIT

On Thu, Nov 20, 2025 at 6:40 PM WANG Xuerui <kernel@...0n.name> wrote:
>
> On 11/18/25 19:27, Huacai Chen wrote:
> > Adjust system call for both 32BIT and 64BIT, including: add the uapi
> > unistd_{32,64}.h and syscall_table_{32,64}.h inclusion, add sys_mmap2()
> > definition, change the system call entry routines, etc.
> >
> > Signed-off-by: Jiaxun Yang <jiaxun.yang@...goat.com>
> > Signed-off-by: Huacai Chen <chenhuacai@...ngson.cn>
> > ---
> >   arch/loongarch/include/asm/Kbuild        |  1 +
> >   arch/loongarch/include/uapi/asm/Kbuild   |  1 +
> >   arch/loongarch/include/uapi/asm/unistd.h |  6 ++++++
> >   arch/loongarch/kernel/Makefile.syscalls  |  1 +
> >   arch/loongarch/kernel/entry.S            | 22 +++++++++++-----------
> >   arch/loongarch/kernel/syscall.c          | 13 +++++++++++++
> >   6 files changed, 33 insertions(+), 11 deletions(-)
> >
> > [snip]
> > diff --git a/arch/loongarch/kernel/syscall.c b/arch/loongarch/kernel/syscall.c
> > index ab94eb5ce039..1249d82c1cd0 100644
> > --- a/arch/loongarch/kernel/syscall.c
> > +++ b/arch/loongarch/kernel/syscall.c
> > @@ -34,9 +34,22 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, unsigned long,
> >       return ksys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
> >   }
> >
> > +SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len, unsigned long,
> > +              prot, unsigned long, flags, unsigned long, fd, unsigned long, offset)
> > +{
> > +     if (offset & (~PAGE_MASK >> 12))
> > +             return -EINVAL;
> > +
> > +     return ksys_mmap_pgoff(addr, len, prot, flags, fd, offset >> (PAGE_SHIFT - 12));
> > +}
> > +
>
> Why not guard this with #ifdef CONFIG_32BIT?
Because it is not only used by CONFIG_32BIT, but also by CONFIG_COMPAT.

Huacai

>
> >   void *sys_call_table[__NR_syscalls] = {
> >       [0 ... __NR_syscalls - 1] = sys_ni_syscall,
> > +#ifdef CONFIG_32BIT
> > +#include <asm/syscall_table_32.h>
> > +#else
> >   #include <asm/syscall_table_64.h>
> > +#endif
> >   };
> >
> >   typedef long (*sys_call_fn)(unsigned long, unsigned long,
>
> --
> WANG "xen0n" Xuerui
>
> Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ