[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220706162113.47275-1-kuniyu@amazon.com>
Date: Wed, 6 Jul 2022 09:21:13 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <rostedt@...dmis.org>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <kuniyu@...zon.com>,
<linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>,
<nhorman@...driver.com>
Subject: Re: [PATCH] net: sock: tracing: Fix sock_exceed_buf_limit not to dereference stale pointer
From: Steven Rostedt <rostedt@...dmis.org>
Date: Wed, 6 Jul 2022 10:50:40 -0400
> From: "Steven Rostedt (Google)" <rostedt@...dmis.org>
>
> The trace event sock_exceed_buf_limit saves the prot->sysctl_mem pointer
> and then dereferences it in the TP_printk() portion. This is unsafe as the
> TP_printk() portion is executed at the time the buffer is read. That is,
> it can be seconds, minutes, days, months, even years later. If the proto
> is freed, then this dereference will can also lead to a kernel crash.
>
> Instead, save the sysctl_mem array into the ring buffer and have the
> TP_printk() reference that instead. This is the proper and safe way to
> read pointers in trace events.
>
> Link: https://lore.kernel.org/all/20220706052130.16368-12-kuniyu@amazon.com/
>
> Cc: stable@...r.kernel.org
> Fixes: 3847ce32aea9f ("core: add tracepoints for queueing skb to rcvbuf")
> Signed-off-by: Steven Rostedt (Google) <rostedt@...dmis.org>
Acked-by: Kuniyuki Iwashima <kuniyu@...zon.com>
Thanks for shipping the proper fix quickly!
Powered by blists - more mailing lists