summaryrefslogtreecommitdiff
path: root/scripts/checksyscalls.sh
AgeCommit message (Collapse)Author
2017-11-02License cleanup: add SPDX GPL-2.0 license identifier to files with no licenseGreg Kroah-Hartman
Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-10kbuild: speed up checksyscalls.shArnd Bergmann
checksyscalls.sh is run at every "make" run while building the kernel, even if no files have changed. I looked at where we spend time in a trivial empty rebuild and found checksyscalls.sh to be a source of noticeable overhead, as it spawns a lot of child processes just to call 'cat' copying from stdin to stdout, once for each of the over 400 x86 syscalls. Using a shell-builtin (echo) instead of the external command gives us a 13x speedup: Before After real 0m1.018s real 0m0.077s user 0m0.068s user 0m0.048s sys 0m0.156s sys 0m0.024s The time it took to rebuild a single file on my machine dropped from 5.5 seconds to 4.5 seconds. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-03-24x86/syscalls/32: Ignore arch_prctl for other architecturesArnd Bergmann
sys_arch_prctl is only provided on x86, and there is no reason to add it elsewhere. However, including it on the 32-bit syscall table caused a warning for most configurations on non-x86: :1328:2: warning: #warning syscall arch_prctl not implemented [-Wcpp] This adds an exception to the syscall table checking script. Fixes: 79170fda313e ("x86/syscalls/32: Wire up arch_prctl on x86-32") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Kyle Huey <khuey@kylehuey.com> Link: http://lkml.kernel.org/r/20170323151904.706286-1-arnd@arndb.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2015-06-04x86/asm/entry: Move the arch/x86/syscalls/ definitions to ↵Ingo Molnar
arch/x86/entry/syscalls/ The build time generated syscall definitions are entry code related, move them into the arch/x86/entry/ directory. Cc: Borislav Petkov <bp@alien8.de> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: Brian Gerst <brgerst@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
2014-05-20scripts/checksyscalls.sh: Make renameat optionalJames Hogan
The new renameat2 syscall provides all the functionality of renameat with an additional flags argument, so make renameat optional so that future architectures can omit it without getting a warning. This patch doesn't affect existing architectures. Signed-off-by: James Hogan <james.hogan@imgtec.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Cc: linux-arch@vger.kernel.org
2012-09-25checksyscalls: fix "here document" handlingHeiko Carstens
"echo" doesn't read from stdin, therefore the checksyscalls script didn't warn about not implemented system calls anymore since 29dc54c6 ("checksyscalls: Use arch/x86/syscalls/syscall_32.tbl as source"). Use "cat" instead of "echo" which handles this correctly. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Michal Marek <mmarek@suse.cz> Cc: H. Peter Anvin <hpa@linux.intel.com> Cc: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-17checksyscalls: Use arch/x86/syscalls/syscall_32.tbl as sourceH. Peter Anvin
Use the new arch/x86/syscalls/syscall_32.tbl file as source instead of arch/x86/include/asm/unistd_32.h. Cc: Michal Marek <mmarek@suse.cz> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-12-20checksyscalls: Fix stand-alone usageGeert Uytterhoeven
The usage help in the comments - refers to the wrong script name, - doesn't mention that $srctree must be set. Hence correct the script name, and derive the source tree path from the script path, so we no longer need to rely on $srctree being set by the caller. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-06-25Add wait4() back to the set of <asm-generic/unistd.h> syscalls.Chris Metcalf
The initial pass at the generic ABI assumed that wait4() could be easily expressed using waitid(). Although it's true that wait4() can be built on waitid(), it's awkward enough that it makes more sense to continue to include wait4 in the generic syscall ABI. Since there is already a deprecated wait4 in the ABI, this change converts that wait4 into old_wait, and puts wait4 in the next available slot for new supported syscalls, after the platform-specific syscalls at number 260. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> Acked-by: Arnd Bergmann <arnd@arndb.de>
2009-06-11asm-generic: add a generic unistd.hArnd Bergmann
A new architecture should only define a minimal set of system calls while still providing the full functionality. This version of unistd.h has gone through intensive review to make sure that by default it only enables syscalls that do not already have a more featureful replacement. It is modeled after the x86-64 version of unistd.h, which unifies the syscall number definition and the actual system call table in a single file, in order to keep them synchronized much more easily. This first version still keeps legacy system call definitions around, guarded by various #ifdefs, and with numbers larger than 1024. The idea behind this is to make it easier for new architectures to transition from a full list to the reduced set. In particular, the new microblaze architecture that should migrate to using the generic ABI headers can at least use an existing uClibc source tree without major rewrites during the conversion. Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2008-10-29scripts/checksyscalls.sh: fix for non-gnu sedThomas Volpini
Make the checksyscalls script work even on systems where sed is non-gnu. Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-10-22x86, um: ... and asm-x86 moveAl Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2007-10-11i386/x86_64: move headers to include/asm-x86Thomas Gleixner
Move the headers to include/asm-x86 and fixup the header install make rules Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2007-06-28Introduce fixed sys_sync_file_range2() syscall, implement on PowerPC and ARMDavid Woodhouse
Not all the world is an i386. Many architectures need 64-bit arguments to be aligned in suitable pairs of registers, and the original sys_sync_file_range(int, loff_t, loff_t, int) was therefore wasting an argument register for padding after the first integer. Since we don't normally have more than 6 arguments for system calls, that left no room for the final argument on some architectures. Fix this by introducing sys_sync_file_range2(int, int, loff_t, loff_t) which all fits nicely. In fact, ARM already had that, but called it sys_arm_sync_file_range. Move it to fs/sync.c and rename it, then implement the needed compatibility routine. And stop the missing syscall check from bitching about the absence of sys_sync_file_range() if we've implemented sys_sync_file_range2() instead. Tested on PPC32 and with 32-bit and 64-bit userspace on PPC64. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Acked-by: Russell King <rmk+kernel@arm.linux.org.uk> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-02kbuild: complain about missing system callsSam Ravnborg
Most system calls seems to get added to i386 first. This patch automatically generates a warning for any new system call which is implemented on i386 but not the architecture currently being compiled. On PowerPC at the moment, for example, it results in these warnings: init/missing_syscalls.h:935:3: warning: #warning syscall sync_file_range not implemented init/missing_syscalls.h:947:3: warning: #warning syscall getcpu not implemented init/missing_syscalls.h:950:3: warning: #warning syscall epoll_pwait not implemented The file scripts/checksyscalls.sh list a number of legacy system calls that are ignored because they only makes sense on i386 systems. Other contributors to this patch are Russell King <rmk+lkml@arm.linux.org.uk> and Stéphane Jourdois <kwisatz@rubis.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>