summaryrefslogtreecommitdiff
path: root/rust/kernel/alloc/kvec/errors.rs
diff options
context:
space:
mode:
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>2026-11-13 17:28:27 +0900
committerMasami Hiramatsu (Google) <mhiramat@kernel.org>2026-11-13 23:04:48 +0900
commit9b6e9d6a11090ac34516c45f48663b37ac94a9b1 (patch)
tree1638ddf774e75ae5d34fa0df26e19d15ef28eb8e /rust/kernel/alloc/kvec/errors.rs
parent72d3a5cb0cd7335553549aaffecc683e3ecc0c43 (diff)
tracing/probes: Fix BTF bitfield parsing and out-of-bounds buffer write
BTF bitfield parsing in trace_probe.c assumes a 64-bit (8-byte) container when computing FETCH_OP_MOD_BF shift amounts and basesize, whereas the preceding store instruction only allocates and writes the field's fetch type size (which may be 1, 2, or 4 bytes when kflag=1). At runtime, fetch_apply_bitfield() performs an 8-byte read-modify-write on the smaller ring buffer slot, corrupting adjacent ring buffer data or writing past the end of the event record. In addition, signed bitfields with bit widths other than 8/16/32/64 fail to resolve a fetch type, bitfields whose width is a multiple of 8 inside a larger integer or spanning a byte boundary fail to emit FETCH_OP_MOD_BF or select a container wide enough for bitoffs + bitsize, kflag=0 bitfield offsets >= 8 bits are not folded into the byte offset, and big-endian architectures use the little-endian left-shift formula in parse_btf_bitfield(). Compute the bitfield byte and bit offsets consistently during field lookup, select the smallest unsigned fetch type that covers the bit offset and bit width, and calculate the FETCH_OP_MOD_BF parameters from the selected fetch type size for both big- and little-endian bitfields. Link: https://lore.kernel.org/all/179455850711.403392.10512730891220678403.stgit@devnote2/ Fixes: c440adfbe302 ("tracing/probes: Support BTF based data structure field access") Cc: stable@vger.kernel.org Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Diffstat (limited to 'rust/kernel/alloc/kvec/errors.rs')
0 files changed, 0 insertions, 0 deletions