Skip to content

blktrace: build the synthesized v1 record from the entry's own layout - #1301

Closed
ghost wants to merge 1 commit into
linus-master_basefrom
series/1163668=>linus-master
Closed

ghost wants to merge 1 commit into
linus-master_basefrom
series/1163668=>linus-master

Conversation

@ghost

@ghost ghost commented Sep 13, 2026

Copy link
Copy Markdown

Pull request for series with
subject: blktrace: build the synthesized v1 record from the entry's own layout
version: 1
url: https://patchwork.kernel.org/series/1163668/

@ghost

ghost commented Sep 13, 2026

Copy link
Copy Markdown
Author

@ghost

ghost commented Sep 13, 2026

Copy link
Copy Markdown
Author

@ghost
ghost force-pushed the series/1163668=>linus-master branch from 048a150 to 6f5497b Compare September 13, 2026 09:40
@ghost ghost added V1-ci-pass and removed V1-ci-fail labels Sep 13, 2026
@ghost
ghost force-pushed the linus-master_base branch from 772381e to 0224dee Compare September 13, 2026 22:56
@ghost

ghost commented Sep 13, 2026

Copy link
Copy Markdown
Author

@ghost
ghost force-pushed the series/1163668=>linus-master branch from 6f5497b to 76a4234 Compare September 13, 2026 22:59
@ghost
ghost force-pushed the linus-master_base branch from 0224dee to f14340f Compare September 15, 2026 09:28
@ghost

ghost commented Sep 15, 2026

Copy link
Copy Markdown
Author

@ghost
ghost force-pushed the series/1163668=>linus-master branch from 76a4234 to 7956c0e Compare September 15, 2026 09:33
@ghost
ghost force-pushed the linus-master_base branch from f14340f to 0e174bc Compare September 17, 2026 19:27
@ghost

ghost commented Sep 17, 2026

Copy link
Copy Markdown
Author

@ghost
ghost force-pushed the series/1163668=>linus-master branch from 7956c0e to ebcfd76 Compare September 17, 2026 19:31
@ghost
ghost force-pushed the linus-master_base branch from 0e174bc to fbef20f Compare September 18, 2026 13:22
@ghost

ghost commented Sep 18, 2026

Copy link
Copy Markdown
Author

@ghost
ghost force-pushed the series/1163668=>linus-master branch from ebcfd76 to 987743e Compare September 18, 2026 13:26
@ghost
ghost force-pushed the linus-master_base branch from fbef20f to 4a650fc Compare September 20, 2026 20:45
@ghost

ghost commented Sep 20, 2026

Copy link
Copy Markdown
Author

@ghost
ghost force-pushed the series/1163668=>linus-master branch from 987743e to 22dce9c Compare September 20, 2026 20:48
@ghost
ghost force-pushed the linus-master_base branch from 4a650fc to c65e2dc Compare September 22, 2026 14:09
@ghost

ghost commented Sep 22, 2026

Copy link
Copy Markdown
Author

@ghost
ghost force-pushed the series/1163668=>linus-master branch from 22dce9c to c995118 Compare September 22, 2026 14:37
@ghost ghost added V1-ci-fail and removed V1-ci-pass labels Sep 22, 2026
@ghost
ghost force-pushed the series/1163668=>linus-master branch from 50be900 to 01a0b4f Compare October 3, 2026 22:21
@ghost
ghost force-pushed the linus-master_base branch from 72d0f5e to d980ad5 Compare October 5, 2026 02:03
@ghost

ghost commented Oct 5, 2026

Copy link
Copy Markdown
Author

@ghost
ghost force-pushed the series/1163668=>linus-master branch from 01a0b4f to 83d4f06 Compare October 5, 2026 02:28
@ghost ghost added V1-ci-pass and removed V1-ci-fail labels Oct 6, 2026
@ghost
ghost force-pushed the linus-master_base branch from d980ad5 to 83b99cc Compare October 6, 2026 12:35
@ghost

ghost commented Oct 6, 2026

Copy link
Copy Markdown
Author

@ghost
ghost force-pushed the series/1163668=>linus-master branch from 83d4f06 to 08998dd Compare October 6, 2026 13:12
@ghost
ghost force-pushed the linus-master_base branch from 83b99cc to 9081535 Compare October 6, 2026 16:58
@ghost

ghost commented Oct 6, 2026

Copy link
Copy Markdown
Author

