mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
Merge tag 'android12-5.10-2023-02_r1' of https://android.googlesource.com/kernel/common
android12-5.10 February 2023 release 1 Artifacts: https://ci.android.com/builds/submitted/9611440/kernel_aarch64/latest * tag 'android12-5.10-2023-02_r1': (5560 commits) ANDROID: GKI: Enable ARM64_ERRATUM_2454944 ANDROID: dma-ops: Add restricted vendor hook ANDROID: arm64: Work around Cortex-A510 erratum 2454944 ANDROID: mm/vmalloc: Add override for lazy vunmap ANDROID: cpuidle-psci: Fix suspicious RCU usage ANDROID: ABI: update allowed list for galaxy FROMGIT: f2fs: add sysfs nodes to set last_age_weight FROMGIT: f2fs: fix wrong calculation of block age ANDROID: struct io_uring ABI preservation hack for 5.10.162 changes ANDROID: fix up struct task_struct ABI change in 5.10.162 ANDROID: add flags variable back to struct proto_ops UPSTREAM: io_uring: pass in EPOLL_URING_WAKE for eventfd signaling and wakeups UPSTREAM: eventfd: provide a eventfd_signal_mask() helper UPSTREAM: eventpoll: add EPOLL_URING_WAKE poll wakeup flag UPSTREAM: Revert "proc: don't allow async path resolution of /proc/self components" UPSTREAM: Revert "proc: don't allow async path resolution of /proc/thread-self components" UPSTREAM: net: remove cmsg restriction from io_uring based send/recvmsg calls UPSTREAM: task_work: unconditionally run task_work from get_signal() UPSTREAM: signal: kill JOBCTL_TASK_WORK UPSTREAM: io_uring: import 5.15-stable io_uring ... Change-Id: I2b16474d6e3a91f1d702486ec6d1565a7bc310e3 Conflicts: Documentation/ABI/testing/configfs-usb-gadget-uac2 Documentation/usb/gadget-testing.rst Makefile arch/arm/boot/dts/rk3288-evb-act8846.dts arch/arm64/mm/Makefile drivers/dma-buf/dma-buf.c drivers/gpu/drm/bridge/analogix/analogix_dp_core.c drivers/gpu/drm/bridge/synopsys/dw-hdmi.c drivers/gpu/drm/rockchip/analogix_dp-rockchip.c drivers/gpu/drm/rockchip/rockchip_drm_vop.c drivers/mmc/core/mmc.c drivers/pci/controller/dwc/pcie-designware-host.c drivers/pinctrl/pinctrl-rockchip.c drivers/regulator/core.c drivers/usb/dwc3/ep0.c drivers/usb/dwc3/gadget.c drivers/usb/gadget/function/f_hid.c drivers/usb/gadget/function/f_uac1.c drivers/usb/gadget/function/f_uac2.c drivers/usb/gadget/function/u_audio.c drivers/usb/gadget/function/u_audio.h drivers/usb/gadget/function/u_uac2.h drivers/usb/host/xhci.h drivers/usb/storage/unusual_uas.h drivers/usb/typec/altmodes/displayport.c include/linux/page_ext.h mm/cma.c mm/page_ext.c sound/core/pcm_dmaengine.c sound/soc/codecs/hdmi-codec.c include/linux/stmmac.h sound/drivers/aloop.c drivers/pci/controller/dwc/pcie-designware.h
This commit is contained in:
@@ -179,8 +179,29 @@ echo-cmd = $(if $($(quiet)cmd_$(1)),\
|
||||
quiet_redirect :=
|
||||
silent_redirect := exec >/dev/null;
|
||||
|
||||
# Delete the target on interruption
|
||||
#
|
||||
# GNU Make automatically deletes the target if it has already been changed by
|
||||
# the interrupted recipe. So, you can safely stop the build by Ctrl-C (Make
|
||||
# will delete incomplete targets), and resume it later.
|
||||
#
|
||||
# However, this does not work when the stderr is piped to another program, like
|
||||
# $ make >&2 | tee log
|
||||
# Make dies with SIGPIPE before cleaning the targets.
|
||||
#
|
||||
# To address it, we clean the target in signal traps.
|
||||
#
|
||||
# Make deletes the target when it catches SIGHUP, SIGINT, SIGQUIT, SIGTERM.
|
||||
# So, we cover them, and also SIGPIPE just in case.
|
||||
#
|
||||
# Of course, this is unneeded for phony targets.
|
||||
delete-on-interrupt = \
|
||||
$(if $(filter-out $(PHONY), $@), \
|
||||
$(foreach sig, HUP INT QUIT TERM PIPE, \
|
||||
trap 'rm -f $@; trap - $(sig); kill -s $(sig) $$$$' $(sig);))
|
||||
|
||||
# printing commands
|
||||
cmd = @set -e; $(echo-cmd) $($(quiet)redirect) $(cmd_$(1))
|
||||
cmd = @set -e; $(echo-cmd) $($(quiet)redirect) $(delete-on-interrupt) $(cmd_$(1))
|
||||
|
||||
###
|
||||
# if_changed - execute command if any prerequisite is newer than
|
||||
|
||||
@@ -388,7 +388,7 @@ ifeq ($(CONFIG_LTO_CLANG) $(CONFIG_MODVERSIONS),y y)
|
||||
cmd_update_lto_symversions = \
|
||||
rm -f $@.symversions \
|
||||
$(foreach n, $(filter-out FORCE,$^), \
|
||||
$(if $(wildcard $(n).symversions), \
|
||||
$(if $(shell test -s $(n).symversions && echo y), \
|
||||
; cat $(n).symversions >> $@.symversions))
|
||||
else
|
||||
cmd_update_lto_symversions = echo >/dev/null
|
||||
|
||||
@@ -52,6 +52,7 @@ KBUILD_CFLAGS += -Wno-format-zero-length
|
||||
KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast)
|
||||
KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare
|
||||
KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access)
|
||||
KBUILD_CFLAGS += $(call cc-disable-warning, cast-function-type-strict)
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
@@ -6,7 +6,7 @@ gcc-plugin-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) += latent_entropy_plugin.so
|
||||
gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) \
|
||||
+= -DLATENT_ENTROPY_PLUGIN
|
||||
ifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY
|
||||
DISABLE_LATENT_ENTROPY_PLUGIN += -fplugin-arg-latent_entropy_plugin-disable
|
||||
DISABLE_LATENT_ENTROPY_PLUGIN += -fplugin-arg-latent_entropy_plugin-disable -ULATENT_ENTROPY_PLUGIN
|
||||
endif
|
||||
export DISABLE_LATENT_ENTROPY_PLUGIN
|
||||
|
||||
|
||||
@@ -243,7 +243,9 @@ objtool_args = \
|
||||
$(if $(or $(CONFIG_GCOV_KERNEL),$(CONFIG_LTO_CLANG)), \
|
||||
--no-unreachable,) \
|
||||
$(if $(CONFIG_RETPOLINE), --retpoline,) \
|
||||
$(if $(CONFIG_RETHUNK), --rethunk,) \
|
||||
$(if $(CONFIG_X86_SMAP), --uaccess,) \
|
||||
$(if $(CONFIG_SLS), --sls,) \
|
||||
$(if $(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL), --mcount,)
|
||||
|
||||
# Useful for describing the dependency of composite objects
|
||||
|
||||
@@ -93,8 +93,7 @@ obj := $(KBUILD_EXTMOD)
|
||||
src := $(obj)
|
||||
|
||||
# Include the module's Makefile to find KBUILD_EXTRA_SYMBOLS
|
||||
include $(if $(wildcard $(KBUILD_EXTMOD)/Kbuild), \
|
||||
$(KBUILD_EXTMOD)/Kbuild, $(KBUILD_EXTMOD)/Makefile)
|
||||
include $(if $(wildcard $(src)/Kbuild), $(src)/Kbuild, $(src)/Makefile)
|
||||
|
||||
# modpost option for external modules
|
||||
MODPOST += -e
|
||||
|
||||
@@ -8,7 +8,6 @@ ubsan-cflags-$(CONFIG_UBSAN_LOCAL_BOUNDS) += -fsanitize=local-bounds
|
||||
ubsan-cflags-$(CONFIG_UBSAN_SHIFT) += -fsanitize=shift
|
||||
ubsan-cflags-$(CONFIG_UBSAN_DIV_ZERO) += -fsanitize=integer-divide-by-zero
|
||||
ubsan-cflags-$(CONFIG_UBSAN_UNREACHABLE) += -fsanitize=unreachable
|
||||
ubsan-cflags-$(CONFIG_UBSAN_OBJECT_SIZE) += -fsanitize=object-size
|
||||
ubsan-cflags-$(CONFIG_UBSAN_BOOL) += -fsanitize=bool
|
||||
ubsan-cflags-$(CONFIG_UBSAN_ENUM) += -fsanitize=enum
|
||||
ubsan-cflags-$(CONFIG_UBSAN_TRAP) += -fsanitize-undefined-trap-on-error
|
||||
|
||||
@@ -34,9 +34,6 @@ case "$KBUILD_VERBOSE" in
|
||||
;;
|
||||
esac
|
||||
|
||||
# We need access to CONFIG_ symbols
|
||||
. include/config/auto.conf
|
||||
|
||||
# Generate a new symbol list file
|
||||
$CONFIG_SHELL $srctree/scripts/gen_autoksyms.sh "$new_ksyms_file"
|
||||
|
||||
|
||||
@@ -77,12 +77,8 @@ fi
|
||||
|
||||
# To set GCC_PLUGINS
|
||||
if arg_contain -print-file-name=plugin "$@"; then
|
||||
plugin_dir=$(mktemp -d)
|
||||
|
||||
mkdir -p $plugin_dir/include
|
||||
touch $plugin_dir/include/plugin-version.h
|
||||
|
||||
echo $plugin_dir
|
||||
# Use $0 to find the in-tree dummy directory
|
||||
echo "$(dirname "$(readlink -f "$0")")/dummy-plugin-dir"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
@@ -23,6 +23,13 @@
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/engine.h>
|
||||
|
||||
/*
|
||||
* OpenSSL 3.0 deprecates the OpenSSL's ENGINE API.
|
||||
*
|
||||
* Remove this if/when that API is no longer used
|
||||
*/
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
#define PKEY_ID_PKCS7 2
|
||||
|
||||
static __attribute__((noreturn))
|
||||
|
||||
@@ -44,17 +44,6 @@
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
|
||||
READELF="${CROSS_COMPILE:-}readelf"
|
||||
ADDR2LINE="${CROSS_COMPILE:-}addr2line"
|
||||
SIZE="${CROSS_COMPILE:-}size"
|
||||
NM="${CROSS_COMPILE:-}nm"
|
||||
|
||||
command -v awk >/dev/null 2>&1 || die "awk isn't installed"
|
||||
command -v ${READELF} >/dev/null 2>&1 || die "readelf isn't installed"
|
||||
command -v ${ADDR2LINE} >/dev/null 2>&1 || die "addr2line isn't installed"
|
||||
command -v ${SIZE} >/dev/null 2>&1 || die "size isn't installed"
|
||||
command -v ${NM} >/dev/null 2>&1 || die "nm isn't installed"
|
||||
|
||||
usage() {
|
||||
echo "usage: faddr2line [--list] <object file> <func+offset> <func+offset>..." >&2
|
||||
exit 1
|
||||
@@ -69,6 +58,14 @@ die() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
READELF="${CROSS_COMPILE:-}readelf"
|
||||
ADDR2LINE="${CROSS_COMPILE:-}addr2line"
|
||||
AWK="awk"
|
||||
|
||||
command -v ${AWK} >/dev/null 2>&1 || die "${AWK} isn't installed"
|
||||
command -v ${READELF} >/dev/null 2>&1 || die "${READELF} isn't installed"
|
||||
command -v ${ADDR2LINE} >/dev/null 2>&1 || die "${ADDR2LINE} isn't installed"
|
||||
|
||||
# Try to figure out the source directory prefix so we can remove it from the
|
||||
# addr2line output. HACK ALERT: This assumes that start_kernel() is in
|
||||
# init/main.c! This only works for vmlinux. Otherwise it falls back to
|
||||
@@ -76,7 +73,8 @@ die() {
|
||||
find_dir_prefix() {
|
||||
local objfile=$1
|
||||
|
||||
local start_kernel_addr=$(${READELF} -sW $objfile | awk '$8 == "start_kernel" {printf "0x%s", $2}')
|
||||
local start_kernel_addr=$(${READELF} --symbols --wide $objfile | sed 's/\[.*\]//' |
|
||||
${AWK} '$8 == "start_kernel" {printf "0x%s", $2}')
|
||||
[[ -z $start_kernel_addr ]] && return
|
||||
|
||||
local file_line=$(${ADDR2LINE} -e $objfile $start_kernel_addr)
|
||||
@@ -97,86 +95,158 @@ __faddr2line() {
|
||||
local dir_prefix=$3
|
||||
local print_warnings=$4
|
||||
|
||||
local func=${func_addr%+*}
|
||||
local offset=${func_addr#*+}
|
||||
offset=${offset%/*}
|
||||
local size=
|
||||
[[ $func_addr =~ "/" ]] && size=${func_addr#*/}
|
||||
local sym_name=${func_addr%+*}
|
||||
local func_offset=${func_addr#*+}
|
||||
func_offset=${func_offset%/*}
|
||||
local user_size=
|
||||
local file_type
|
||||
local is_vmlinux=0
|
||||
[[ $func_addr =~ "/" ]] && user_size=${func_addr#*/}
|
||||
|
||||
if [[ -z $func ]] || [[ -z $offset ]] || [[ $func = $func_addr ]]; then
|
||||
if [[ -z $sym_name ]] || [[ -z $func_offset ]] || [[ $sym_name = $func_addr ]]; then
|
||||
warn "bad func+offset $func_addr"
|
||||
DONE=1
|
||||
return
|
||||
fi
|
||||
|
||||
# Go through each of the object's symbols which match the func name.
|
||||
# In rare cases there might be duplicates.
|
||||
file_end=$(${SIZE} -Ax $objfile | awk '$1 == ".text" {print $2}')
|
||||
while read symbol; do
|
||||
local fields=($symbol)
|
||||
local sym_base=0x${fields[0]}
|
||||
local sym_type=${fields[1]}
|
||||
local sym_end=${fields[3]}
|
||||
# vmlinux uses absolute addresses in the section table rather than
|
||||
# section offsets.
|
||||
local file_type=$(${READELF} --file-header $objfile |
|
||||
${AWK} '$1 == "Type:" { print $2; exit }')
|
||||
if [[ $file_type = "EXEC" ]] || [[ $file_type == "DYN" ]]; then
|
||||
is_vmlinux=1
|
||||
fi
|
||||
|
||||
# calculate the size
|
||||
local sym_size=$(($sym_end - $sym_base))
|
||||
if [[ -z $sym_size ]] || [[ $sym_size -le 0 ]]; then
|
||||
warn "bad symbol size: base: $sym_base end: $sym_end"
|
||||
# Go through each of the object's symbols which match the func name.
|
||||
# In rare cases there might be duplicates, in which case we print all
|
||||
# matches.
|
||||
while read line; do
|
||||
local fields=($line)
|
||||
local sym_addr=0x${fields[1]}
|
||||
local sym_elf_size=${fields[2]}
|
||||
local sym_sec=${fields[6]}
|
||||
local sec_size
|
||||
local sec_name
|
||||
|
||||
# Get the section size:
|
||||
sec_size=$(${READELF} --section-headers --wide $objfile |
|
||||
sed 's/\[ /\[/' |
|
||||
${AWK} -v sec=$sym_sec '$1 == "[" sec "]" { print "0x" $6; exit }')
|
||||
|
||||
if [[ -z $sec_size ]]; then
|
||||
warn "bad section size: section: $sym_sec"
|
||||
DONE=1
|
||||
return
|
||||
fi
|
||||
|
||||
# Get the section name:
|
||||
sec_name=$(${READELF} --section-headers --wide $objfile |
|
||||
sed 's/\[ /\[/' |
|
||||
${AWK} -v sec=$sym_sec '$1 == "[" sec "]" { print $2; exit }')
|
||||
|
||||
if [[ -z $sec_name ]]; then
|
||||
warn "bad section name: section: $sym_sec"
|
||||
DONE=1
|
||||
return
|
||||
fi
|
||||
|
||||
# Calculate the symbol size.
|
||||
#
|
||||
# Unfortunately we can't use the ELF size, because kallsyms
|
||||
# also includes the padding bytes in its size calculation. For
|
||||
# kallsyms, the size calculation is the distance between the
|
||||
# symbol and the next symbol in a sorted list.
|
||||
local sym_size
|
||||
local cur_sym_addr
|
||||
local found=0
|
||||
while read line; do
|
||||
local fields=($line)
|
||||
cur_sym_addr=0x${fields[1]}
|
||||
local cur_sym_elf_size=${fields[2]}
|
||||
local cur_sym_name=${fields[7]:-}
|
||||
|
||||
if [[ $cur_sym_addr = $sym_addr ]] &&
|
||||
[[ $cur_sym_elf_size = $sym_elf_size ]] &&
|
||||
[[ $cur_sym_name = $sym_name ]]; then
|
||||
found=1
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ $found = 1 ]]; then
|
||||
sym_size=$(($cur_sym_addr - $sym_addr))
|
||||
[[ $sym_size -lt $sym_elf_size ]] && continue;
|
||||
found=2
|
||||
break
|
||||
fi
|
||||
done < <(${READELF} --symbols --wide $objfile | sed 's/\[.*\]//' | ${AWK} -v sec=$sym_sec '$7 == sec' | sort --key=2)
|
||||
|
||||
if [[ $found = 0 ]]; then
|
||||
warn "can't find symbol: sym_name: $sym_name sym_sec: $sym_sec sym_addr: $sym_addr sym_elf_size: $sym_elf_size"
|
||||
DONE=1
|
||||
return
|
||||
fi
|
||||
|
||||
# If nothing was found after the symbol, assume it's the last
|
||||
# symbol in the section.
|
||||
[[ $found = 1 ]] && sym_size=$(($sec_size - $sym_addr))
|
||||
|
||||
if [[ -z $sym_size ]] || [[ $sym_size -le 0 ]]; then
|
||||
warn "bad symbol size: sym_addr: $sym_addr cur_sym_addr: $cur_sym_addr"
|
||||
DONE=1
|
||||
return
|
||||
fi
|
||||
|
||||
sym_size=0x$(printf %x $sym_size)
|
||||
|
||||
# calculate the address
|
||||
local addr=$(($sym_base + $offset))
|
||||
# Calculate the address from user-supplied offset:
|
||||
local addr=$(($sym_addr + $func_offset))
|
||||
if [[ -z $addr ]] || [[ $addr = 0 ]]; then
|
||||
warn "bad address: $sym_base + $offset"
|
||||
warn "bad address: $sym_addr + $func_offset"
|
||||
DONE=1
|
||||
return
|
||||
fi
|
||||
addr=0x$(printf %x $addr)
|
||||
|
||||
# weed out non-function symbols
|
||||
if [[ $sym_type != t ]] && [[ $sym_type != T ]]; then
|
||||
# If the user provided a size, make sure it matches the symbol's size:
|
||||
if [[ -n $user_size ]] && [[ $user_size -ne $sym_size ]]; then
|
||||
[[ $print_warnings = 1 ]] &&
|
||||
echo "skipping $func address at $addr due to non-function symbol of type '$sym_type'"
|
||||
continue
|
||||
fi
|
||||
|
||||
# if the user provided a size, make sure it matches the symbol's size
|
||||
if [[ -n $size ]] && [[ $size -ne $sym_size ]]; then
|
||||
[[ $print_warnings = 1 ]] &&
|
||||
echo "skipping $func address at $addr due to size mismatch ($size != $sym_size)"
|
||||
echo "skipping $sym_name address at $addr due to size mismatch ($user_size != $sym_size)"
|
||||
continue;
|
||||
fi
|
||||
|
||||
# make sure the provided offset is within the symbol's range
|
||||
if [[ $offset -gt $sym_size ]]; then
|
||||
# Make sure the provided offset is within the symbol's range:
|
||||
if [[ $func_offset -gt $sym_size ]]; then
|
||||
[[ $print_warnings = 1 ]] &&
|
||||
echo "skipping $func address at $addr due to size mismatch ($offset > $sym_size)"
|
||||
echo "skipping $sym_name address at $addr due to size mismatch ($func_offset > $sym_size)"
|
||||
continue
|
||||
fi
|
||||
|
||||
# separate multiple entries with a blank line
|
||||
# In case of duplicates or multiple addresses specified on the
|
||||
# cmdline, separate multiple entries with a blank line:
|
||||
[[ $FIRST = 0 ]] && echo
|
||||
FIRST=0
|
||||
|
||||
# pass real address to addr2line
|
||||
echo "$func+$offset/$sym_size:"
|
||||
local file_lines=$(${ADDR2LINE} -fpie $objfile $addr | sed "s; $dir_prefix\(\./\)*; ;")
|
||||
[[ -z $file_lines ]] && return
|
||||
echo "$sym_name+$func_offset/$sym_size:"
|
||||
|
||||
# Pass section address to addr2line and strip absolute paths
|
||||
# from the output:
|
||||
local args="--functions --pretty-print --inlines --exe=$objfile"
|
||||
[[ $is_vmlinux = 0 ]] && args="$args --section=$sec_name"
|
||||
local output=$(${ADDR2LINE} $args $addr | sed "s; $dir_prefix\(\./\)*; ;")
|
||||
[[ -z $output ]] && continue
|
||||
|
||||
# Default output (non --list):
|
||||
if [[ $LIST = 0 ]]; then
|
||||
echo "$file_lines" | while read -r line
|
||||
echo "$output" | while read -r line
|
||||
do
|
||||
echo $line
|
||||
done
|
||||
DONE=1;
|
||||
return
|
||||
continue
|
||||
fi
|
||||
|
||||
# show each line with context
|
||||
echo "$file_lines" | while read -r line
|
||||
# For --list, show each line with its corresponding source code:
|
||||
echo "$output" | while read -r line
|
||||
do
|
||||
echo
|
||||
echo $line
|
||||
@@ -184,12 +254,12 @@ __faddr2line() {
|
||||
n1=$[$n-5]
|
||||
n2=$[$n+5]
|
||||
f=$(echo $line | sed 's/.*at \(.\+\):.*/\1/g')
|
||||
awk 'NR>=strtonum("'$n1'") && NR<=strtonum("'$n2'") { if (NR=='$n') printf(">%d<", NR); else printf(" %d ", NR); printf("\t%s\n", $0)}' $f
|
||||
${AWK} 'NR>=strtonum("'$n1'") && NR<=strtonum("'$n2'") { if (NR=='$n') printf(">%d<", NR); else printf(" %d ", NR); printf("\t%s\n", $0)}' $f
|
||||
done
|
||||
|
||||
DONE=1
|
||||
|
||||
done < <(${NM} -n $objfile | awk -v fn=$func -v end=$file_end '$3 == fn { found=1; line=$0; start=$1; next } found == 1 { found=0; print line, "0x"$1 } END {if (found == 1) print line, end; }')
|
||||
done < <(${READELF} --symbols --wide $objfile | sed 's/\[.*\]//' | ${AWK} -v fn=$sym_name '$4 == "FUNC" && $8 == fn')
|
||||
}
|
||||
|
||||
[[ $# -lt 2 ]] && usage
|
||||
|
||||
@@ -86,25 +86,31 @@ static struct plugin_info latent_entropy_plugin_info = {
|
||||
.help = "disable\tturn off latent entropy instrumentation\n",
|
||||
};
|
||||
|
||||
static unsigned HOST_WIDE_INT seed;
|
||||
/*
|
||||
* get_random_seed() (this is a GCC function) generates the seed.
|
||||
* This is a simple random generator without any cryptographic security because
|
||||
* the entropy doesn't come from here.
|
||||
*/
|
||||
static unsigned HOST_WIDE_INT deterministic_seed;
|
||||
static unsigned HOST_WIDE_INT rnd_buf[32];
|
||||
static size_t rnd_idx = ARRAY_SIZE(rnd_buf);
|
||||
static int urandom_fd = -1;
|
||||
|
||||
static unsigned HOST_WIDE_INT get_random_const(void)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned HOST_WIDE_INT ret = 0;
|
||||
|
||||
for (i = 0; i < 8 * sizeof(ret); i++) {
|
||||
ret = (ret << 1) | (seed & 1);
|
||||
seed >>= 1;
|
||||
if (ret & 1)
|
||||
seed ^= 0xD800000000000000ULL;
|
||||
if (deterministic_seed) {
|
||||
unsigned HOST_WIDE_INT w = deterministic_seed;
|
||||
w ^= w << 13;
|
||||
w ^= w >> 7;
|
||||
w ^= w << 17;
|
||||
deterministic_seed = w;
|
||||
return deterministic_seed;
|
||||
}
|
||||
|
||||
return ret;
|
||||
if (urandom_fd < 0) {
|
||||
urandom_fd = open("/dev/urandom", O_RDONLY);
|
||||
gcc_assert(urandom_fd >= 0);
|
||||
}
|
||||
if (rnd_idx >= ARRAY_SIZE(rnd_buf)) {
|
||||
gcc_assert(read(urandom_fd, rnd_buf, sizeof(rnd_buf)) == sizeof(rnd_buf));
|
||||
rnd_idx = 0;
|
||||
}
|
||||
return rnd_buf[rnd_idx++];
|
||||
}
|
||||
|
||||
static tree tree_get_random_const(tree type)
|
||||
@@ -549,8 +555,6 @@ static void latent_entropy_start_unit(void *gcc_data __unused,
|
||||
tree type, id;
|
||||
int quals;
|
||||
|
||||
seed = get_random_seed(false);
|
||||
|
||||
if (in_lto_p)
|
||||
return;
|
||||
|
||||
@@ -585,6 +589,12 @@ __visible int plugin_init(struct plugin_name_args *plugin_info,
|
||||
const struct plugin_argument * const argv = plugin_info->argv;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Call get_random_seed() with noinit=true, so that this returns
|
||||
* 0 in the case where no seed has been passed via -frandom-seed.
|
||||
*/
|
||||
deterministic_seed = get_random_seed(true);
|
||||
|
||||
static const struct ggc_root_tab gt_ggc_r_gt_latent_entropy[] = {
|
||||
{
|
||||
.base = &latent_entropy_decl,
|
||||
|
||||
@@ -24,9 +24,9 @@ class LxConfigDump(gdb.Command):
|
||||
filename = arg
|
||||
|
||||
try:
|
||||
py_config_ptr = gdb.parse_and_eval("kernel_config_data + 8")
|
||||
py_config_size = gdb.parse_and_eval(
|
||||
"sizeof(kernel_config_data) - 1 - 8 * 2")
|
||||
py_config_ptr = gdb.parse_and_eval("&kernel_config_data")
|
||||
py_config_ptr_end = gdb.parse_and_eval("&kernel_config_data_end")
|
||||
py_config_size = py_config_ptr_end - py_config_ptr
|
||||
except gdb.error as e:
|
||||
raise gdb.GdbError("Can't find config, enable CONFIG_IKCONFIG?")
|
||||
|
||||
|
||||
@@ -1215,6 +1215,13 @@ sub dump_struct($$) {
|
||||
$members =~ s/\s*CRYPTO_MINALIGN_ATTR/ /gos;
|
||||
$members =~ s/\s*____cacheline_aligned_in_smp/ /gos;
|
||||
$members =~ s/\s*____cacheline_aligned/ /gos;
|
||||
# unwrap struct_group():
|
||||
# - first eat non-declaration parameters and rewrite for final match
|
||||
# - then remove macro, outer parens, and trailing semicolon
|
||||
$members =~ s/\bstruct_group\s*\(([^,]*,)/STRUCT_GROUP(/gos;
|
||||
$members =~ s/\bstruct_group_(attr|tagged)\s*\(([^,]*,){2}/STRUCT_GROUP(/gos;
|
||||
$members =~ s/\b__struct_group\s*\(([^,]*,){3}/STRUCT_GROUP(/gos;
|
||||
$members =~ s/\bSTRUCT_GROUP(\(((?:(?>[^)(]+)|(?1))*)\))[^;]*;/$2/gos;
|
||||
|
||||
# replace DECLARE_BITMAP
|
||||
$members =~ s/__ETHTOOL_DECLARE_LINK_MODE_MASK\s*\(([^\)]+)\)/DECLARE_BITMAP($1, __ETHTOOL_LINK_MODE_MASK_NBITS)/gos;
|
||||
|
||||
@@ -129,6 +129,9 @@ objtool_link()
|
||||
objtoolcmd="check"
|
||||
fi
|
||||
objtoolopt="${objtoolopt} --vmlinux"
|
||||
if [ -n "${CONFIG_CPU_UNRET_ENTRY}" ]; then
|
||||
objtoolopt="${objtoolopt} --unret"
|
||||
fi
|
||||
if [ -z "${CONFIG_FRAME_POINTER}" ]; then
|
||||
objtoolopt="${objtoolopt} --no-fp"
|
||||
fi
|
||||
@@ -141,6 +144,9 @@ objtool_link()
|
||||
if [ -n "${CONFIG_X86_SMAP}" ]; then
|
||||
objtoolopt="${objtoolopt} --uaccess"
|
||||
fi
|
||||
if [ -n "${CONFIG_SLS}" ]; then
|
||||
objtoolopt="${objtoolopt} --sls"
|
||||
fi
|
||||
info OBJTOOL ${1}
|
||||
tools/objtool/objtool ${objtoolcmd} ${objtoolopt} ${1}
|
||||
fi
|
||||
@@ -228,7 +234,7 @@ gen_btf()
|
||||
vmlinux_link ${1}
|
||||
|
||||
info "BTF" ${2}
|
||||
LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1}
|
||||
LLVM_OBJCOPY="${OBJCOPY}" ${PAHOLE} -J ${PAHOLE_FLAGS} ${1}
|
||||
|
||||
# Create ${2} which contains just .BTF section but no symbols. Add
|
||||
# SHF_ALLOC because .BTF will be part of the vmlinux image. --strip-all
|
||||
|
||||
@@ -41,4 +41,4 @@
|
||||
# so we just ignore them to let readprofile continue to work.
|
||||
# (At least sparc64 has __crc_ in the middle).
|
||||
|
||||
$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( \.L\)' > $2
|
||||
$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( \.L\)\|\( L0\)' > $2
|
||||
|
||||
@@ -1115,7 +1115,7 @@ static const struct sectioncheck sectioncheck[] = {
|
||||
},
|
||||
/* Do not export init/exit functions or data */
|
||||
{
|
||||
.fromsec = { "__ksymtab*", NULL },
|
||||
.fromsec = { "___ksymtab*", NULL },
|
||||
.bad_tosec = { INIT_SECTIONS, EXIT_SECTIONS, NULL },
|
||||
.mismatch = EXPORT_TO_INIT_EXIT,
|
||||
.symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL },
|
||||
@@ -1267,7 +1267,8 @@ static int secref_whitelist(const struct sectioncheck *mismatch,
|
||||
|
||||
static inline int is_arm_mapping_symbol(const char *str)
|
||||
{
|
||||
return str[0] == '$' && strchr("axtd", str[1])
|
||||
return str[0] == '$' &&
|
||||
(str[1] == 'a' || str[1] == 'd' || str[1] == 't' || str[1] == 'x')
|
||||
&& (str[2] == '\0' || str[2] == '.');
|
||||
}
|
||||
|
||||
@@ -1978,7 +1979,7 @@ static char *remove_dot(char *s)
|
||||
|
||||
if (n && s[n]) {
|
||||
size_t m = strspn(s + n + 1, "0123456789");
|
||||
if (m && (s[n + m] == '.' || s[n + m] == 0))
|
||||
if (m && (s[n + m + 1] == '.' || s[n + m + 1] == 0))
|
||||
s[n] = 0;
|
||||
|
||||
/* strip trailing .lto */
|
||||
|
||||
@@ -29,6 +29,8 @@ SECTIONS {
|
||||
|
||||
.init_array 0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) }
|
||||
|
||||
.altinstructions 0 : ALIGN(8) { KEEP(*(.altinstructions)) }
|
||||
__bug_table 0 : ALIGN(8) { KEEP(*(__bug_table)) }
|
||||
__jump_table 0 : ALIGN(8) { KEEP(*(__jump_table)) }
|
||||
|
||||
__patchable_function_entries : { *(__patchable_function_entries) }
|
||||
|
||||
@@ -85,10 +85,10 @@ $S
|
||||
mkdir -p %{buildroot}/boot
|
||||
%ifarch ia64
|
||||
mkdir -p %{buildroot}/boot/efi
|
||||
cp \$($MAKE image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE
|
||||
cp \$($MAKE -s image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE
|
||||
ln -s efi/vmlinuz-$KERNELRELEASE %{buildroot}/boot/
|
||||
%else
|
||||
cp \$($MAKE image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE
|
||||
cp \$($MAKE -s image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE
|
||||
%endif
|
||||
$M $MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install
|
||||
$MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
|
||||
|
||||
21
scripts/pahole-flags.sh
Executable file
21
scripts/pahole-flags.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
extra_paholeopt=
|
||||
|
||||
if ! [ -x "$(command -v ${PAHOLE})" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
pahole_ver=$(${PAHOLE} --version | sed -E 's/v([0-9]+)\.([0-9]+)/\1\2/')
|
||||
|
||||
if [ "${pahole_ver}" -ge "118" ] && [ "${pahole_ver}" -le "121" ]; then
|
||||
# pahole 1.18 through 1.21 can't handle zero-sized per-CPU vars
|
||||
extra_paholeopt="${extra_paholeopt} --skip_encoding_btf_vars"
|
||||
fi
|
||||
|
||||
if [ "${pahole_ver}" -ge "124" ]; then
|
||||
extra_paholeopt="${extra_paholeopt} --skip_encoding_btf_enum64"
|
||||
fi
|
||||
|
||||
echo ${extra_paholeopt}
|
||||
@@ -78,7 +78,7 @@ cd /etc/selinux/dummy/contexts/files
|
||||
$SF -F file_contexts /
|
||||
|
||||
mounts=`cat /proc/$$/mounts | \
|
||||
egrep "ext[234]|jfs|xfs|reiserfs|jffs2|gfs2|btrfs|f2fs|ocfs2" | \
|
||||
grep -E "ext[234]|jfs|xfs|reiserfs|jffs2|gfs2|btrfs|f2fs|ocfs2" | \
|
||||
awk '{ print $2 '}`
|
||||
$SF -F file_contexts $mounts
|
||||
|
||||
|
||||
@@ -29,6 +29,13 @@
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/engine.h>
|
||||
|
||||
/*
|
||||
* OpenSSL 3.0 deprecates the OpenSSL's ENGINE API.
|
||||
*
|
||||
* Remove this if/when that API is no longer used
|
||||
*/
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
/*
|
||||
* Use CMS if we have openssl-1.0.0 or newer available - otherwise we have to
|
||||
* assume that it's not available and its header file is missing and that we
|
||||
|
||||
Reference in New Issue
Block a user