Merge 5.10.106 into android12-5.10-lts
Changes in 5.10.106 ARM: boot: dts: bcm2711: Fix HVS register range clk: qcom: gdsc: Add support to update GDSC transition delay HID: vivaldi: fix sysfs attributes leak arm64: dts: armada-3720-turris-mox: Add missing ethernet0 alias tipc: fix kernel panic when enabling bearer mISDN: Remove obsolete PIPELINE_DEBUG debugging information mISDN: Fix memory leak in dsp_pipeline_build() virtio-blk: Don't use MAX_DISCARD_SEGMENTS if max_discard_seg is zero isdn: hfcpci: check the return value of dma_set_mask() in setup_hw() net: qlogic: check the return value of dma_alloc_coherent() in qed_vf_hw_prepare() esp: Fix BEET mode inter address family tunneling on GSO qed: return status of qed_iov_get_link drm/sun4i: mixer: Fix P010 and P210 format numbers net: dsa: mt7530: fix incorrect test in mt753x_phylink_validate() ARM: dts: aspeed: Fix AST2600 quad spi group i40e: stop disabling VFs due to PF error responses ice: stop disabling VFs due to PF error responses ice: Align macro names to the specification ice: Remove unnecessary checker loop ice: Rename a couple of variables ice: Fix curr_link_speed advertised speed ethernet: Fix error handling in xemaclite_of_probe tipc: fix incorrect order of state message data sanity check net: ethernet: ti: cpts: Handle error for clk_enable net: ethernet: lpc_eth: Handle error for clk_enable ax25: Fix NULL pointer dereference in ax25_kill_by_device net/mlx5: Fix size field in bufferx_reg struct net/mlx5: Fix a race on command flush flow net/mlx5e: Lag, Only handle events from highest priority multipath entry NFC: port100: fix use-after-free in port100_send_complete selftests: pmtu.sh: Kill tcpdump processes launched by subshell. gpio: ts4900: Do not set DAT and OE together gianfar: ethtool: Fix refcount leak in gfar_get_ts_info net: phy: DP83822: clear MISR2 register to disable interrupts sctp: fix kernel-infoleak for SCTP sockets net: bcmgenet: Don't claim WOL when its not available selftests/bpf: Add test for bpf_timer overwriting crash spi: rockchip: Fix error in getting num-cs property spi: rockchip: terminate dma transmission when slave abort net-sysfs: add check for netdevice being present to speed_show hwmon: (pmbus) Clear pmbus fault/warning bits after read gpio: Return EPROBE_DEFER if gc->to_irq is NULL Revert "xen-netback: remove 'hotplug-status' once it has served its purpose" Revert "xen-netback: Check for hotplug-status existence before watching" ipv6: prevent a possible race condition with lifetimes tracing: Ensure trace buffer is at least 4096 bytes large selftest/vm: fix map_fixed_noreplace test failure selftests/memfd: clean up mapping in mfd_fail_write ARM: Spectre-BHB: provide empty stub for non-config fuse: fix pipe buffer lifetime for direct_io staging: rtl8723bs: Fix access-point mode deadlock staging: gdm724x: fix use after free in gdm_lte_rx() net: macb: Fix lost RX packet wakeup race in NAPI receive mmc: meson: Fix usage of meson_mmc_post_req() riscv: Fix auipc+jalr relocation range checks arm64: dts: marvell: armada-37xx: Remap IO space to bus address 0x0 virtio: unexport virtio_finalize_features virtio: acknowledge all features before access watch_queue, pipe: Free watchqueue state after clearing pipe ring watch_queue: Fix to release page in ->release() watch_queue: Fix to always request a pow-of-2 pipe ring size watch_queue: Fix the alloc bitmap size to reflect notes allocated watch_queue: Free the alloc bitmap when the watch_queue is torn down watch_queue: Fix lack of barrier/sync/lock between post and read watch_queue: Make comment about setting ->defunct more accurate x86/boot: Fix memremap of setup_indirect structures x86/boot: Add setup_indirect support in early_memremap_is_setup_data() x86/traps: Mark do_int3() NOKPROBE_SYMBOL ext4: add check to prevent attempting to resize an fs with sparse_super2 ARM: fix Thumb2 regression with Spectre BHB watch_queue: Fix filter limit check Linux 5.10.106 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: Ic7943bdf8c771bff4a95fcf0585ec9c24057cb5b
This commit is contained in:
32
tools/testing/selftests/bpf/prog_tests/timer_crash.c
Normal file
32
tools/testing/selftests/bpf/prog_tests/timer_crash.c
Normal file
@@ -0,0 +1,32 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <test_progs.h>
|
||||
#include "timer_crash.skel.h"
|
||||
|
||||
enum {
|
||||
MODE_ARRAY,
|
||||
MODE_HASH,
|
||||
};
|
||||
|
||||
static void test_timer_crash_mode(int mode)
|
||||
{
|
||||
struct timer_crash *skel;
|
||||
|
||||
skel = timer_crash__open_and_load();
|
||||
if (!ASSERT_OK_PTR(skel, "timer_crash__open_and_load"))
|
||||
return;
|
||||
skel->bss->pid = getpid();
|
||||
skel->bss->crash_map = mode;
|
||||
if (!ASSERT_OK(timer_crash__attach(skel), "timer_crash__attach"))
|
||||
goto end;
|
||||
usleep(1);
|
||||
end:
|
||||
timer_crash__destroy(skel);
|
||||
}
|
||||
|
||||
void test_timer_crash(void)
|
||||
{
|
||||
if (test__start_subtest("array"))
|
||||
test_timer_crash_mode(MODE_ARRAY);
|
||||
if (test__start_subtest("hash"))
|
||||
test_timer_crash_mode(MODE_HASH);
|
||||
}
|
54
tools/testing/selftests/bpf/progs/timer_crash.c
Normal file
54
tools/testing/selftests/bpf/progs/timer_crash.c
Normal file
@@ -0,0 +1,54 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
|
||||
struct map_elem {
|
||||
struct bpf_timer timer;
|
||||
struct bpf_spin_lock lock;
|
||||
};
|
||||
|
||||
struct {
|
||||
__uint(type, BPF_MAP_TYPE_ARRAY);
|
||||
__uint(max_entries, 1);
|
||||
__type(key, int);
|
||||
__type(value, struct map_elem);
|
||||
} amap SEC(".maps");
|
||||
|
||||
struct {
|
||||
__uint(type, BPF_MAP_TYPE_HASH);
|
||||
__uint(max_entries, 1);
|
||||
__type(key, int);
|
||||
__type(value, struct map_elem);
|
||||
} hmap SEC(".maps");
|
||||
|
||||
int pid = 0;
|
||||
int crash_map = 0; /* 0 for amap, 1 for hmap */
|
||||
|
||||
SEC("fentry/do_nanosleep")
|
||||
int sys_enter(void *ctx)
|
||||
{
|
||||
struct map_elem *e, value = {};
|
||||
void *map = crash_map ? (void *)&hmap : (void *)&amap;
|
||||
|
||||
if (bpf_get_current_task_btf()->tgid != pid)
|
||||
return 0;
|
||||
|
||||
*(void **)&value = (void *)0xdeadcaf3;
|
||||
|
||||
bpf_map_update_elem(map, &(int){0}, &value, 0);
|
||||
/* For array map, doing bpf_map_update_elem will do a
|
||||
* check_and_free_timer_in_array, which will trigger the crash if timer
|
||||
* pointer was overwritten, for hmap we need to use bpf_timer_cancel.
|
||||
*/
|
||||
if (crash_map == 1) {
|
||||
e = bpf_map_lookup_elem(map, &(int){0});
|
||||
if (!e)
|
||||
return 0;
|
||||
bpf_timer_cancel(&e->timer);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
@@ -455,6 +455,7 @@ static void mfd_fail_write(int fd)
|
||||
printf("mmap()+mprotect() didn't fail as expected\n");
|
||||
abort();
|
||||
}
|
||||
munmap(p, mfd_def_size);
|
||||
}
|
||||
|
||||
/* verify PUNCH_HOLE fails */
|
||||
|
@@ -799,7 +799,6 @@ setup_ovs_bridge() {
|
||||
setup() {
|
||||
[ "$(id -u)" -ne 0 ] && echo " need to run as root" && return $ksft_skip
|
||||
|
||||
cleanup
|
||||
for arg do
|
||||
eval setup_${arg} || { echo " ${arg} not supported"; return 1; }
|
||||
done
|
||||
@@ -810,7 +809,7 @@ trace() {
|
||||
|
||||
for arg do
|
||||
[ "${ns_cmd}" = "" ] && ns_cmd="${arg}" && continue
|
||||
${ns_cmd} tcpdump -s 0 -i "${arg}" -w "${name}_${arg}.pcap" 2> /dev/null &
|
||||
${ns_cmd} tcpdump --immediate-mode -s 0 -i "${arg}" -w "${name}_${arg}.pcap" 2> /dev/null &
|
||||
tcpdump_pids="${tcpdump_pids} $!"
|
||||
ns_cmd=
|
||||
done
|
||||
@@ -1636,6 +1635,10 @@ run_test() {
|
||||
|
||||
unset IFS
|
||||
|
||||
# Since cleanup() relies on variables modified by this subshell, it
|
||||
# has to run in this context.
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ "$VERBOSE" = "1" ]; then
|
||||
printf "\n##########################################################################\n\n"
|
||||
fi
|
||||
|
@@ -17,9 +17,6 @@
|
||||
#define MAP_FIXED_NOREPLACE 0x100000
|
||||
#endif
|
||||
|
||||
#define BASE_ADDRESS (256ul * 1024 * 1024)
|
||||
|
||||
|
||||
static void dump_maps(void)
|
||||
{
|
||||
char cmd[32];
|
||||
@@ -28,18 +25,46 @@ static void dump_maps(void)
|
||||
system(cmd);
|
||||
}
|
||||
|
||||
static unsigned long find_base_addr(unsigned long size)
|
||||
{
|
||||
void *addr;
|
||||
unsigned long flags;
|
||||
|
||||
flags = MAP_PRIVATE | MAP_ANONYMOUS;
|
||||
addr = mmap(NULL, size, PROT_NONE, flags, -1, 0);
|
||||
if (addr == MAP_FAILED) {
|
||||
printf("Error: couldn't map the space we need for the test\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (munmap(addr, size) != 0) {
|
||||
printf("Error: couldn't map the space we need for the test\n");
|
||||
return 0;
|
||||
}
|
||||
return (unsigned long)addr;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
unsigned long base_addr;
|
||||
unsigned long flags, addr, size, page_size;
|
||||
char *p;
|
||||
|
||||
page_size = sysconf(_SC_PAGE_SIZE);
|
||||
|
||||
//let's find a base addr that is free before we start the tests
|
||||
size = 5 * page_size;
|
||||
base_addr = find_base_addr(size);
|
||||
if (!base_addr) {
|
||||
printf("Error: couldn't map the space we need for the test\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
flags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED_NOREPLACE;
|
||||
|
||||
// Check we can map all the areas we need below
|
||||
errno = 0;
|
||||
addr = BASE_ADDRESS;
|
||||
addr = base_addr;
|
||||
size = 5 * page_size;
|
||||
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
||||
|
||||
@@ -60,7 +85,7 @@ int main(void)
|
||||
printf("unmap() successful\n");
|
||||
|
||||
errno = 0;
|
||||
addr = BASE_ADDRESS + page_size;
|
||||
addr = base_addr + page_size;
|
||||
size = 3 * page_size;
|
||||
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
||||
printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
|
||||
@@ -80,7 +105,7 @@ int main(void)
|
||||
* +4 | free | new
|
||||
*/
|
||||
errno = 0;
|
||||
addr = BASE_ADDRESS;
|
||||
addr = base_addr;
|
||||
size = 5 * page_size;
|
||||
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
||||
printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
|
||||
@@ -101,7 +126,7 @@ int main(void)
|
||||
* +4 | free |
|
||||
*/
|
||||
errno = 0;
|
||||
addr = BASE_ADDRESS + (2 * page_size);
|
||||
addr = base_addr + (2 * page_size);
|
||||
size = page_size;
|
||||
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
||||
printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
|
||||
@@ -121,7 +146,7 @@ int main(void)
|
||||
* +4 | free | new
|
||||
*/
|
||||
errno = 0;
|
||||
addr = BASE_ADDRESS + (3 * page_size);
|
||||
addr = base_addr + (3 * page_size);
|
||||
size = 2 * page_size;
|
||||
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
||||
printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
|
||||
@@ -141,7 +166,7 @@ int main(void)
|
||||
* +4 | free |
|
||||
*/
|
||||
errno = 0;
|
||||
addr = BASE_ADDRESS;
|
||||
addr = base_addr;
|
||||
size = 2 * page_size;
|
||||
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
||||
printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
|
||||
@@ -161,7 +186,7 @@ int main(void)
|
||||
* +4 | free |
|
||||
*/
|
||||
errno = 0;
|
||||
addr = BASE_ADDRESS;
|
||||
addr = base_addr;
|
||||
size = page_size;
|
||||
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
||||
printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
|
||||
@@ -181,7 +206,7 @@ int main(void)
|
||||
* +4 | free | new
|
||||
*/
|
||||
errno = 0;
|
||||
addr = BASE_ADDRESS + (4 * page_size);
|
||||
addr = base_addr + (4 * page_size);
|
||||
size = page_size;
|
||||
p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
|
||||
printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
|
||||
@@ -192,7 +217,7 @@ int main(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
addr = BASE_ADDRESS;
|
||||
addr = base_addr;
|
||||
size = 5 * page_size;
|
||||
if (munmap((void *)addr, size) != 0) {
|
||||
dump_maps();
|
||||
|
Reference in New Issue
Block a user