@ghost
ghost force-pushed the series/1163668=>linus-master branch from 08998dd to 410956c Compare October 6, 2026 17:26
@ghost
ghost force-pushed the linus-master_base branch from 9081535 to 6118c5c Compare October 7, 2026 15:18
@ghost

ghost commented Oct 7, 2026

Copy link
Copy Markdown
Author

@ghost
ghost force-pushed the series/1163668=>linus-master branch from 410956c to f9a7538 Compare October 7, 2026 15:53
@ghost ghost added V1-ci-fail and removed V1-ci-pass labels Oct 8, 2026
@ghost
ghost force-pushed the linus-master_base branch from 6118c5c to 17720b8 Compare October 10, 2026 02:04
@ghost

ghost commented Oct 10, 2026

Copy link
Copy Markdown
Author

@ghost
ghost force-pushed the series/1163668=>linus-master branch from f9a7538 to 4eb38a1 Compare October 10, 2026 02:45
@ghost
ghost force-pushed the linus-master_base branch from 17720b8 to ec9266e Compare October 11, 2026 18:17
@ghost

ghost commented Oct 11, 2026

Copy link
Copy Markdown
Author

@ghost
ghost force-pushed the series/1163668=>linus-master branch from 4eb38a1 to 6b9fc42 Compare October 11, 2026 18:50
@ghost
ghost force-pushed the linus-master_base branch from ec9266e to 2e69118 Compare October 12, 2026 12:20
@ghost

ghost commented Oct 12, 2026

Copy link
Copy Markdown
Author

blk_trace_synthesize_old_trace() emits a classic blk_io_trace for the
binary trace_pipe output by copying 32 bytes from the ring buffer entry's
sector onward into a struct blk_io_trace. It reads them at blk_io_trace2
offsets, and the two layouts diverge after bytes: v2 has a 32-bit pid at
28 and a 64-bit action at 32, where v1 has a 32-bit action at 28 and pid
at 32. On a v2 entry every field from action on lands one slot off, so a
consumer reads the pid as the action, the device as the cpu, and the cpu
as error and pdu_len.

The PDU comes from the wrong offset as well. The copy ends at v2 offset
48 + pdu_len while the PDU starts at 64, and the emitted pdu_len is taken
from the v2 cpu, so it reads 0 while extra bytes were appended and the
consumer resynchronizes on the wrong boundary.

The entry is not always a v2 record. __blk_add_trace() reserves
sizeof(struct blk_io_trace) when the trace was set up by BLKTRACESETUP,
and on such an entry the 32-byte copy is correct. pdu_len is still read
at v2 offset 50 though, past the end of a 48-byte entry, and drives an
unbounded copy that desynchronizes the stream. That is what syzbot hit.

Take the layout from iter->ent_size, which is the only discriminator the
entry carries -- magic and sequence are the ftrace header, not a version
stamp. Assign the v1 fields from their counterparts in that layout and
append the PDU from the end of it, bounded by the entry size.

  BUG: KASAN: slab-out-of-bounds in seq_buf_putmem+0x124/0x180
  Read of size 1352 at addr ffff8880295bdb98 by task syz.2.2551/19243
   seq_buf_putmem+0x124/0x180 lib/seq_buf.c:241
   blk_trace_synthesize_old_trace kernel/trace/blktrace.c:1780 [inline]
   blk_trace_event_print_binary+0x130/0x1b0 kernel/trace/blktrace.c:1788
   tracing_read_pipe+0x568/0xb50 kernel/trace/trace.c:5444
   vfs_read+0x213/0xa80 fs/read_write.c:572

Fixes: 4d8bc7b ("blktrace: move ftrace blk_io_tracer to blk_io_trace2")
Reported-by: [email protected]
Closes: https://syzkaller.appspot.com/bug?extid=f179b16e13624138b0f1
Cc: [email protected]
Signed-off-by: Donggeun Yoo <[email protected]>
Assisted-by: Claude:claude-fable-5
@ghost
ghost force-pushed the series/1163668=>linus-master branch from 6b9fc42 to 0f93ddd Compare October 12, 2026 14:00
@ghost

ghost commented Oct 13, 2026

Copy link
Copy Markdown
Author

At least one diff in series https://patchwork.kernel.org/series/1163668/ irrelevant now for [{'archived': False, 'project': 241}] search patterns

@ghost ghost closed this Oct 13, 2026
@ghost
ghost deleted the series/1163668=>linus-master branch October 15, 2026 04:34
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant