No description
Find a file
Andrii Nakryiko 179a2a8a7b libbpf: Fix realloc API handling in zero-sized edge cases
[ Upstream commit 8a0260dbf6 ]

realloc() and reallocarray() can either return NULL or a special
non-NULL pointer, if their size argument is zero. This requires a bit
more care to handle NULL-as-valid-result situation differently from
NULL-as-error case. This has caused real issues before ([0]), and just
recently bit again in production when performing bpf_program__attach_usdt().

This patch fixes 4 places that do or potentially could suffer from this
mishandling of NULL, including the reported USDT-related one.

There are many other places where realloc()/reallocarray() is used and
NULL is always treated as an error value, but all those have guarantees
that their size is always non-zero, so those spot don't need any extra
handling.

  [0] d08ab82f59 ("libbpf: Fix double-free when linker processes empty sections")

Fixes: 999783c8bb ("libbpf: Wire up spec management and other arch-independent USDT logic")
Fixes: b63b3c490e ("libbpf: Add bpf_program__set_insns function")
Fixes: 697f104db8 ("libbpf: Support custom SEC() handlers")
Fixes: b126882672 ("libbpf: Change the order of data and text relocations.")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20230711024150.1566433-1-andrii@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-09-13 09:48:00 +02:00
arch s390/paes: fix PKEY_TYPE_EP11_AES handling for secure keyblobs 2023-09-13 09:47:59 +02:00
block blk-crypto: dynamically allocate fallback profile 2023-08-23 17:32:53 +02:00
certs
crypto crypto: jitter - correct health test during initialization 2023-07-19 16:36:19 +02:00
Documentation dt-bindings: sc16is7xx: Add property to change GPIO function 2023-09-06 21:25:32 +01:00
drivers cpufreq: tegra194: remove opp table in exit hook 2023-09-13 09:47:59 +02:00
fs vfs, security: Fix automount superblock LSM init problem, preventing NFS sb sharing 2023-09-13 09:47:57 +02:00
include vfs, security: Fix automount superblock LSM init problem, preventing NFS sb sharing 2023-09-13 09:47:57 +02:00
init sched/psi: Select KERNFS as needed 2023-09-13 09:47:58 +02:00
io_uring io_uring: correct check for O_TMPFILE 2023-08-16 18:32:19 +02:00
ipc
kernel sched/rt: Fix sysctl_sched_rr_timeslice intial value 2023-09-13 09:47:58 +02:00
lib sbitmap: fix batching wakeup 2023-09-13 09:47:55 +02:00
LICENSES
mm tmpfs: verify {g,u}id mount options correctly 2023-09-13 09:47:57 +02:00
net net: Avoid address overwrite in kernel_connect 2023-09-13 09:47:56 +02:00
rust rust: macros: vtable: fix HAS_* redefinition (gen_const_name) 2023-08-23 17:32:36 +02:00
samples samples: ftrace: Save required argument registers in sample trampolines 2023-07-23 13:54:09 +02:00
scripts kbuild: rust: avoid creating temporary files 2023-07-27 08:57:06 +02:00
security vfs, security: Fix automount superblock LSM init problem, preventing NFS sb sharing 2023-09-13 09:47:57 +02:00
sound ASoC: cs35l56: Add an ACPI match table 2023-09-13 09:47:55 +02:00
tools libbpf: Fix realloc API handling in zero-sized edge cases 2023-09-13 09:48:00 +02:00
usr
virt KVM: Grab a reference to KVM for VM and vCPU stats file descriptors 2023-08-03 10:26:01 +02:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap mailmap: add entries for Ben Dooks 2023-06-19 13:19:35 -07:00
.rustfmt.toml
COPYING
CREDITS MAINTAINERS: sctp: move Neil to CREDITS 2023-05-12 08:51:32 +01:00
Kbuild
Kconfig
MAINTAINERS Networking fixes for 6.4-rc8, including fixes from ipsec, bpf, 2023-06-22 17:59:51 -07:00
Makefile Linux 6.4.15 2023-09-06 21:25:33 +01:00
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.