blatt A1
Go to file
Steven Rostedt 631b1e09e2 tracing: Have process_string() also allow arrays
commit afc6717628f959941d7b33728570568b4af1c4b8 upstream.

In order to catch a common bug where a TRACE_EVENT() TP_fast_assign()
assigns an address of an allocated string to the ring buffer and then
references it in TP_printk(), which can be executed hours later when the
string is free, the function test_event_printk() runs on all events as
they are registered to make sure there's no unwanted dereferencing.

It calls process_string() to handle cases in TP_printk() format that has
"%s". It returns whether or not the string is safe. But it can have some
false positives.

For instance, xe_bo_move() has:

 TP_printk("move_lacks_source:%s, migrate object %p [size %zu] from %s to %s device_id:%s",
            __entry->move_lacks_source ? "yes" : "no", __entry->bo, __entry->size,
            xe_mem_type_to_name[__entry->old_placement],
            xe_mem_type_to_name[__entry->new_placement], __get_str(device_id))

Where the "%s" references into xe_mem_type_to_name[]. This is an array of
pointers that should be safe for the event to access. Instead of flagging
this as a bad reference, if a reference points to an array, where the
record field is the index, consider it safe.

Link: https://lore.kernel.org/all/9dee19b6185d325d0e6fa5f7cbba81d007d99166.camel@sapience.com/

Cc: stable@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://lore.kernel.org/20241231000646.324fb5f7@gandalf.local.home
Fixes: 65a25d9f7ac02 ("tracing: Add "%s" check in test_event_printk()")
Reported-by: Genes Lists <lists@sapience.com>
Tested-by: Gene C <arch@sapience.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-09 13:29:56 +01:00
arch x86/hyperv: Fix hv tsc page based sched_clock for hibernation 2025-01-09 13:29:56 +01:00
block blk-mq: register cpuhp callback after hctx is added to xarray table 2025-01-02 10:30:52 +01:00
certs
crypto crypto: api - Add crypto_clone_tfm 2024-12-14 19:53:51 +01:00
Documentation Documentation: PM: Clarify pm_runtime_resume_and_get() return value 2024-12-19 18:08:56 +01:00
drivers x86/hyperv: Fix hv tsc page based sched_clock for hibernation 2025-01-09 13:29:56 +01:00
fs btrfs: fix use-after-free in btrfs_encoded_read_endio() 2025-01-09 13:29:56 +01:00
include x86/hyperv: Fix hv tsc page based sched_clock for hibernation 2025-01-09 13:29:56 +01:00
init initramfs: avoid filename buffer overrun 2024-12-14 19:53:14 +01:00
io_uring io_uring/sqpoll: fix sqpoll error handling races 2025-01-02 10:30:54 +01:00
ipc ipc: fix memleak if msg_init_ns failed in create_ipc_ns 2024-12-14 19:54:06 +01:00
kernel tracing: Have process_string() also allow arrays 2025-01-09 13:29:56 +01:00
lib lib: stackinit: hide never-taken branch from compiler 2024-12-14 19:54:37 +01:00
LICENSES
mm vmalloc: fix accounting with i915 2025-01-02 10:30:53 +01:00
net bpf: Check negative offsets in __bpf_skb_min_len() 2025-01-02 10:30:48 +01:00
rust rust: macros: provide correct provenance when constructing THIS_MODULE 2024-10-17 15:22:24 +02:00
samples samples/bpf: Fix a resource leak 2024-12-14 19:54:40 +01:00
scripts modpost: Add .irqentry.text to OTHER_SECTIONS 2024-12-14 19:54:35 +01:00
security selinux: ignore unknown extended permissions 2025-01-09 13:29:56 +01:00
sound ALSA: hda/realtek: Fix spelling mistake "Firelfy" -> "Firefly" 2025-01-02 10:30:55 +01:00
tools stddef: make __struct_group() UAPI C++-friendly 2025-01-02 10:30:51 +01:00
usr
virt KVM: Fix a data race on last_boosted_vcpu in kvm_vcpu_on_spin() 2024-06-27 13:46:21 +02:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore Remove *.orig pattern from .gitignore 2024-10-17 15:21:15 +02:00
.mailmap
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile Linux 6.1.123 2025-01-02 10:30:56 +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.