mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 08:03:01 +09:00
Merge pull request #603 from ddiss/lkl_mv_autoconf_to_kconfig
move some tools/lkl/Makefile.autoconf logic to kconfig
This commit is contained in:
174
arch/lkl/Kconfig
174
arch/lkl/Kconfig
@@ -1,111 +1,112 @@
|
||||
config LKL
|
||||
def_bool y
|
||||
depends on !SMP && !COREDUMP && !SECCOMP && !UPROBES && !COMPAT && !USER_RETURN_NOTIFIER
|
||||
select ARCH_THREAD_STACK_ALLOCATOR
|
||||
select GENERIC_ATOMIC64
|
||||
select GENERIC_HWEIGHT
|
||||
select FLATMEM
|
||||
select GENERIC_CLOCKEVENTS
|
||||
select GENERIC_CPU_DEVICES
|
||||
select NO_HZ_IDLE
|
||||
select NO_PREEMPT
|
||||
select ARCH_WANT_FRAME_POINTERS
|
||||
select UACCESS_MEMCPY
|
||||
select GENERIC_STRNCPY_FROM_USER
|
||||
select GENERIC_STRNLEN_USER
|
||||
select HAVE_ARCH_KASAN
|
||||
select TRACING
|
||||
def_bool y
|
||||
depends on !SMP && !COREDUMP && !SECCOMP && !UPROBES && !COMPAT && !USER_RETURN_NOTIFIER
|
||||
select ARCH_THREAD_STACK_ALLOCATOR
|
||||
select GENERIC_ATOMIC64
|
||||
select GENERIC_HWEIGHT
|
||||
select FLATMEM
|
||||
select GENERIC_CLOCKEVENTS
|
||||
select GENERIC_CPU_DEVICES
|
||||
select NO_HZ_IDLE
|
||||
select NO_PREEMPT
|
||||
select ARCH_WANT_FRAME_POINTERS
|
||||
select UACCESS_MEMCPY
|
||||
select GENERIC_STRNCPY_FROM_USER
|
||||
select GENERIC_STRNLEN_USER
|
||||
select HAVE_ARCH_KASAN
|
||||
select TRACING
|
||||
|
||||
config LKL_FUZZING
|
||||
bool "LLVM fuzzing instrumentation"
|
||||
default n
|
||||
help
|
||||
This configuration option enables fuzzing instrumentation
|
||||
for the Linux kernel source files to enable coverage-guided
|
||||
fuzzing. At the moment LKL supports libFuzzer fuzzing
|
||||
engine only.
|
||||
bool "LLVM fuzzing instrumentation"
|
||||
default n
|
||||
help
|
||||
This configuration option enables fuzzing instrumentation
|
||||
for the Linux kernel source files to enable coverage-guided
|
||||
fuzzing. At the moment LKL supports libFuzzer fuzzing
|
||||
engine only.
|
||||
|
||||
config LKL_LINE_COV
|
||||
bool "Code coverage instrumentation for fuzzers"
|
||||
depends on LKL_FUZZING && CC_IS_CLANG
|
||||
default n
|
||||
help
|
||||
This configuration option enables line code coverage
|
||||
instrumentation for the Linux kernel to generate fuzzing
|
||||
code coverage reports. When this option is enabled the
|
||||
kernel source files are built with LLVM SanitizerCoverage
|
||||
instrumentation.
|
||||
bool "Code coverage instrumentation for fuzzers"
|
||||
depends on LKL_FUZZING && CC_IS_CLANG
|
||||
default n
|
||||
help
|
||||
This configuration option enables line code coverage
|
||||
instrumentation for the Linux kernel to generate fuzzing
|
||||
code coverage reports. When this option is enabled the
|
||||
kernel source files are built with LLVM SanitizerCoverage
|
||||
instrumentation.
|
||||
|
||||
config OUTPUT_FORMAT
|
||||
string "Output format"
|
||||
default ""
|
||||
string "Output format"
|
||||
default $(shell,$(srctree)/arch/lkl/scripts/cc-objdump-file-format.sh)
|
||||
|
||||
config ARCH_DMA_ADDR_T_64BIT
|
||||
def_bool 64BIT
|
||||
def_bool 64BIT
|
||||
|
||||
config PHYS_ADDR_T_64BIT
|
||||
def_bool 64BIT
|
||||
def_bool 64BIT
|
||||
|
||||
config 64BIT
|
||||
bool "64bit kernel"
|
||||
default n
|
||||
bool "64bit kernel"
|
||||
default y if OUTPUT_FORMAT = "pe-x86-64"
|
||||
default $(success,$(srctree)/arch/lkl/scripts/cc-objdump-file-format.sh|grep -q '^elf64-') if OUTPUT_FORMAT != "pe-x86-64"
|
||||
|
||||
config MMU
|
||||
bool "LKL MMU implementation"
|
||||
depends on 64BIT
|
||||
default n
|
||||
bool "LKL MMU implementation"
|
||||
depends on 64BIT
|
||||
default n
|
||||
|
||||
if MMU
|
||||
config PGTABLE_LEVELS
|
||||
int
|
||||
default 3
|
||||
int
|
||||
default 3
|
||||
|
||||
config LKL_MEMORY_START
|
||||
hex
|
||||
default 0x50000000
|
||||
help
|
||||
Base address of kernel virtual address space for LKL. No particular
|
||||
reason for picking this specific value. It is assumed that the host
|
||||
mmap is able to map requested amount of memory at this address.
|
||||
STACK_TOP and VMALLOC_START values depend on it.
|
||||
|
||||
hex
|
||||
default 0x50000000
|
||||
help
|
||||
Base address of kernel virtual address space for LKL. No particular
|
||||
reason for picking this specific value. It is assumed that the host
|
||||
mmap is able to map requested amount of memory at this address.
|
||||
STACK_TOP and VMALLOC_START values depend on it.
|
||||
|
||||
config LKL_TASK_UNMAPPED_BASE
|
||||
hex
|
||||
default 0x100000
|
||||
help
|
||||
Starting virtual address for LKL user-space mmap. It is assumed that
|
||||
the host mmap is able to map requested amount of memory starting from
|
||||
this address.
|
||||
hex
|
||||
default 0x100000
|
||||
help
|
||||
Starting virtual address for LKL user-space mmap. It is assumed that
|
||||
the host mmap is able to map requested amount of memory starting from
|
||||
this address.
|
||||
|
||||
config LKL_MMU_KUNIT_TEST
|
||||
bool "Kunit tests for LKL MMU"
|
||||
default n
|
||||
depends on KUNIT
|
||||
help
|
||||
Kunit tests to test correctness of MMU-related kernel interfaces (such
|
||||
as vmalloc, for example) which are difficult to test in user-space.
|
||||
bool "Kunit tests for LKL MMU"
|
||||
default n
|
||||
depends on KUNIT
|
||||
help
|
||||
Kunit tests to test correctness of MMU-related kernel interfaces (such
|
||||
as vmalloc, for example) which are difficult to test in user-space.
|
||||
endif
|
||||
|
||||
config COREDUMP
|
||||
def_bool n
|
||||
def_bool n
|
||||
|
||||
config CPU_BIG_ENDIAN
|
||||
bool "Big-endian kernel"
|
||||
default n
|
||||
bool "Big-endian kernel"
|
||||
default y if OUTPUT_FORMAT = "elf64-s390"
|
||||
default n if OUTPUT_FORMAT != "elf64-s390"
|
||||
|
||||
config GENERIC_CSUM
|
||||
def_bool y
|
||||
def_bool y
|
||||
|
||||
config GENERIC_HWEIGHT
|
||||
def_bool y
|
||||
def_bool y
|
||||
|
||||
config NO_IOPORT_MAP
|
||||
def_bool y
|
||||
def_bool y
|
||||
|
||||
config HZ
|
||||
int
|
||||
default 100
|
||||
int
|
||||
default 100
|
||||
|
||||
config CONSOLE_LOGLEVEL_QUIET
|
||||
int "quiet console loglevel (1-15)"
|
||||
@@ -131,16 +132,18 @@ config RAID6_PQ_BENCHMARK
|
||||
default n
|
||||
|
||||
config STACKTRACE_SUPPORT
|
||||
def_bool y
|
||||
def_bool y
|
||||
|
||||
if KASAN
|
||||
config KASAN_SHADOW_OFFSET
|
||||
hex "KASAN shadow offset"
|
||||
default "0"
|
||||
hex "KASAN shadow offset"
|
||||
default "0x0000200000000000" if OUTPUT_FORMAT = "elf64-x86-64"
|
||||
default "0" if OUTPUT_FORMAT != "elf64-x86-64"
|
||||
|
||||
config KASAN_SHADOW_SIZE
|
||||
hex "KASAN shadow size"
|
||||
default "0"
|
||||
hex "KASAN shadow size"
|
||||
default "0x0000100000000000" if OUTPUT_FORMAT = "elf64-x86-64"
|
||||
default "0" if OUTPUT_FORMAT != "elf64-x86-64"
|
||||
endif
|
||||
|
||||
config BUILTIN_CMDLINE
|
||||
@@ -154,21 +157,22 @@ config BUILTIN_CMDLINE
|
||||
|
||||
config LKL_HOST_MEMCPY
|
||||
bool "Host provides memcpy"
|
||||
default n
|
||||
default $(success,$(srctree)/arch/lkl/scripts/cc-objdump-file-format.sh|grep -q '^elf64-') if 64BIT
|
||||
default $(success,$(srctree)/arch/lkl/scripts/cc-objdump-file-format.sh|grep -q '^elf32-') if !64BIT
|
||||
help
|
||||
This options should be set (in tools/lkl/Makefile.autoconf)
|
||||
if the host provides a memcpy implementation.
|
||||
Set to "y" if LKL should call the host memcpy hook instead of
|
||||
performing memory copies manually.
|
||||
|
||||
config LKL_HOST_MEMSET
|
||||
bool "Host provides memset"
|
||||
default n
|
||||
default LKL_HOST_MEMCPY
|
||||
help
|
||||
This options should be set (in tools/lkl/Makefile.autoconf)
|
||||
if the host provides a memset implementation.
|
||||
Set to "y" if LKL should call the host memset hook instead of
|
||||
performing memory sets manually.
|
||||
|
||||
config LKL_HOST_MEMMOVE
|
||||
bool "Host provides memmove"
|
||||
default n
|
||||
default LKL_HOST_MEMCPY
|
||||
help
|
||||
This options should be set (in tools/lkl/Makefile.autoconf)
|
||||
if the host provides a memmove implementation.
|
||||
Set to "y" if LKL should call the host memmove hook instead of
|
||||
performing memory moves manually.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
CONFIG_LKL_FUZZING=y
|
||||
# CONFIG_LOCALVERSION_AUTO is not set
|
||||
CONFIG_NO_HZ_IDLE=y
|
||||
CONFIG_HIGH_RES_TIMERS=y
|
||||
|
||||
8
arch/lkl/scripts/cc-objdump-file-format.sh
Executable file
8
arch/lkl/scripts/cc-objdump-file-format.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
#
|
||||
# Print the C compiler output file format, as determined by objdump.
|
||||
t=`mktemp` || exit 1
|
||||
echo 'void foo(void) {}' | $CC -x c - -c -o "$t" \
|
||||
&& $OBJDUMP -p "$t" | awk '/file format/ {print $4}'
|
||||
rm "$t"
|
||||
@@ -110,8 +110,17 @@ extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
|
||||
extern void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end);
|
||||
int shmem_unuse(unsigned int type);
|
||||
|
||||
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
||||
extern bool shmem_is_huge(struct inode *inode, pgoff_t index, bool shmem_huge_force,
|
||||
struct mm_struct *mm, unsigned long vm_flags);
|
||||
#else
|
||||
static __always_inline bool shmem_is_huge(struct inode *inode, pgoff_t index, bool shmem_huge_force,
|
||||
struct mm_struct *mm, unsigned long vm_flags)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SHMEM
|
||||
extern unsigned long shmem_swap_usage(struct vm_area_struct *vma);
|
||||
#else
|
||||
|
||||
@@ -742,12 +742,6 @@ static long shmem_unused_huge_count(struct super_block *sb,
|
||||
|
||||
#define shmem_huge SHMEM_HUGE_DENY
|
||||
|
||||
bool shmem_is_huge(struct inode *inode, pgoff_t index, bool shmem_huge_force,
|
||||
struct mm_struct *mm, unsigned long vm_flags)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo,
|
||||
struct shrink_control *sc, unsigned long nr_to_split)
|
||||
{
|
||||
|
||||
@@ -84,9 +84,6 @@ define posix_host
|
||||
$(if $(filter $(1),elf32-i386),$(call set_autoconf_var,I386,y))
|
||||
$(if $(strip $(call find_include,jsmn.h)),$(call set_autoconf_var,JSMN,y))
|
||||
$(if $(filter %,$(zpoline)),$(call zpoline_conf,$(zpoline)))
|
||||
$(call set_kernel_config,LKL_HOST_MEMCPY,y)
|
||||
$(call set_kernel_config,LKL_HOST_MEMSET,y)
|
||||
$(call set_kernel_config,LKL_HOST_MEMMOVE,y)
|
||||
endef
|
||||
|
||||
define nt64_host
|
||||
@@ -113,21 +110,6 @@ define nt_host
|
||||
$(if $(filter $(1),pe-x86-64),$(call nt64_host))
|
||||
endef
|
||||
|
||||
define s390_host
|
||||
$(call set_kernel_config,CPU_BIG_ENDIAN,y)
|
||||
endef
|
||||
|
||||
define 64bit_host
|
||||
$(call set_kernel_config,64BIT,y)
|
||||
endef
|
||||
|
||||
define kasan_x86_64
|
||||
$(call set_autoconf_var,KASAN_SHADOW_OFFSET,0x0000200000000000)
|
||||
$(call set_kernel_config,KASAN_SHADOW_OFFSET,0x0000200000000000)
|
||||
$(call set_autoconf_var,KASAN_SHADOW_SIZE,0x0000100000000000)
|
||||
$(call set_kernel_config,KASAN_SHADOW_SIZE,0x0000100000000000)
|
||||
endef
|
||||
|
||||
define kasan_test_enable
|
||||
$(call set_autoconf_var,KASAN_TEST,y)
|
||||
$(call set_kernel_config,KUNIT,y)
|
||||
@@ -138,10 +120,6 @@ endef
|
||||
define kasan_enable
|
||||
$(call set_autoconf_var,KASAN,y)
|
||||
$(call set_kernel_config,KASAN,y)
|
||||
# default is 20 which should be 1MB but observed 8MB of reserved
|
||||
# memory - half of what we use
|
||||
$(call set_kernel_config,STACK_HASH_ORDER,12)
|
||||
$(if $(filter $(1),elf64-x86-64),$(call kasan_x86_64))
|
||||
$(if $(filter yes,$(kasan_test)), $(call kasan_test_enable))
|
||||
endef
|
||||
|
||||
@@ -255,7 +233,6 @@ define do_autoconf_fuzzing
|
||||
$(eval LLVM := 1)
|
||||
$(eval CROSS_COMPILE := x86_64-linux-gnu)
|
||||
$(eval kasan := yes)
|
||||
$(call set_kernel_config,LKL_FUZZING,y)
|
||||
$(if $(LKL_LINE_COV),$(call set_kernel_config,LKL_LINE_COV,y))
|
||||
$(if $(MMU),$(call set_kernel_config,ANDROID_BINDER_IPC,y))
|
||||
$(if $(PROTOBUF_MUTATOR_DIR),$(call define_libprotobuf_mutator))
|
||||
@@ -271,15 +248,6 @@ endef
|
||||
define do_autoconf_mmu
|
||||
$(call set_autoconf_var,MMU,y)
|
||||
$(call set_kernel_config,MMU,y)
|
||||
# Explicitly set LKL MMU configuration parameters for Kconfig
|
||||
$(call set_autoconf_var,LKL_MEMORY_START,0x50000000)
|
||||
$(call set_kernel_config,LKL_MEMORY_START,0x50000000)
|
||||
$(call set_autoconf_var,LKL_TASK_UNMAPPED_BASE,0x100000)
|
||||
$(call set_kernel_config,LKL_TASK_UNMAPPED_BASE,0x100000)
|
||||
# Don't need swap in LKL. CONFIG_SHMEM generates a compile-time assertion
|
||||
# when build with gcc, however, works fine with clang. The issues is in macro
|
||||
# HPAGE_PMD_SIZE which should be optimized out but is not in case of gcc.
|
||||
$(call set_kernel_config,SHMEM,n)
|
||||
$(if $(MMU_KUNIT), $(call mmu_test_enable))
|
||||
endef
|
||||
|
||||
@@ -287,9 +255,6 @@ define do_autoconf
|
||||
$(if $(LKL_FUZZING),$(call do_autoconf_fuzzing))
|
||||
$(if $(LLVM),$(call do_autoconf_llvm),$(call do_autoconf_gnu))
|
||||
$(eval EXEC_FMT := $(shell echo $(LD_FMT) | cut -d "-" -f1))
|
||||
$(call set_kernel_config,OUTPUT_FORMAT,\"$(LD_FMT)\")
|
||||
$(if $(or $(filter $(EXEC_FMT),elf64),$(filter $(LD_FMT),pe-x86-64)),$(call 64bit_host))
|
||||
$(if $(filter $(LD_FMT),elf64-s390),$(call s390_host))
|
||||
$(if $(filter $(EXEC_FMT),$(POSIX_HOSTS)),$(call posix_host,$(LD_FMT)))
|
||||
$(if $(filter $(EXEC_FMT),$(NT_HOSTS)),$(call nt_host,$(LD_FMT)))
|
||||
$(if $(and $(filter yes,$(kasan)),$(filter $(LD_FMT),$(KASAN_HOSTS))),$(call kasan_enable,$(LD_FMT)))
|
||||
|
||||
Reference in New Issue
Block a user