Linux HAM/Amateur Radio development
 help / color / mirror / Atom feed
From: F6BVP <f6bvp@free.fr>
To: linux-hams@vger.kernel.org, netdev <netdev@vger.kernel.org>
Cc: Dan Cross <crossd@gmail.com>, David Ranch <dranch@trinnet.net>,
	Eric Dumazet <edumazet@google.com>,
	Folkert van Heusden <folkert@vanheusden.com>
Subject: Re: [ROSE] [AX25] 6.15.10 long term stable kernel oops
Date: Sun, 24 Aug 2025 16:04:40 +0200	[thread overview]
Message-ID: <6a5cf9cf-9984-4e1b-882f-b9b427d3c096@free.fr> (raw)
In-Reply-To: <d073ac34a39c02287be6d67622229a1e@vanheusden.com>

Hi All,

I suspect I finally found the bug that triggered a kernel panic since 
linux-15.1 version up to net-next.

Actually I found a report from

syzbot+dca31068cff20d2ad44d@syzkaller.appspotmail.com

that directed me to the solution.

A pointer *p to a buffer was declared in tty_buffer_alloc() buf not 
initialized.

Explanation :
- Sometime AX25 can perform connexions via a kissattached Ethernet port.
- In that case when an application sends a connect request from a 
console, tty_port is used by mkiss.

All kernel panic reports I sent earlier show that mkiss_receive_buf was 
involved together with tty_port_default and tty_ldisc_receive_buf.

It was sysbot detailed reporting KMSAN uninit value in mkiss_receive_buf 
that led me to the solution. Although it took me a while to understand 
the report for this is totally new for me...

Looking at the code I found :

static struct tty_buffer *tty_buffer_alloc(struct tty_port *port, size_t 
size)
  {
  	struct llist_node *free;
	struct tty_buffer *p;

I first introduced a call to kmalloc in order to initialize pointer p 
like it is done elsewhere in the function.

This performed well and Oops disappeared.

Then I tried to first initialize *p to NULL when it is declared :

struct tty_buffer *p=NULL;

When added it also performed correctly.

And finally I removed the kmalloc early instruction and only kept the 
*p=NULL initialization.

Since then, I checked this simple initialization on both 6.15.2 and 
6.17-rc2 and there was no more Oops.

I will provide the following patch against net-next in due form if there 
is no objection.

diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index 67271fc0b223..33e7f675b06d 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -159,7 +159,7 @@ void tty_buffer_free_all(struct tty_port *port)
  static struct tty_buffer *tty_buffer_alloc(struct tty_port *port, 
size_t size)
  {
  	struct llist_node *free;
-	struct tty_buffer *p;
+	struct tty_buffer *p=NULL;

  	/* Round the buffer size out */
  	size = __ALIGN_MASK(size, TTYB_ALIGN_MASK);


Bernard


Le 22/08/2025 à 05:10, Folkert van Heusden a écrit :
> Bernard,
> 
> I skimmed over the diff between the latest 6.14.y and latest 6.15.y tags 
> of the raspberry pi linux kernel and didn't saw anything relevant 
> changed. Altough changes in 'arch' could in theory affect everything.
> 
> 
> On 2025-08-22 00:39, F6BVP wrote:
>> As I already reported mkiss never triggered any Oops kernel panic up 
>> to linux-6.14.11.
>>
>> In that version I put a number of printk inside of mkiss.c in order to 
>> follow the normal behaviour and content outside and during FPAC 
>> functionning especially when issuing a connect request.
>>
>> On the opposite an FPAC connect request systematically triggers a 
>> kernel panic with linux-6.15.2 and following kernels.
>>
>> In 6.14.11 I observe that when mkiss runs core/dev is never activated 
>> i.e. neither __netif_receive_skb nor __netif_receive_skb_one_core.
>>
>> These functions appear in kernel 6.15.2 panics after mkiss_receive_buf.
>>
>> One can guess that mkiss_receive_buf() is triggering something wrong 
>> in kernel 6.15.2 and all following kernels up to net-next.
>>
>> The challenge to locate the bug is quite difficult as I did not find 
>> the way to find relevant code differences between both kernels in 
>> absence of inc patch...
>>
>> I sincerely regret not knowing how to go further.
>>
>> Bernard,
>> hamradio f6bvp /ai7bg
> 


  reply	other threads:[~2025-08-24 14:04 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <11c5701d-4bf9-4661-ad8a-06690bbe1c1c@free.fr>
     [not found] ` <fff0b3eb-ea42-4475-970d-30622dc25dca@free.fr>
2025-08-16 18:45   ` [ROSE] [AX25] 6.15.10 long term stable kernel oops Bernard Pidoux
2025-08-18 10:00     ` Bernard Pidoux
2025-08-18 10:04       ` Folkert van Heusden
2025-08-18 14:19         ` F6BVP
2025-08-18 16:30       ` Dan Cross
2025-08-18 18:28         ` F6BVP
2025-08-18 22:11           ` Dan Cross
2025-08-18 22:31           ` F6BVP
2025-08-20  8:50             ` F6BVP
2025-08-20 19:33               ` kworker/u16 Not tainted F6BVP
2025-08-21 11:28             ` [ROSE] [AX25] 6.15.10 long term stable kernel oops F6BVP
2025-08-21 17:49               ` F6BVP
2025-08-21 22:39               ` [ROSE] [AX25] 6.15.10 long term stable kernel oops F6BVP
2025-08-22  3:10                 ` Folkert van Heusden
2025-08-24 14:04                   ` F6BVP [this message]
2025-08-25 12:40                     ` Dan Carpenter
2025-08-26 13:31                       ` F6BVP
2025-08-26 13:36                         ` Eric Dumazet
2025-08-27 14:16                           ` F6BVP
2025-08-27 17:30                             ` Florian Westphal
2025-08-28 16:39                               ` F6BVP
2025-08-30 23:37                                 ` F6BVP
2025-09-01 12:04                                   ` Eric Dumazet
2025-09-01 12:05                                     ` Eric Dumazet
     [not found]                                       ` <cd0461e0-8136-4f90-df7b-64f1e43e78d4@trinnet.net>
2025-09-01 15:59                                         ` F6BVP
2025-09-01 16:03                                           ` Eric Dumazet
2025-09-01 19:10                                             ` David Ranch
2025-09-01 19:16                                               ` Eric Dumazet
2025-09-02  7:44                                             ` F6BVP
2025-09-02  7:55                                               ` Eric Dumazet
2025-09-03  9:51                                             ` [BUG] [ROSE] slab-use-after-free in lock_timer_base Bernard Pidoux
2025-09-03 10:01                                               ` Eric Dumazet
2025-09-03 10:11                                                 ` F6BVP
2025-09-03 11:07                                                   ` Takamitsu Iwai
2025-09-01 19:04                                       ` [ROSE] [AX25] 6.15.10 long term stable kernel oops David Ranch
2025-09-02  7:54                                     ` F6BVP
2025-08-19 21:17           ` [OT] " Miroslav Skoric
2025-08-16 17:02 Bernard Pidoux
2025-08-16 17:35 ` David Ranch

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=6a5cf9cf-9984-4e1b-882f-b9b427d3c096@free.fr \
    --to=f6bvp@free.fr \
    --cc=crossd@gmail.com \
    --cc=dranch@trinnet.net \
    --cc=edumazet@google.com \
    --cc=folkert@vanheusden.com \
    --cc=linux-hams@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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