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
| ||
|
Date: Fri, 21 Jan 2022 14:25:29 +0800 From: Guo Ren <guoren@...nel.org> To: Arnd Bergmann <arnd@...db.de> Cc: Palmer Dabbelt <palmer@...belt.com>, Anup Patel <anup@...infault.org>, gregkh <gregkh@...uxfoundation.org>, liush <liush@...winnertech.com>, Wei Fu <wefu@...hat.com>, Drew Fustini <drew@...gleboard.org>, Wang Junqiang <wangjunqiang@...as.ac.cn>, Christoph Hellwig <hch@....de>, Christoph Hellwig <hch@...radead.org>, Linux Kernel Mailing List <linux-kernel@...r.kernel.org>, linux-riscv <linux-riscv@...ts.infradead.org>, linux-csky@...r.kernel.org, linux-s390 <linux-s390@...r.kernel.org>, sparclinux <sparclinux@...r.kernel.org>, linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>, inux-parisc@...r.kernel.org, "open list:BROADCOM NVRAM DRIVER" <linux-mips@...r.kernel.org>, Linux ARM <linux-arm-kernel@...ts.infradead.org>, "the arch/x86 maintainers" <x86@...nel.org>, Guo Ren <guoren@...ux.alibaba.com> Subject: Re: [PATCH V3 08/17] riscv: compat: syscall: Add compat_sys_call_table implementation On Thu, Jan 20, 2022 at 10:43 PM Arnd Bergmann <arnd@...db.de> wrote: > > On Thu, Jan 20, 2022 at 8:39 AM <guoren@...nel.org> wrote: > > > > /* The array of function pointers for syscalls. */ > > extern void * const sys_call_table[]; > > +#ifdef CONFIG_COMPAT > > +extern void * const compat_sys_call_table[]; > > +#endif > > No need for the #ifdef, the normal convention is to just define the > extern declaration unconditionally for symbols that may or may not be defined. Okay > > > +COMPAT_SYSCALL_DEFINE3(truncate64, const char __user *, pathname, > > + arg_u32p(length)) > > +{ > > + return ksys_truncate(pathname, arg_u64(length)); > > +} > > Are you sure these are the right calling conventions? According to [1], > I think the 64-bit argument should be in an aligned pair of registers, > which means you need an extra pad argument as in the arm64 version > of these functions. Same for ftruncate64, pread64, pwrite64, and > readahead. [1] has abandoned. See: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc Ltp test results: ftruncate01 PASS 0 ftruncate01_64 PASS 0 ftruncate03 PASS 0 ftruncate03_64 PASS 0 ftruncate04 CONF 32 ftruncate04_64 CONF 32 truncate02 PASS 0 truncate02_64 PASS 0 truncate03 PASS 0 truncate03_64 PASS 0 pread01 PASS 0 pread01_64 PASS 0 pread02 PASS 0 pread02_64 PASS 0 pread03 PASS 0 pread03_64 PASS 0 pwrite01_64 PASS 0 pwrite02_64 PASS 0 pwrite03_64 PASS 0 pwrite04_64 PASS 0 readahead01 PASS 0 readahead02 CONF 32 > > > +COMPAT_SYSCALL_DEFINE3(ftruncate64, unsigned int, fd, arg_u32p(length)) > > +{ > > + return ksys_ftruncate(fd, arg_u64(length)); > > +} > > + > > +COMPAT_SYSCALL_DEFINE6(fallocate, int, fd, int, mode, > > + arg_u32p(offset), arg_u32p(len)) > > +{ > > + return ksys_fallocate(fd, mode, arg_u64(offset), arg_u64(len)); > > +} > > + > > +COMPAT_SYSCALL_DEFINE5(pread64, unsigned int, fd, char __user *, buf, > > + size_t, count, arg_u32p(pos)) > > +{ > > + return ksys_pread64(fd, buf, count, arg_u64(pos)); > > +} > > + > > +COMPAT_SYSCALL_DEFINE5(pwrite64, unsigned int, fd, > > + const char __user *, buf, size_t, count, arg_u32p(pos)) > > +{ > > + return ksys_pwrite64(fd, buf, count, arg_u64(pos)); > > +} > > + > > +COMPAT_SYSCALL_DEFINE6(sync_file_range, int, fd, arg_u32p(offset), > > + arg_u32p(nbytes), unsigned int, flags) > > +{ > > + return ksys_sync_file_range(fd, arg_u64(offset), arg_u64(nbytes), > > + flags); > > +} > > + > > +COMPAT_SYSCALL_DEFINE4(readahead, int, fd, arg_u32p(offset), > > + size_t, count) > > +{ > > + return ksys_readahead(fd, arg_u64(offset), count); > > +} > > + > > +COMPAT_SYSCALL_DEFINE6(fadvise64_64, int, fd, int, advice, arg_u32p(offset), > > + arg_u32p(len)) > > +{ > > + return ksys_fadvise64_64(fd, arg_u64(offset), arg_u64(len), advice); > > +} > > I still feel like these should be the common implementations next to the > native handlers inside of an #ifdef CONFIG_COMPAT. > > The names clash with the custom versions defined for powerpc and sparc, > but the duplicates look compatible if you can account for the padded > argument and the lo/hi order of the pairs, so could just be removed here > (all other architectures use custom function names instead). I would try it later. > > Arnd > > [1] https://riscv.org/wp-content/uploads/2015/01/riscv-calling.pdf -- Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/
Powered by blists - more mailing lists