aboutsummaryrefslogtreecommitdiffstats
path: root/scripts (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-02-06kasan: support alloca() poisoningPaul Lawrence1-1/+2
clang's AddressSanitizer implementation adds redzones on either side of alloca()ed buffers. These redzones are 32-byte aligned and at least 32 bytes long. __asan_alloca_poison() is passed the size and address of the allocated buffer, *excluding* the redzones on either side. The left redzone will always be to the immediate left of this buffer; but AddressSanitizer may need to add padding between the end of the buffer and the right redzone. If there are any 8-byte chunks inside this padding, we should poison those too. __asan_allocas_unpoison() is just passed the top and bottom of the dynamic stack area, so unpoisoning is simpler. Link: http://lkml.kernel.org/r/20171204191735.132544-4-paullawrence@google.com Signed-off-by: Greg Hackmann <ghackmann@google.com> Signed-off-by: Paul Lawrence <paullawrence@google.com> Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: Alexander Potapenko <glider@google.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Matthias Kaehlcke <mka@chromium.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-02-06kasan/Makefile: support LLVM style asan parametersAndrey Ryabinin1-11/+18
LLVM doesn't understand GCC-style paramters ("--param asan-foo=bar"), thus we currently we don't use inline/globals/stack instrumentation when building the kernel with clang. Add support for LLVM-style parameters ("-mllvm -asan-foo=bar") to enable all KASAN features. Link: http://lkml.kernel.org/r/20171204191735.132544-3-paullawrence@google.com Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com> Signed-off-by: Paul Lawrence <paullawrence@google.com> Reviewed-by: Alexander Potapenko <glider@google.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Greg Hackmann <ghackmann@google.com> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Matthias Kaehlcke <mka@chromium.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-02-06kasan: don't emit builtin calls when sanitization is offAndrey Konovalov2-1/+4
With KASAN enabled the kernel has two different memset() functions, one with KASAN checks (memset) and one without (__memset). KASAN uses some macro tricks to use the proper version where required. For example memset() calls in mm/slub.c are without KASAN checks, since they operate on poisoned slab object metadata. The issue is that clang emits memset() calls even when there is no memset() in the source code. They get linked with improper memset() implementation and the kernel fails to boot due to a huge amount of KASAN reports during early boot stages. The solution is to add -fno-builtin flag for files with KASAN_SANITIZE := n marker. Link: http://lkml.kernel.org/r/8ffecfffe04088c52c42b92739c2bd8a0bcb3f5e.1516384594.git.andreyknvl@google.com Signed-off-by: Andrey Konovalov <andreyknvl@google.com> Acked-by: Nick Desaulniers <ndesaulniers@google.com> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Michal Marek <michal.lkml@markovi.net> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: Alexander Potapenko <glider@google.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-02-01Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printkLinus Torvalds1-2/+9
Pull printk updates from Petr Mladek: - Add a console_msg_format command line option: The value "default" keeps the old "[time stamp] text\n" format. The value "syslog" allows to see the syslog-like "<log level>[timestamp] text" format. This feature was requested by people doing regression tests, for example, 0day robot. They want to have both filtered and full logs at hands. - Reduce the risk of softlockup: Pass the console owner in a busy loop. This is a new approach to the old problem. It was first proposed by Steven Rostedt on Kernel Summit 2017. It marks a context in which the console_lock owner calls console drivers and could not sleep. On the other side, printk() callers could detect this state and use a busy wait instead of a simple console_trylock(). Finally, the console_lock owner checks if there is a busy waiter at the end of the special context and eventually passes the console_lock to the waiter. The hand-off works surprisingly well and helps in many situations. Well, there is still a possibility of the softlockup, for example, when the flood of messages stops and the last owner still has too much to flush. There is increasing number of people having problems with printk-related softlockups. We might eventually need to get better solution. Anyway, this looks like a good start and promising direction. - Do not allow to schedule in console_unlock() called from printk(): This reverts an older controversial commit. The reschedule helped to avoid softlockups. But it also slowed down the console output. This patch is obsoleted by the new console waiter logic described above. In fact, the reschedule made the hand-off less effective. - Deprecate "%pf" and "%pF" format specifier: It was needed on ia64, ppc64 and parisc64 to dereference function descriptors and show the real function address. It is done transparently by "%ps" and "pS" format specifier now. Sergey Senozhatsky found that all the function descriptors were in a special elf section and could be easily detected. - Remove printk_symbol() API: It has been obsoleted by "%pS" format specifier, and this change helped to remove few continuous lines and a less intuitive old API. - Remove redundant memsets: Sergey removed unnecessary memset when processing printk.devkmsg command line option. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk: (27 commits) printk: drop redundant devkmsg_log_str memsets printk: Never set console_may_schedule in console_trylock() printk: Hide console waiter logic into helpers printk: Add console owner and waiter logic to load balance console writes kallsyms: remove print_symbol() function checkpatch: add pF/pf deprecation warning symbol lookup: introduce dereference_symbol_descriptor() parisc64: Add .opd based function descriptor dereference powerpc64: Add .opd based function descriptor dereference ia64: Add .opd based function descriptor dereference sections: split dereference_function_descriptor() openrisc: Fix conflicting types for _exext and _stext lib: do not use print_symbol() irq debug: do not use print_symbol() sysfs: do not use print_symbol() drivers: do not use print_symbol() x86: do not use print_symbol() unicore32: do not use print_symbol() sh: do not use print_symbol() mn10300: do not use print_symbol() ...
2018-02-01Merge tag 'kconfig-v4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuildLinus Torvalds15-5057/+518
Pull Kconfig updates from Masahiro Yamada: "A pretty big batch of Kconfig updates. I have to mention the lexer and parser of Kconfig are now built from real .l and .y sources. So, flex and bison are the requirement for building the kernel. Both of them (unlike gperf) have been stable for a long time. This change has been tested several weeks in linux-next, and I did not receive any problem report about this. Summary: - add checks for mistakes, like the choice default is not in choice, help is doubled - document data structure and complex code - fix various memory leaks - change Makefile to build lexer and parser instead of using pre-generated C files - drop 'boolean' keyword, which is equivalent to 'bool' - use default 'yy' prefix and remove unneeded Make variables - fix gettext() check for xconfig - announce that oldnoconfig will be finally removed - make 'Selected by:' and 'Implied by' readable in help and search result - hide silentoldconfig from 'make help' to stop confusing people - fix misc things and cleanups" * tag 'kconfig-v4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (37 commits) kconfig: Remove silentoldconfig from help and docs; fix kconfig/conf's help kconfig: make "Selected by:" and "Implied by:" readable kconfig: announce removal of oldnoconfig if used kconfig: fix make xconfig when gettext is missing kconfig: Clarify menu and 'if' dependency propagation kconfig: Document 'if' flattening logic kconfig: Clarify choice dependency propagation kconfig: Document SYMBOL_OPTIONAL logic kbuild: remove unnecessary LEX_PREFIX and YACC_PREFIX kconfig: use default 'yy' prefix for lexer and parser kconfig: make conf_unsaved a local variable of conf_read() kconfig: make xfgets() really static kconfig: make input_mode static kconfig: Warn if there is more than one help text kconfig: drop 'boolean' keyword kconfig: use bool instead of boolean for type definition attributes, again kconfig: Remove menu_end_entry() kconfig: Document important expression functions kconfig: Document automatic submenu creation code kconfig: Fix choice symbol expression leak ...
2018-02-01Merge tag 'kbuild-misc-v4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuildLinus Torvalds9-115/+560
Pull Kbuild misc updates from Masahiro Yamada: - add snap-pkg target to create Linux kernel snap package - make out-of-tree creation of source packages fail correctly - improve and fix several semantic patches * tag 'kbuild-misc-v4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: Coccinelle: coccicheck: fix typo Coccinelle: memdup: drop spurious line Coccinelle: kzalloc-simple: Rename kzalloc-simple to zalloc-simple Coccinelle: ifnullfree: Trim the warning reported in report mode Coccinelle: alloc_cast: Add more memory allocating functions to the list Coccinelle: array_size: report even if include is missing Coccinelle: kzalloc-simple: Add all zero allocating functions kbuild: pkg: make out-of-tree rpm/deb-pkg build immediately fail scripts/package: snap-pkg target
2018-02-01Merge tag 'kbuild-v4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuildLinus Torvalds3-142/+101
Pull Kbuild updates from Masahiro Yamada: - terminate the build correctly in case of fixdep errors - clean up fixdep - suppress packed-not-aligned warnings from GCC-8 - fix W= handling for extra DTC warnings * tag 'kbuild-v4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: kbuild: fix W= option checks for extra DTC warnings Kbuild: suppress packed-not-aligned warning for default setting only fixdep: use existing helper to check modular CONFIG options fixdep: refactor parse_dep_file() fixdep: move global variables to local variables of main() fixdep: remove unneeded memcpy() in parse_dep_file() fixdep: factor out common code for reading files fixdep: use malloc() and read() to load dep_file to buffer fixdep: remove unnecessary <arpa/inet.h> inclusion fixdep: exit with error code in error branches of do_config_file()
2018-02-01Merge tag 'char-misc-4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-miscLinus Torvalds2-0/+19
Pull char/misc driver updates from Greg KH: "Here is the big pull request for char/misc drivers for 4.16-rc1. There's a lot of stuff in here. Three new driver subsystems were added for various types of hardware busses: - siox - slimbus - soundwire as well as a new vboxguest subsystem for the VirtualBox hypervisor drivers. There's also big updates from the FPGA subsystem, lots of Android binder fixes, the usual handful of hyper-v updates, and lots of other smaller driver updates. All of these have been in linux-next for a long time, with no reported issues" * tag 'char-misc-4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (155 commits) char: lp: use true or false for boolean values android: binder: use VM_ALLOC to get vm area android: binder: Use true and false for boolean values lkdtm: fix handle_irq_event symbol for INT_HW_IRQ_EN EISA: Delete error message for a failed memory allocation in eisa_probe() EISA: Whitespace cleanup misc: remove AVR32 dependencies virt: vbox: Add error mapping for VERR_INVALID_NAME and VERR_NO_MORE_FILES soundwire: Fix a signedness bug uio_hv_generic: fix new type mismatch warnings uio_hv_generic: fix type mismatch warnings auxdisplay: img-ascii-lcd: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE uio_hv_generic: add rescind support uio_hv_generic: check that host supports monitor page uio_hv_generic: create send and receive buffers uio: document uio_hv_generic regions doc: fix documentation about uio_hv_generic vmbus: add monitor_id and subchannel_id to sysfs per channel vmbus: fix ABI documentation uio_hv_generic: use ISR callback method ...
2018-02-02Coccinelle: coccicheck: fix typoJulia Lawall1-1/+1
Correct spelling of "coccinelle". Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-31Merge tag 'docs-4.16' of git://git.lwn.net/linuxLinus Torvalds1-1300/+206
Pull documentation updates from Jonathan Corbet: "Documentation updates for 4.16. New stuff includes refcount_t documentation, errseq documentation, kernel-doc support for nested structure definitions, the removal of lots of crufty kernel-doc support for unused formats, SPDX tag documentation, the beginnings of a manual for subsystem maintainers, and lots of fixes and updates. As usual, some of the changesets reach outside of Documentation/ to effect kerneldoc comment fixes. It also adds the new LICENSES directory, of which Thomas promises I do not need to be the maintainer" * tag 'docs-4.16' of git://git.lwn.net/linux: (65 commits) linux-next: docs-rst: Fix typos in kfigure.py linux-next: DOC: HWPOISON: Fix path to debugfs in hwpoison.txt Documentation: Fix misconversion of #if docs: add index entry for networking/msg_zerocopy Documentation: security/credentials.rst: explain need to sort group_list LICENSES: Add MPL-1.1 license LICENSES: Add the GPL 1.0 license LICENSES: Add Linux syscall note exception LICENSES: Add the MIT license LICENSES: Add the BSD-3-clause "Clear" license LICENSES: Add the BSD 3-clause "New" or "Revised" License LICENSES: Add the BSD 2-clause "Simplified" license LICENSES: Add the LGPL-2.1 license LICENSES: Add the LGPL 2.0 license LICENSES: Add the GPL 2.0 license Documentation: Add license-rules.rst to describe how to properly identify file licenses scripts: kernel_doc: better handle show warnings logic fs/*/Kconfig: drop links to 404-compliant http://acl.bestbits.at doc: md: Fix a file name to md-fault.c in fault-injection.txt errseq: Add to documentation tree ...
2018-01-31scripts/tags.sh: change find_other_sources() for include directoriesArend van Spriel1-1/+1
The current find done in find_other_sources() excludes directories in the kernel tree that are named 'include', eg.: ./security/apparmor/include ./security/selinux/include ./drivers/net/wireless/broadcom/brcm80211/include ./drivers/gpu/drm/amd/acp/include ./drivers/gpu/drm/amd/display/include ./drivers/gpu/drm/amd/include ./drivers/gpu/drm/nouveau/include This changes the find command in find_other_sources() to include those using the -path option. Link: http://lkml.kernel.org/r/1513335768-7852-1-git-send-email-arend.vanspriel@broadcom.com Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com> Cc: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-01-31scripts/decodecode: make it take multiline Code lineAndy Shevchenko1-0/+12
In case of running scripts/decodecode without any parameters in order to give a copy'n'pasted Code line from, for example, email it would parse only first line of it, while in emails it's split to few. ie, when you have a file out of oops the Code line looks like Code: hh hh ... <hh> ... hh\n When copy'n'paste from, for example, email where sender or some middle MTA split it, the line looks like: Code: hh hh ... hh\n hh ... <hh> ... hh\n hh hh ... hh\n The Code line followed by another oops line usually contains characters out of hex digit + space + < + > set. So add logic to join this split back if and only if the following lines have hex digits, or spaces, or '<', or '>' characters. It will be quite unlikely to have a broken input in well formed Oops or dmesg, thus a simple regex is being used. Link: http://lkml.kernel.org/r/20171212100323.33201-1-andriy.shevchenko@linux.intel.com Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Dave Martin <Dave.Martin@arm.com> Cc: Philippe Ombredanne <pombredanne@nexb.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-01-30Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tipLinus Torvalds1-0/+6
Pull RCU updates from Ingo Molnar: "The main RCU changes in this cycle were: - Updates to use cond_resched() instead of cond_resched_rcu_qs() where feasible (currently everywhere except in kernel/rcu and in kernel/torture.c). Also a couple of fixes to avoid sending IPIs to offline CPUs. - Updates to simplify RCU's dyntick-idle handling. - Updates to remove almost all uses of smp_read_barrier_depends() and read_barrier_depends(). - Torture-test updates. - Miscellaneous fixes" * 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (72 commits) torture: Save a line in stutter_wait(): while -> for torture: Eliminate torture_runnable and perf_runnable torture: Make stutter less vulnerable to compilers and races locking/locktorture: Fix num reader/writer corner cases locking/locktorture: Fix rwsem reader_delay torture: Place all torture-test modules in one MAINTAINERS group rcutorture/kvm-build.sh: Skip build directory check rcutorture: Simplify functions.sh include path rcutorture: Simplify logging rcutorture/kvm-recheck-*: Improve result directory readability check rcutorture/kvm.sh: Support execution from any directory rcutorture/kvm.sh: Use consistent help text for --qemu-args rcutorture/kvm.sh: Remove unused variable, `alldone` rcutorture: Remove unused script, config2frag.sh rcutorture/configinit: Fix build directory error message rcutorture: Preempt RCU-preempt readers more vigorously torture: Reduce #ifdefs for preempt_schedule() rcu: Remove have_rcu_nocb_mask from tree_plugin.h rcu: Add comment giving debug strategy for double call_rcu() tracing, rcu: Hide trace event rcu_nocb_wake when not used ...
2018-01-29Merge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tipLinus Torvalds1-0/+9
Pull x86/pti updates from Thomas Gleixner: "Another set of melted spectrum related changes: - Code simplifications and cleanups for RSB and retpolines. - Make the indirect calls in KVM speculation safe. - Whitelist CPUs which are known not to speculate from Meltdown and prepare for the new CPUID flag which tells the kernel that a CPU is not affected. - A less rigorous variant of the module retpoline check which merily warns when a non-retpoline protected module is loaded and reflects that fact in the sysfs file. - Prepare for Indirect Branch Prediction Barrier support. - Prepare for exposure of the Speculation Control MSRs to guests, so guest OSes which depend on those "features" can use them. Includes a blacklist of the broken microcodes. The actual exposure of the MSRs through KVM is still being worked on" * 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/speculation: Simplify indirect_branch_prediction_barrier() x86/retpoline: Simplify vmexit_fill_RSB() x86/cpufeatures: Clean up Spectre v2 related CPUID flags x86/cpu/bugs: Make retpoline module warning conditional x86/bugs: Drop one "mitigation" from dmesg x86/nospec: Fix header guards names x86/alternative: Print unadorned pointers x86/speculation: Add basic IBPB (Indirect Branch Prediction Barrier) support x86/cpufeature: Blacklist SPEC_CTRL/PRED_CMD on early Spectre v2 microcodes x86/pti: Do not enable PTI on CPUs which are not vulnerable to Meltdown x86/msr: Add definitions for new speculation control MSRs x86/cpufeatures: Add AMD feature bits for Speculation Control x86/cpufeatures: Add Intel feature bits for Speculation Control x86/cpufeatures: Add CPUID_7_EDX CPUID leaf module/retpoline: Warn about missing retpoline in module KVM: VMX: Make indirect call speculation safe KVM: x86: Make indirect calls in emulator speculation safe
2018-01-29Coccinelle: memdup: drop spurious lineJulia Lawall1-1/+0
The kmemdup line in the non-patch case was left over from the added kmemdup line in the patch case. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-28kconfig: Remove silentoldconfig from help and docs; fix kconfig/conf's helpMarc Herbert2-5/+7
As explained by Michal Marek at https://lkml.org/lkml/2011/8/31/189 silentoldconfig has become a misnomer. It has become an internal interface so remove it from "make help" and Documentation/ to stop confusing people using it as seen for instance at https://chromium-review.googlesource.com/835632 Don't remove it from kconfig/Makefile yet not to break any (other) tool using it. On the other hand, correct and expand its description in the help of the (internal) scripts/kconfig/conf.c Signed-off-by: Marc Herbert <marc.herbert@intel.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-26module/retpoline: Warn about missing retpoline in moduleAndi Kleen1-0/+9
There's a risk that a kernel which has full retpoline mitigations becomes vulnerable when a module gets loaded that hasn't been compiled with the right compiler or the right option. To enable detection of that mismatch at module load time, add a module info string "retpoline" at build time when the module was compiled with retpoline support. This only covers compiled C source, but assembler source or prebuilt object files are not checked. If a retpoline enabled kernel detects a non retpoline protected module at load time, print a warning and report it in the sysfs vulnerability file. [ tglx: Massaged changelog ] Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: David Woodhouse <dwmw2@infradead.org> Cc: gregkh@linuxfoundation.org Cc: torvalds@linux-foundation.org Cc: jeyu@kernel.org Cc: arjan@linux.intel.com Link: https://lkml.kernel.org/r/20180125235028.31211-1-andi@firstfloor.org
2018-01-25kbuild: fix W= option checks for extra DTC warningsMasahiro Yamada1-2/+2
Kbuild supports 3 levels of extra warnings, and multiple levels can be combined, like W=12, W=123. It was added by commit a6de553da01c ("kbuild: Allow to combine multiple W= levels"). From the log of commit 8654cb8d0371 ("dtc: update warning settings for new bus and node/property name checks"), I assume: - unit_address_vs_reg, simple_bus_reg, etc. belong to level 1 - node_name_chars_strict, property_name_chars_strict belong to level 2 However, the level 1 warnings are displayed by any argument to W=. On the other hand, the level 2 warnings are displayed by W=2, but not by W=12, or W=123. Use $(findstring ...) like scripts/Makefile.extrawarn. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Arnd Bergmann <arnd@arndb.de>
2018-01-25kconfig: make "Selected by:" and "Implied by:" readablePetr Vorel3-6/+27
Reverse dependency expressions can get rather unwieldy, especially if a symbol is selected by more than a handful of other symbols. I.e. it's possible to have near endless expressions like: A && B && !C || D || F && (G || H) || [...] Chop these expressions into actually readable chunks: - A && B && !C - D - F && (G || H) - [...] I.e. transform the top level OR tokens into newlines and prepend each line with a minus. This makes the "Selected by:" and "Implied by:" blurb much easier to read. This is done only if there is more than one top level OR. "Depends on:" and "Range :" were deliberately left as they are. Based on idea from Paul Bolle. Suggested-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Petr Vorel <petr.vorel@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-25kconfig: announce removal of oldnoconfig if usedMasahiro Yamada1-0/+2
The 'oldnoconfig' is really confusing due to its counter-intuitive name. It was renamed by commit fb16d8912db5 ("kconfig: replace 'oldnoconfig' with 'olddefconfig', and keep the old name as an alias"). The 'oldnoconfig' has been kept as an alias for enough period of time, and finally I am planning to remove it. I will give people a little more time for migration. Meanwhile, the following message will be displayed if oldnoconfig is used. WARNING: "oldnoconfig" target will be removed after Linux 4.19 Please use "olddefconfig" instead, which is an alias. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Ulf Magnusson <ulfalizer@gmail.com>
2018-01-22kconfig: fix make xconfig when gettext is missingYaakov Selkowitz1-0/+1
The C-based config programs are properly guarded from a missing (or, currently, external) libintl.h by the HOST_EXTRACFLAGS check, but this does not help the C++-based qconf. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: Clarify menu and 'if' dependency propagationUlf Magnusson1-0/+2
It is not obvious that the last two cases refer to menus and ifs, respectively, in the conditional that sets 'parentdep'. Automatic submenu creation is done later, so the parent can't be a symbol here. No functional changes. Only comments added. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: Document 'if' flattening logicUlf Magnusson1-0/+29
It is not obvious that this might refer to an 'if', making the code pretty cryptic: if (menu->list && (!menu->prompt || !menu->prompt->text)) { Kconfig keeps the 'if' menu nodes even after flattening. Reflect that in the example to be accurate. No functional changes. Only comments added. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: Clarify choice dependency propagationUlf Magnusson1-0/+7
It's easy to miss that choices are special-cased to pass on their mode as the parent dependency. No functional changes. Only comments added. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: Document SYMBOL_OPTIONAL logicUlf Magnusson1-0/+9
Not obvious, especially if you don't already know how choices are implemented. No functional changes. Only comments added. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kbuild: remove unnecessary LEX_PREFIX and YACC_PREFIXMasahiro Yamada1-6/+2
Kconfig was the only user of these. With Kconfig converted to use the default 'yy' prefix, we do not need them any more. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Ulf Magnusson <ulfalizer@gmail.com>
2018-01-22kconfig: use default 'yy' prefix for lexer and parserMasahiro Yamada3-22/+19
Flex and Bison provide an option to change the prefix of globally- visible symbols. This is useful to link multiple lexers and/or parsers into the same executable. However, Kconfig (and any other host programs in kernel) uses a single lexer and parser. I do not see a good reason to change the default 'yy' prefix. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Ulf Magnusson <ulfalizer@gmail.com>
2018-01-22kconfig: make conf_unsaved a local variable of conf_read()Masahiro Yamada1-2/+2
conf_unsaved is initialized by conf_read_simple(), but it is possible to move it to conf_read() so that it can be a local variable. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: make xfgets() really staticMasahiro Yamada1-10/+7
Sparse reports: warning: symbol 'xfgets' was not declared. Should it be static? It is declared as static, but it is missing in the definition part. Move the definition up and remove the forward declaration. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: make input_mode staticMasahiro Yamada1-1/+2
Sparse reports: warning: symbol 'input_mode' was not declared. Should it be static? Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: Warn if there is more than one help textUlf Magnusson1-0/+5
Avoids mistakes like in the following real-world example, where only the final help string ("Say Y...") was used. This particular example was fixed in commit 561b29e4ec8d ("media: fix media Kconfig help syntax issues"). config DVB_NETUP_UNIDVB ... select DVB_CXD2841ER if MEDIA_SUBDRV_AUTOSELECT ---help--- Support for NetUP PCI express Universal DVB card. help Say Y when you want to support NetUP Dual Universal DVB card ... This now prints the following warning: drivers/media/pci/netup_unidvb:13: warning: 'DVB_NETUP_UNIDVB' defined with more than one help text -- only the last one will be used Also free() any extra help strings. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: drop 'boolean' keywordMasahiro Yamada6-7/+6
No more users of this keyword. Drop it according to the notice by commit 6341e62b212a ("kconfig: use bool instead of boolean for type definition attributes"). Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Luis R. Rodriguez <mcgrof@kernel.org>
2018-01-22kconfig: Remove menu_end_entry()Ulf Magnusson3-11/+1
menu_end_entry() is empty and completely unused as far as I can tell: $ git log -G menu_end_entry --oneline a02f057 [PATCH] kconfig: improve error handling in the parser 1da177e Linux-2.6.12-rc2 Last one is the initial Git commit, where menu_end_entry() is empty as well. I couldn't find anything that redefined it on Google either. It might be a debugging helper for setting a breakpoint after each config, menuconfig, and comment is parsed. IMO it hurts more than it helps in that case by making the parsing code look more complicated at a glance than it really is, and I suspect it doesn't get used much. Tested by running the Kconfiglib test suite, which indirectly verifies that the .config files generated by the C implementation for each defconfig file in the kernel stays the same. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: Document important expression functionsUlf Magnusson1-0/+106
Many of these functions are quite the head scratchers if you don't know what they're trying to do. Document them. Also make it clear which functions rewrite expressions in-place and which return new expressions. This prevents memory errors. No functional changes. Only comments added. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: Document automatic submenu creation codeUlf Magnusson1-0/+38
It's tricky to figure out what it does (and how) without staring at the code for a long time. Document it to make it more transparent. No functional changes. Only comments added. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: Fix choice symbol expression leakUlf Magnusson1-0/+3
When propagating dependencies from parents after parsing, an expression node is allocated if the parent symbol is a 'choice'. This node was never freed. Outline of leak: if (sym && sym_is_choice(sym)) { ... *Allocate (in this case only)* parentdep = expr_alloc_symbol(sym); } else if (parent->prompt) parentdep = parent->prompt->visible.expr; else parentdep = parent->dep; for (menu = parent->list; menu; menu = menu->next) { ... *Copy* basedep = expr_alloc_and(expr_copy(parentdep), basedep); ... } *parentdep lost if the parent is a choice!* Fix by freeing 'parentdep' after the loop if the parent symbol is a choice. Note that this only frees the expression node and not the choice symbol itself. Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix: LEAK SUMMARY: definitely lost: 1,608 bytes in 67 blocks ... Summary after the fix: LEAK SUMMARY: definitely lost: 0 bytes in 0 blocks ... Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: Fix expr_free() E_NOT leakUlf Magnusson1-1/+1
Only the E_NOT operand and not the E_NOT node itself was freed, due to accidentally returning too early in expr_free(). Outline of leak: switch (e->type) { ... case E_NOT: expr_free(e->left.expr); return; ... } *Never reached, 'e' leaked* free(e); Fix by changing the 'return' to a 'break'. Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix: LEAK SUMMARY: definitely lost: 44,448 bytes in 1,852 blocks ... Summary after the fix: LEAK SUMMARY: definitely lost: 1,608 bytes in 67 blocks ... Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: Fix automatic menu creation mem leakUlf Magnusson1-0/+1
expr_trans_compare() always allocates and returns a new expression, giving the following leak outline: ... *Allocate* basedep = expr_trans_compare(basedep, E_UNEQUAL, &symbol_no); ... for (menu = parent->next; menu; menu = menu->next) { ... *Copy* dep2 = expr_copy(basedep); ... *Free copy* expr_free(dep2); } *basedep lost!* Fix by freeing 'basedep' after the loop. Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix: LEAK SUMMARY: definitely lost: 344,376 bytes in 14,349 blocks ... Summary after the fix: LEAK SUMMARY: definitely lost: 44,448 bytes in 1,852 blocks ... Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-22kconfig: Don't leak main menus during parsingUlf Magnusson1-9/+24
If a 'mainmenu' entry appeared in the Kconfig files, two things would leak: - The 'struct property' allocated for the default "Linux Kernel Configuration" prompt. - The string for the T_WORD/T_WORD_QUOTE prompt after the T_MAINMENU token, allocated on the heap in zconf.l. To fix it, introduce a new 'no_mainmenu_stmt' nonterminal that matches if there's no 'mainmenu' and adds the default prompt. That means the prompt only gets allocated once regardless of whether there's a 'mainmenu' statement or not, and managing it becomes simple. Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix: LEAK SUMMARY: definitely lost: 344,568 bytes in 14,352 blocks ... Summary after the fix: LEAK SUMMARY: definitely lost: 344,440 bytes in 14,350 blocks ... Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-19scripts/gdb/linux/tasks.py: fix get_thread_infoXi Kangjie1-0/+2
Since kernel 4.9, the thread_info has been moved into task_struct, no longer locates at the bottom of kernel stack. See commits c65eacbe290b ("sched/core: Allow putting thread_info into task_struct") and 15f4eae70d36 ("x86: Move thread_info into task_struct"). Before fix: (gdb) set $current = $lx_current() (gdb) p $lx_thread_info($current) $1 = {flags = 1470918301} (gdb) p $current.thread_info $2 = {flags = 2147483648} After fix: (gdb) p $lx_thread_info($current) $1 = {flags = 2147483648} (gdb) p $current.thread_info $2 = {flags = 2147483648} Link: http://lkml.kernel.org/r/20180118210159.17223-1-imxikangjie@gmail.com Fixes: 15f4eae70d36 ("x86: Move thread_info into task_struct") Signed-off-by: Xi Kangjie <imxikangjie@gmail.com> Acked-by: Jan Kiszka <jan.kiszka@siemens.com> Acked-by: Kieran Bingham <kbingham@kernel.org> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-01-19scripts/decodecode: fix decoding for AArch64 (arm64) instructionsWill Deacon1-0/+8
There are a couple of problems with the decodecode script and arm64: 1. AArch64 objdump refuses to disassemble .4byte directives as instructions, insisting that they are data values and displaying them as: a94153f3 .word 0xa94153f3 <-- trapping instruction This is resolved by using the .inst directive instead. 2. Disassembly of branch instructions attempts to provide the target as an offset from a symbol, e.g.: 0: 34000082 cbz w2, 10 <.text+0x10> however this falls foul of the grep -v, which matches lines containing ".text" and ends up removing all branch instructions from the dump. This patch resolves both issues by using the .inst directive for 4-byte quantities on arm64 and stripping the resulting binaries (as is done on arm already) to remove the mapping symbols. Link: http://lkml.kernel.org/r/1506596147-23630-1-git-send-email-will.deacon@arm.com Signed-off-by: Will Deacon <will.deacon@arm.com> Reviewed-by: Dave Martin <Dave.Martin@arm.com> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-01-18Kbuild: suppress packed-not-aligned warning for default setting onlyXiongfeng Wang1-0/+3
gcc-8 reports many -Wpacked-not-aligned warnings. The below are some examples. ./include/linux/ceph/msgr.h:67:1: warning: alignment 1 of 'struct ceph_entity_addr' is less than 8 [-Wpacked-not-aligned] } __attribute__ ((packed)); ./include/linux/ceph/msgr.h:67:1: warning: alignment 1 of 'struct ceph_entity_addr' is less than 8 [-Wpacked-not-aligned] } __attribute__ ((packed)); ./include/linux/ceph/msgr.h:67:1: warning: alignment 1 of 'struct ceph_entity_addr' is less than 8 [-Wpacked-not-aligned] } __attribute__ ((packed)); This patch suppresses this kind of warnings for default setting. Signed-off-by: Xiongfeng Wang <xiongfeng.wang@linaro.org> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-18fixdep: use existing helper to check modular CONFIG optionsMasahiro Yamada1-12/+12
str_ends_with() tests if the given token ends with a particular string. Currently, it is used to check file paths without $(srctree). Actually, we have one more place where this helper is useful. Use it to check if CONFIG option ends with _MODULE. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-18fixdep: refactor parse_dep_file()Masahiro Yamada1-40/+40
parse_dep_file() has too much indentation, and puts the code far to the right. This commit refactors the code and reduces the one level of indentation. strrcmp() computes 'slen' by itself, but the caller already knows the length of the token, so 'slen' can be passed via function argument. With this, we can swap the order of strrcmp() and "*p = \0;" Also, strrcmp() is an ambiguous function name. Flip the logic and rename it to str_ends_with(). I added a new helper is_ignored_file() - this returns 1 if the token represents a file that should be ignored. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-18fixdep: move global variables to local variables of main()Masahiro Yamada1-26/+16
I do not mind global variables where they are useful enough. In this case, I do not see a good reason to use global variables since they are just referenced in shallow places. It is easy to pass them via function arguments. I squashed print_cmdline() into main() since it is just one line code. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-18fixdep: remove unneeded memcpy() in parse_dep_file()Masahiro Yamada1-13/+9
Each token in the depfile is copied to the temporary buffer 's' to terminate the token with zero. We do not need to do this any more because the parsed buffer is now writable. Insert '\0' directly in the buffer without calling memcpy(). <limits.h> is no longer necessary. (It was needed for PATH_MAX). Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-18fixdep: factor out common code for reading filesMasahiro Yamada1-55/+20
Now, do_config_files() and print_deps() are almost the same. Only the difference is the parser function called (parse_config_file vs parse_dep_file). We can reduce the code duplication by factoring out the common code into read_file() - this function allocates a buffer and loads a file to it. It returns the pointer to the allocated buffer. (As before, it bails out by exit(2) for any error.) The caller must free the buffer when done. Having empty source files is possible; fixdep should simply skip them. I deleted the "st.st_size == 0" check, so read_file() allocates 1-byte buffer for an empty file. strstr() will immediately return NULL, and this is what we expect. On the other hand, an empty dep_file should be treated as an error. In this case, parse_dep_file() will error out with "no targets found" and it is a correct error message. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-18fixdep: use malloc() and read() to load dep_file to bufferMasahiro Yamada1-24/+32
Commit dee81e988674 ("fixdep: faster CONFIG_ search") changed how to read files in which CONFIG options are searched. It used malloc() and read() instead of mmap() because it needed to zero-terminate the buffer in order to use strstr(). print_deps() was left untouched since there was no reason to change it. Now, I have two motivations to change it in the same way. - do_config_file() and print_deps() do quite similar things; they open a file, load it onto memory, and pass it to a parser function. If we use malloc() and read() for print_deps() too, we can factor out the common code. (I will do this in the next commit.) - parse_dep_file() copies each token to a temporary buffer because it needs to zero-terminate it to be passed to printf(). It is not possible to modify the buffer directly because it is mmap'ed with O_RDONLY. If we load the file content into a malloc'ed buffer, we can insert '\0' after each token, and save memcpy(). (I will do this in the commit after next.) Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-18fixdep: remove unnecessary <arpa/inet.h> inclusionMasahiro Yamada1-1/+0
<arpa/inet.h> was included for ntohl(), but it was removed by commit dee81e988674 ("fixdep: faster CONFIG_ search"). Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-01-17Merge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tipLinus Torvalds1-4/+10
Pull x86 pti bits and fixes from Thomas Gleixner: "This last update contains: - An objtool fix to prevent a segfault with the gold linker by changing the invocation order. That's not just for gold, it's a general robustness improvement. - An improved error message for objtool which spares tearing hairs. - Make KASAN fail loudly if there is not enough memory instead of oopsing at some random place later - RSB fill on context switch to prevent RSB underflow and speculation through other units. - Make the retpoline/RSB functionality work reliably for both Intel and AMD - Add retpoline to the module version magic so mismatch can be detected - A small (non-fix) update for cpufeatures which prevents cpu feature clashing for the upcoming extra mitigation bits to ease backporting" * 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: module: Add retpoline tag to VERMAGIC x86/cpufeature: Move processor tracing out of scattered features objtool: Improve error message for bad file argument objtool: Fix seg fault with gold linker x86/retpoline: Add LFENCE to the retpoline/RSB filling RSB macros x86/retpoline: Fill RSB on context switch for affected CPUs x86/kasan: Panic if there is not enough memory to boot