Go to file
Masahiro Yamada 7d153696e5 kbuild: do not include include/config/auto.conf from shell scripts
Richard Weinberger pointed out the risk of sourcing the kernel config
from shell scripts [1], and proposed some patches [2], [3]. It is a good
point, but it took a long time because I was wondering how to fix this.

This commit goes with simple grep approach because there are only a few
scripts including the kernel configuration.

scripts/link_vmlinux.sh has references to a bunch of CONFIG options,
all of which are boolean. I added is_enabled() helper as
scripts/package/{mkdebian,builddeb} do.

scripts/gen_autoksyms.sh uses 'eval', stating "to expand the whitelist
path". I removed it since it is the issue we are trying to fix.

I was a bit worried about the cost of invoking the grep command over
again. I extracted the grep parts from it, and measured the cost. It
was approximately 0.03 sec, which I hope is acceptable.

[test code]

  $ cat test-grep.sh
  #!/bin/sh

  is_enabled() {
          grep -q "^$1=y" include/config/auto.conf
  }

  is_enabled CONFIG_LTO_CLANG
  is_enabled CONFIG_LTO_CLANG
  is_enabled CONFIG_STACK_VALIDATION
  is_enabled CONFIG_UNWINDER_ORC
  is_enabled CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
  is_enabled CONFIG_VMLINUX_VALIDATION
  is_enabled CONFIG_FRAME_POINTER
  is_enabled CONFIG_GCOV_KERNEL
  is_enabled CONFIG_LTO_CLANG
  is_enabled CONFIG_RETPOLINE
  is_enabled CONFIG_X86_SMAP
  is_enabled CONFIG_LTO_CLANG
  is_enabled CONFIG_VMLINUX_MAP
  is_enabled CONFIG_KALLSYMS_ALL
  is_enabled CONFIG_KALLSYMS_ABSOLUTE_PERCPU
  is_enabled CONFIG_KALLSYMS_BASE_RELATIVE
  is_enabled CONFIG_DEBUG_INFO_BTF
  is_enabled CONFIG_KALLSYMS
  is_enabled CONFIG_DEBUG_INFO_BTF
  is_enabled CONFIG_BPF
  is_enabled CONFIG_BUILDTIME_TABLE_SORT
  is_enabled CONFIG_KALLSYMS

  $ time ./test-grep.sh
  real    0m0.036s
  user    0m0.027s
  sys     m0.009s

[1]: https://lore.kernel.org/all/1919455.eZKeABUfgV@blindfold/
[2]: https://lore.kernel.org/all/20180219092245.26404-1-richard@nod.at/
[3]: https://lore.kernel.org/all/20210920213957.1064-2-richard@nod.at/
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <n.schier@avm.de>
2022-01-08 17:46:36 +09:00
Documentation Documentation: Raise the minimum supported version of LLVM to 11.0.0 2021-12-02 17:24:32 +09:00
LICENSES LICENSES/dual/CC-BY-4.0: Git rid of "smart quotes" 2021-07-15 06:31:24 -06:00
arch nds32: remove unused BUILTIN_DTB from arch/nds32/Makefile 2021-12-11 22:09:14 +09:00
block block: call rq_qos_done() before ref check in batch completions 2021-11-26 09:53:23 -07:00
certs certs: simplify $(srctree)/ handling and remove config_filename macro 2022-01-08 17:46:35 +09:00
crypto Update to zstd-1.4.10 2021-11-13 15:32:30 -08:00
drivers vhost,virtio,vdpa: bugfixes 2021-11-28 11:58:52 -08:00
fs 5 ksmbd server fixes, 4 for stable 2021-11-27 14:49:35 -08:00
include kbuild: move headers_check.pl to usr/include/ 2022-01-08 17:41:00 +09:00
init init/Kconfig: Drop linker version check for LD_ORPHAN_WARN 2021-12-02 17:25:35 +09:00
ipc shm: extend forced shm destroy to support objects from several IPC nses 2021-11-20 10:35:54 -08:00
kernel gcov: Remove compiler version check 2021-12-02 17:25:21 +09:00
lib parisc: Increase FRAME_WARN to 2048 bytes on parisc 2021-11-22 07:37:31 +01:00
mm Fixes for 5.16 folios: 2021-11-25 10:13:56 -08:00
net vhost,virtio,vdpa: bugfixes 2021-11-28 11:58:52 -08:00
samples s390 updates for 5.16-rc2 2021-11-20 10:55:50 -08:00
scripts kbuild: do not include include/config/auto.conf from shell scripts 2022-01-08 17:46:36 +09:00
security selinux: fix NULL-pointer dereference when hashtab allocation fails 2021-11-19 16:11:39 -05:00
sound xen: branch for v5.16-rc3 2021-11-26 09:54:13 -08:00
tools Networking fixes for 5.16-rc3, including fixes from netfilter. 2021-11-26 12:58:53 -08:00
usr kbuild: move headers_check.pl to usr/include/ 2022-01-08 17:41:00 +09:00
virt Merge branch 'kvm-5.16-fixes' into kvm-master 2021-11-18 02:11:57 -05:00
.clang-format clang-format: Update with the latest for_each macro list 2021-05-12 23:32:39 +02:00
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore .gitignore: ignore only top-level modules.builtin 2021-05-02 00:43:35 +09:00
.mailmap MAINTAINERS: update email address of Christian Borntraeger 2021-11-18 17:50:54 +01:00
COPYING COPYING: state that all contributions really are covered by this file 2020-02-10 13:32:20 -08:00
CREDITS MAINTAINERS: Move Daniel Drake to credits 2021-09-21 08:34:58 +03:00
Kbuild kbuild: rename hostprogs-y/always to hostprogs/always-y 2020-02-04 01:53:07 +09:00
Kconfig kbuild: ensure full rebuild when the compiler is updated 2020-05-12 13:28:33 +09:00
MAINTAINERS Networking fixes for 5.16-rc3, including fixes from netfilter. 2021-11-26 12:58:53 -08:00
Makefile certs: refactor file cleaning 2022-01-08 17:46:35 +09:00
README

README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.