From: asmadeus@codewreck.org
To: JP Kobryn <inwardvessel@gmail.com>
Cc: ericvh@kernel.org, lucho@ionkov.net, linux_oss@crudebyte.com,
rostedt@goodmis.org, mhiramat@kernel.org,
mathieu.desnoyers@efficios.com, v9fs@lists.linux.dev,
linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org,
kernel-team@meta.com
Subject: Re: [PATCH] 9p: prevent read overrun in protocol dump tracepoint
Date: Sat, 2 Dec 2023 16:19:16 +0900 [thread overview]
Message-ID: <ZWradOa-e1SM8MDZ@codewreck.org> (raw)
In-Reply-To: <ZWq0BvPGYMTi-WfC@codewreck.org>
asmadeus@codewreck.org wrote on Sat, Dec 02, 2023 at 01:35:18PM +0900:
> > diff --git a/include/trace/events/9p.h b/include/trace/events/9p.h
> > index 4dfa6d7f83ba..8690a7086252 100644
> > --- a/include/trace/events/9p.h
> > +++ b/include/trace/events/9p.h
> > @@ -185,7 +185,8 @@ TRACE_EVENT(9p_protocol_dump,
> > __entry->clnt = clnt;
> > __entry->type = pdu->id;
> > __entry->tag = pdu->tag;
> > - memcpy(__entry->line, pdu->sdata, P9_PROTO_DUMP_SZ);
> > + memcpy(__entry->line, pdu->sdata,
> > + min(pdu->capacity, P9_PROTO_DUMP_SZ));
Building with W=1 yields a warning:
./include/linux/minmax.h:21:35: warning: comparison of distinct pointer types lacks a cast
...
./include/trace/events/9p.h:189:33: note: in expansion of macro ‘min’
189 | min(pdu->capacity, P9_PROTO_DUMP_SZ));
I've updated the patch to:
+ min_t(size_t, pdu->capacity, P9_PROTO_DUMP_SZ));
and pushed to my -next branch:
https://github.com/martinetd/linux/commits/9p-next
--
Dominique Martinet | Asmadeus
next prev parent reply other threads:[~2023-12-02 7:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-02 3:04 [PATCH] 9p: prevent read overrun in protocol dump tracepoint JP Kobryn
2023-12-02 4:35 ` asmadeus
2023-12-02 7:19 ` asmadeus [this message]
2023-12-02 13:05 ` Christian Schoenebeck
2023-12-03 1:14 ` Steven Rostedt
2023-12-03 1:33 ` Dominique Martinet
2023-12-03 4:15 ` Steven Rostedt
2023-12-03 5:32 ` Dominique Martinet
2023-12-04 16:20 ` JP Kobryn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZWradOa-e1SM8MDZ@codewreck.org \
--to=asmadeus@codewreck.org \
--cc=bpf@vger.kernel.org \
--cc=ericvh@kernel.org \
--cc=inwardvessel@gmail.com \
--cc=kernel-team@meta.com \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=linux_oss@crudebyte.com \
--cc=lucho@ionkov.net \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=v9fs@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).