Re: [PATCH v3 3/5] m68k: add system call table generation support
On Mon, 1 Oct 2018, Firoz Khan wrote: > --- /dev/null > +++ b/arch/m68k/kernel/syscalls/syscallhdr.sh > @@ -0,0 +1,35 @@ > +#!/bin/sh That's not accurate. These are bash scripts, not Bourne shell. If you run 'checkbashisms', you'll see that a few small changes are needed in order to gain standards compliance and portability. Some untested suggestions: diff --git a/arch/m68k/kernel/syscalls/syscallhdr.sh b/arch/m68k/kernel/syscalls/syscallhdr.sh index e0e3108cfc7f..9811f82848e6 100644 --- a/arch/m68k/kernel/syscalls/syscallhdr.sh +++ b/arch/m68k/kernel/syscalls/syscallhdr.sh @@ -18,17 +18,17 @@ grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( nxt=0 while read nr abi name entry ; do if [ -z "$offset" ]; then - echo -e "#define __NR_${prefix}${name}\t$nr" + echo "#define __NR_${prefix}${name} $nr" else - echo -e "#define __NR_${prefix}${name}\t($offset + $nr)" + echo "#define __NR_${prefix}${name} ($offset + $nr)" fi nxt=$nr - let nxt=nxt+1 + nxt=$((nxt+1)) done echo "" echo "#ifdef __KERNEL__" -echo -e "#define __NR_syscalls\t$nxt" +echo "#define __NR_syscalls$nxt" echo "#endif" echo "" echo "#endif /* ${fileguard} */" diff --git a/arch/m68k/kernel/syscalls/syscalltbl.sh b/arch/m68k/kernel/syscalls/syscalltbl.sh index d2635dea4e96..89ab047097ce 100644 --- a/arch/m68k/kernel/syscalls/syscalltbl.sh +++ b/arch/m68k/kernel/syscalls/syscalltbl.sh @@ -13,7 +13,7 @@ emit() { while [ $nxt -lt $nr ]; do echo "__SYSCALL($nxt, sys_ni_syscall, )" - let nxt=nxt+1 + nxt=$((nxt+1)) done echo "__SYSCALL($nr, $entry, )" @@ -29,6 +29,6 @@ grep '^[0-9]' "$in" | sort -n | ( while read nr abi name entry ; do emit $nxt $nr $entry nxt=$nr -let nxt=nxt+1 +nxt=$((nxt+1)) done ) > "$out" --
Re: [PATCH v3 5/5] m68k: add __IGNORE* entries in asm/unistd.h
On Mon, Oct 1, 2018 at 2:39 PM Firoz Khan wrote: > > Add __IGNORE* entries for seccomp, pkey_mprotect, pkey_ > alloc, pkey_free, io_pgetevents and rseq in the file > asm/unistd.h as it is correct to keep __IGNORE* entry in > non uapi header asm/unistd.h while uapi/asm/unistd.h must > hold information only useful for user space applications. > > Signed-off-by: Firoz Khan > --- > arch/m68k/include/asm/unistd.h | 7 +++ > 1 file changed, 7 insertions(+) I think this one needs to be dropped, as I commented on a similar patch for another architecture (I forget which one). We really should implemente all the syscalls below, with the possible exception of the pkey calls. Note that we even list pkey_* in architectures that don't support the feature. See also the commit text for a60f7b69d92c ("generic syscalls: Wire up memory protection keys syscalls") Arnd
Re: [PATCH v3 5/7] drivers: s390: Avoids building drivers if ARCH is not s390.
On Thu, Sep 27, 2018 at 11:08:14PM -0300, Leonardo Brás wrote: > Avoids building s390 drivers if 'make drivers/s390/' is called but > ARCH is not s390. > > Signed-off-by: Leonardo Brás > --- > drivers/s390/Makefile | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/s390/Makefile b/drivers/s390/Makefile > index a863b0462b43..0575f02dba45 100644 > --- a/drivers/s390/Makefile > +++ b/drivers/s390/Makefile > @@ -3,7 +3,7 @@ > # Makefile for the S/390 specific device drivers > # > > -obj-y += cio/ block/ char/ crypto/ net/ scsi/ virtio/ > - > -drivers-y += drivers/s390/built-in.a > - > +ifeq ($(ARCH),s390) > + obj-y += cio/ block/ char/ crypto/ net/ scsi/ virtio/ > + drivers-y += drivers/s390/built-in.a > +endif And then somebody wants to build with e.g. "make drivers/s390/cio/" and it still doesn't work. So _if_ this should be supported then it should work with all directory levels and all configuration options. Otherwise this is going to be a never ending story.
[PATCH v3 4/5] m68k: uapi header and system call table file generation
System call table generation script must be run to generate unistd_32.h and syscall_table.h files. This patch will have changes which will invokes the script. This patch will generate unistd_32.h and syscall_table.h files by the syscall table generation script invoked by arch/m68k/Makefile and the generated files against the removed files will be identical. The generated uapi header file will be included in uapi/asm/unistd.h and generated system call table support file will be included by arch/m68k/kernel/syscall_table.S file. Signed-off-by: Firoz Khan --- arch/m68k/Makefile | 3 + arch/m68k/include/asm/Kbuild| 1 + arch/m68k/include/uapi/asm/Kbuild | 1 + arch/m68k/include/uapi/asm/unistd.h | 389 +-- arch/m68k/kernel/syscall_table.S| 399 +--- 5 files changed, 11 insertions(+), 782 deletions(-) diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile index 997c9f2..f00ca53 100644 --- a/arch/m68k/Makefile +++ b/arch/m68k/Makefile @@ -154,5 +154,8 @@ endif archclean: rm -f vmlinux.gz vmlinux.bz2 +archheaders: + $(Q)$(MAKE) $(build)=arch/m68k/kernel/syscalls all + install: sh $(srctree)/arch/m68k/install.sh $(KERNELRELEASE) vmlinux.gz System.map "$(INSTALL_PATH)" diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild index a4b8d33..68501411 100644 --- a/arch/m68k/include/asm/Kbuild +++ b/arch/m68k/include/asm/Kbuild @@ -24,3 +24,4 @@ generic-y += topology.h generic-y += trace_clock.h generic-y += word-at-a-time.h generic-y += xor.h +generic-y += syscall_table.h \ No newline at end of file diff --git a/arch/m68k/include/uapi/asm/Kbuild b/arch/m68k/include/uapi/asm/Kbuild index c2e26a4..6d600e9 100644 --- a/arch/m68k/include/uapi/asm/Kbuild +++ b/arch/m68k/include/uapi/asm/Kbuild @@ -21,3 +21,4 @@ generic-y += statfs.h generic-y += termbits.h generic-y += termios.h generic-y += types.h +generic-y += unistd_32.h \ No newline at end of file diff --git a/arch/m68k/include/uapi/asm/unistd.h b/arch/m68k/include/uapi/asm/unistd.h index ba4176aa..cdbd090 100644 --- a/arch/m68k/include/uapi/asm/unistd.h +++ b/arch/m68k/include/uapi/asm/unistd.h @@ -2,393 +2,6 @@ #ifndef _UAPI_ASM_M68K_UNISTD_H_ #define _UAPI_ASM_M68K_UNISTD_H_ -/* - * This file contains the system call numbers. - */ - -#define __NR_restart_syscall 0 -#define __NR_exit1 -#define __NR_fork2 -#define __NR_read3 -#define __NR_write 4 -#define __NR_open5 -#define __NR_close 6 -#define __NR_waitpid 7 -#define __NR_creat 8 -#define __NR_link9 -#define __NR_unlink 10 -#define __NR_execve 11 -#define __NR_chdir 12 -#define __NR_time 13 -#define __NR_mknod 14 -#define __NR_chmod 15 -#define __NR_chown 16 -/*#define __NR_break17*/ -#define __NR_oldstat18 -#define __NR_lseek 19 -#define __NR_getpid 20 -#define __NR_mount 21 -#define __NR_umount 22 -#define __NR_setuid 23 -#define __NR_getuid 24 -#define __NR_stime 25 -#define __NR_ptrace 26 -#define __NR_alarm 27 -#define __NR_oldfstat 28 -#define __NR_pause 29 -#define __NR_utime 30 -/*#define __NR_stty 31*/ -/*#define __NR_gtty 32*/ -#define __NR_access 33 -#define __NR_nice 34 -/*#define __NR_ftime35*/ -#define __NR_sync 36 -#define __NR_kill 37 -#define __NR_rename 38 -#define __NR_mkdir 39 -#define __NR_rmdir 40 -#define __NR_dup41 -#define __NR_pipe 42 -#define __NR_times 43 -/*#define __NR_prof 44*/ -#define __NR_brk45 -#define __NR_setgid 46 -#define __NR_getgid 47 -#define __NR_signal 48 -#define __NR_geteuid49 -#define __NR_getegid50 -#define __NR_acct 51 -#define __NR_umount252 -/*#define __NR_lock 53*/ -#define __NR_ioctl 54 -#define __NR_fcntl 55 -/*#define __NR_mpx 56*/ -#define __NR_setpgid57 -/*#define __NR_ulimit 58*/ -/*#define __NR_oldolduname 59*/ -#define __NR_umask 60 -#define __NR_chroot 61 -#define __NR_ustat 62 -#define __NR_dup2 63 -#define __NR_getppid64 -#define __NR_getpgrp65 -#define __NR_setsid 66 -#define __NR_sigaction 67 -#define __NR_sgetmask 68 -#define __NR_ssetmask 69 -#define __NR_setreuid 70 -#define __NR_setregid 71 -#define
[PATCH v3 3/5] m68k: add system call table generation support
The system call tables are in different format in all architecture and it will be difficult to manually add or modify the system calls in the respective files. To make it easy by keeping a script and which'll generate the header file and syscall table file so this change will unify them across all architectures. The system call table generation script is added in syscalls directory which contain the script to generate both uapi header file system call table generation file and syscall.tbl file which'll be the input for the scripts. syscall.tbl contains the list of available system calls along with system call number and corresponding entry point. Add a new system call in this architecture will be possible by adding new entry in the syscall.tbl file. Adding a new table entry consisting of: - System call number. - ABI. - System call name. - Entry point name. syscallhdr.sh and syscalltbl.sh will generate uapi header- unistd.h and syscall_table.h files respectively. File syscall_table.h is included by syscall_table.S - the real system call table. Both .sh files will parse the content syscall.tbl to generate the header and table files. ARM, s390 and x86 architecuture does have the similar support. I leverage their implementation to come up with a generic solution. And this is the ground work for y2038 issue. We need to change two dozons of system call implementation and this work will reduce the effort by simply modify two dozon entries in syscall.tbl. Signed-off-by: Firoz Khan --- arch/m68k/kernel/syscalls/Makefile | 38 arch/m68k/kernel/syscalls/syscall.tbl | 369 arch/m68k/kernel/syscalls/syscallhdr.sh | 35 +++ arch/m68k/kernel/syscalls/syscalltbl.sh | 34 +++ 4 files changed, 476 insertions(+) create mode 100644 arch/m68k/kernel/syscalls/Makefile create mode 100644 arch/m68k/kernel/syscalls/syscall.tbl create mode 100644 arch/m68k/kernel/syscalls/syscallhdr.sh create mode 100644 arch/m68k/kernel/syscalls/syscalltbl.sh diff --git a/arch/m68k/kernel/syscalls/Makefile b/arch/m68k/kernel/syscalls/Makefile new file mode 100644 index 000..d255d32 --- /dev/null +++ b/arch/m68k/kernel/syscalls/Makefile @@ -0,0 +1,38 @@ +# SPDX-License-Identifier: GPL-2.0 +out := arch/$(SRCARCH)/include/generated/asm +uapi := arch/$(SRCARCH)/include/generated/uapi/asm + +_dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \ + $(shell [ -d '$(out)' ] || mkdir -p '$(out)') + +syscall := $(srctree)/$(src)/syscall.tbl + +syshdr := $(srctree)/$(src)/syscallhdr.sh +systbl := $(srctree)/$(src)/syscalltbl.sh + +quiet_cmd_syshdr = SYSHDR $@ + cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' '$<' '$@' \ + '$(syshdr_abi_$(basetarget))' \ + '$(syshdr_pfx_$(basetarget))' \ + '$(syshdr_offset_$(basetarget))' + +quiet_cmd_systbl = SYSTBL $@ + cmd_systbl = $(CONFIG_SHELL) '$(systbl)' '$<' '$@' \ + '$(systbl_abi_$(basetarget))' \ + '$(systbl_offset_$(basetarget))' + +$(uapi)/unistd_32.h: $(syscall) $(syshdr) + $(call if_changed,syshdr) + +$(out)/syscall_table.h: $(syscall) $(systbl) + $(call if_changed,systbl) + +uapisyshdr-y += unistd_32.h +syshdr-y += syscall_table.h + +targets+= $(uapisyshdr-y) $(syshdr-y) + +PHONY += all +all: $(addprefix $(uapi)/,$(uapisyshdr-y)) +all: $(addprefix $(out)/,$(syshdr-y)) + @: diff --git a/arch/m68k/kernel/syscalls/syscall.tbl b/arch/m68k/kernel/syscalls/syscall.tbl new file mode 100644 index 000..ab151cd --- /dev/null +++ b/arch/m68k/kernel/syscalls/syscall.tbl @@ -0,0 +1,369 @@ +# +# Linux system call numbers and entry vectors +# +# The format is: +# +# +# The abi is always common for this file. +# +0 common restart_syscall sys_restart_syscall +1 common exit sys_exit +2 common fork __sys_fork +3 common read sys_read +4 common writesys_write +5 common open sys_open +6 common closesys_close +7 common waitpid sys_waitpid +8 common creatsys_creat +9 common link sys_link +10 common unlink sys_unlink +11 common execve sys_execve +12 common chdirsys_chdir +13 common time sys_time +14 common mknodsys_mknod +15 common chmodsys_chmod +16 common chownsys_chown16 +18 common oldstat sys_stat +19 common lseeksys_lseek +20 common getpid sys_getpid +21 common mountsys_mount +22
[PATCH v3 5/5] m68k: add __IGNORE* entries in asm/unistd.h
Add __IGNORE* entries for seccomp, pkey_mprotect, pkey_ alloc, pkey_free, io_pgetevents and rseq in the file asm/unistd.h as it is correct to keep __IGNORE* entry in non uapi header asm/unistd.h while uapi/asm/unistd.h must hold information only useful for user space applications. Signed-off-by: Firoz Khan --- arch/m68k/include/asm/unistd.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h index 5072e94..cc5f640 100644 --- a/arch/m68k/include/asm/unistd.h +++ b/arch/m68k/include/asm/unistd.h @@ -31,4 +31,11 @@ #define __ARCH_WANT_SYS_FORK #define __ARCH_WANT_SYS_VFORK +#define __IGNORE_seccomp +#define __IGNORE_pkey_mprotect +#define __IGNORE_pkey_alloc +#define __IGNORE_pkey_free +#define __IGNORE_io_pgetevents +#define __IGNORE_rseq + #endif /* _ASM_M68K_UNISTD_H_ */ -- 1.9.1
[PATCH v3 1/5] m68k: rename system call table file name
The system call table entries are present in syscalltable.S. One of the patch in this patch series will auto-generate the system call table entries using the system call table generation script and which'll replace the existig table file. In order to come up with a common naming convention across all architecture, we need to change the file name to syscall_table.S. This change will unify the implementation across all architecture. Signed-off-by: Firoz Khan --- arch/m68k/kernel/Makefile| 2 +- arch/m68k/kernel/{syscalltable.S => syscall_table.S} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename arch/m68k/kernel/{syscalltable.S => syscall_table.S} (100%) diff --git a/arch/m68k/kernel/Makefile b/arch/m68k/kernel/Makefile index dbac7f8..5f40ce6 100644 --- a/arch/m68k/kernel/Makefile +++ b/arch/m68k/kernel/Makefile @@ -15,7 +15,7 @@ extra-$(CONFIG_SUN3) := sun3-head.o extra-y+= vmlinux.lds obj-y := entry.o irq.o module.o process.o ptrace.o -obj-y += setup.o signal.o sys_m68k.o syscalltable.o time.o traps.o +obj-y += setup.o signal.o sys_m68k.o syscall_table.o time.o traps.o obj-$(CONFIG_MMU_MOTOROLA) += ints.o vectors.o obj-$(CONFIG_MMU_SUN3) += ints.o vectors.o diff --git a/arch/m68k/kernel/syscalltable.S b/arch/m68k/kernel/syscall_table.S similarity index 100% rename from arch/m68k/kernel/syscalltable.S rename to arch/m68k/kernel/syscall_table.S -- 1.9.1
[PATCH v3 2/5] m68k: replace NR_syscalls macro from asm/unistd.h
NR_syscalls macro holds the number of system call exist in m68k architecture. This macro is currently the part of asm/unistd.h file. We have to change the value of NR_syscalls, if we add or delete a system call. One of patch in this patch series has a script which will generate a uapi header based on syscall.tbl file. The syscall.tbl file contains the number of system call information. So we have two option to update NR_syscalls value. 1. Update NR_syscalls in asm/unistd.h manually by counting the no.of system calls. No need to update NR_syscalls until we either add a new system call or delete an existing system call. 2. We can keep this feature it above mentioned script, that'll count the number of syscalls and keep it in a generated file. In this case we don't need to explicitly update NR_syscalls in asm/unistd.h file. The 2nd option will be the recommended one. For that, I come up with another macro - __NR_syscalls which will be updated by the script and it will be present in api/asm/unistd.h. While __NR_syscalls isn't strictly part of the uapi, having it as part of the generated header to simplifies the implementation. So we need to enclose this macro with #ifdef __KERNEL__ to avoid side effects. Signed-off-by: Firoz Khan --- arch/m68k/include/asm/unistd.h | 3 +-- arch/m68k/include/uapi/asm/unistd.h | 4 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h index 30d0d3f..5072e94 100644 --- a/arch/m68k/include/asm/unistd.h +++ b/arch/m68k/include/asm/unistd.h @@ -4,8 +4,7 @@ #include - -#define NR_syscalls380 +#define NR_syscalls __NR_syscalls #define __ARCH_WANT_OLD_READDIR #define __ARCH_WANT_OLD_STAT diff --git a/arch/m68k/include/uapi/asm/unistd.h b/arch/m68k/include/uapi/asm/unistd.h index de3054f..ba4176aa 100644 --- a/arch/m68k/include/uapi/asm/unistd.h +++ b/arch/m68k/include/uapi/asm/unistd.h @@ -387,4 +387,8 @@ #define __NR_pwritev2 378 #define __NR_statx 379 +#ifdef __KERNEL__ +#define __NR_syscalls 380 +#endif + #endif /* _UAPI_ASM_M68K_UNISTD_H_ */ -- 1.9.1
[PATCH v3 0/5] System call table generation support
The purpose of this patch series is: 1. We can easily add/modify/delete system call by changing entry in syscall.tbl file. No need to manually edit many files. 2. It is easy to unify the system call implementation across all the architectures. The system call tables are in different format in all architecture and it will be difficult to manually add or modify the system calls in the respective files manually. To make it easy by keeping a script and which'll generate the header file and syscall table file so this change will unify them across all architectures. syscall.tbl contains the list of available system calls along with system call number and corresponding entry point. Add a new system call in this architecture will be possible by adding new entry in the syscall.tbl file. Adding a new table entry consisting of: - System call number. - ABI. - System call name. - Entry point name. - Compat entry name, if required. ARM, s390 and x86 architecuture does exist the similar support. I leverage their implementation to come up with a generic solution. I have done the same support for work for alpha, ia64, sparc, mips, parisc, powerpc, sh, sparc, and xtensa. But I started sending the patch for one architecuture for review. Below mentioned git repository contains more details. Git repo:- https://github.com/frzkhn/system_call_table_generator/ Finally, this is the ground work for solving the Y2038 issue. We need to add/change two dozen of system calls to solve Y2038 issue. So this patch series will help to easily modify from existing system call to Y2038 compatible system calls. Firoz Khan (5): m68k: rename system call table file name m68k: replace NR_syscalls macro from asm/unistd.h m68k: add system call table generation support m68k: uapi header and system call table file generation m68k: add __IGNORE* entries in asm/unistd.h arch/m68k/Makefile | 3 + arch/m68k/include/asm/Kbuild| 1 + arch/m68k/include/asm/unistd.h | 10 +- arch/m68k/include/uapi/asm/Kbuild | 1 + arch/m68k/include/uapi/asm/unistd.h | 385 +- arch/m68k/kernel/Makefile | 2 +- arch/m68k/kernel/syscall_table.S| 14 ++ arch/m68k/kernel/syscalls/Makefile | 38 +++ arch/m68k/kernel/syscalls/syscall.tbl | 369 + arch/m68k/kernel/syscalls/syscallhdr.sh | 35 +++ arch/m68k/kernel/syscalls/syscalltbl.sh | 34 +++ arch/m68k/kernel/syscalltable.S | 403 12 files changed, 505 insertions(+), 790 deletions(-) create mode 100644 arch/m68k/kernel/syscall_table.S create mode 100644 arch/m68k/kernel/syscalls/Makefile create mode 100644 arch/m68k/kernel/syscalls/syscall.tbl create mode 100644 arch/m68k/kernel/syscalls/syscallhdr.sh create mode 100644 arch/m68k/kernel/syscalls/syscalltbl.sh delete mode 100644 arch/m68k/kernel/syscalltable.S -- 1.9.1
Re: [PATCH v3 0/7] Remove errors building drivers/DRIVERNAME
On 27.09.18 23:08:09, Leonardo Brás wrote: > This Patchset changes some driver's Makefile to allow them building > using the command 'make drivers/DRIVERNAME', if compatible. > > The changed drivers would return error if the above command was run > on them, after an x86 allyesconfig. I don't see what you are trying to achieve here. Why shouldn't the command fail if it is not the intended way to call it? There are a couple of use cases where drivers/ is used to share common code over different archs and it is not always the intention to build them in drivers/ directly. > > The main reason of this patchset is to allow building lists of > drivers looking for warnings and errors to be fixed. If a list is the intention here, aren't there other ways to create it other than using drivers/*? -Robert > > I see this change as a new feature, not a bugfix. I understand > the default bahavior may be building with a simple 'make', but I > believe adding this new possibility will not be harmful. > > My main objective is to allow developers with low processing power > to do changes in the kernel and look bugs using free services like > GiltabCI, before submitting to community. > > If there is any interest helping/using this, I have a prototype in: > https://gitlab.com/LeoBras/linux-next