mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
To: eadavis@qq.com
Cc: davem@davemloft.net, edumazet@google.com, kernel@pengutronix.de,
	kuba@kernel.org, leitao@debian.org, linux-can@vger.kernel.org,
	linux-kernel@vger.kernel.org, mkl@pengutronix.de,
	netdev@vger.kernel.org, o.rempel@pengutronix.de,
	pabeni@redhat.com, robin@protonic.nl, socketcan@hartkopp.net,
	syzbot+ad601904231505ad6617@syzkaller.appspotmail.com,
	syzkaller-bugs@googlegroups.com, snovitoll@gmail.com
Subject: Re: [PATCH net-next V2] can: j1939: fix uaf warning in j1939_session_destroy
Date: Fri, 11 Oct 2024 18:41:24 +0500	[thread overview]
Message-ID: <20241011134124.3048936-1-snovitoll@gmail.com> (raw)
In-Reply-To: <tencent_5B8967E03C7737A897DA36604A8A75DB7709@qq.com>

On Thu, 8 Aug 2024 19:07:55 +0800, Edward Adam Davis wrote:
> On Thu, 8 Aug 2024 09:49:18 +0200, Oleksij Rempel wrote:
> > > the skb to the queue and increase the skb reference count through it.
> > > 
> > > Reported-and-tested-by: syzbot+ad601904231505ad6617@syzkaller.appspotmail.com
> > > Closes: https://syzkaller.appspot.com/bug?extid=ad601904231505ad6617
> > > Signed-off-by: Edward Adam Davis <eadavis@qq.com>
> > 
> > This patch breaks j1939.
> > The issue can be reproduced by running following commands:
> I tried to reproduce the problem using the following command, but was 
> unsuccessful. Prompt me to install j1939cat and j1939acd, and there are
> some other errors.
> 
> Can you share the logs from when you reproduced the problem?

Hello,

Here is the log of can-tests/j1939/run_all.sh:

# ip link add type vcan
# ip l s dev vcan0 up
# ./run_all.sh vcan0 vcan0
##############################################
run: j1939_ac_100k_dual_can.sh
generate random data for the test
1+0 records in
1+0 records out
102400 bytes (102 kB, 100 KiB) copied, 0.00191192 s, 53.6 MB/s
start j1939acd and j1939cat on vcan0
8321
8323
start j1939acd and j1939cat on vcan0
[  132.211317][ T8326] vcan0: tx drop: invalid sa for name 0x0000000011223340
j1939cat: j1939cat_send_one: transfer error: -99: Cannot assign requested address

It fails here:
https://github.com/linux-can/can-tests/blob/master/j1939/j1939_ac_100k_dual_can.sh#L70

The error message is printed in this condition:
https://elixir.bootlin.com/linux/v6.12-rc2/source/net/can/j1939/address-claim.c#L104-L108

I've applied your patch on the current 6.12.0-rc2 and the syzkaller C repro
doesn't trigger WARNING uaf, refcount anymore though.

== Offtopic:
I wonder if can-tests/j1939 should be refactored from shell to C tests in the
same linux-can/can-tests repository (or even migrate to KUnit tests)
to improve debugging, test coverage. I'd like to understand which syscalls
and params are used j1939cat and j1939acd utils -- currently, tracing with
strace and trace-cmd (ftrace).

> > git clone git@github.com:linux-can/can-tests.git
> > cd can-tests/j1939/
> > ip link add type vcan
> > ip l s dev vcan0 up
> > ./run_all.sh vcan0 vcan0


  parent reply	other threads:[~2024-10-11 13:40 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-05 21:18 [syzbot] [can?] WARNING: refcount bug in j1939_session_put syzbot
2024-08-06 13:12 ` Edward Adam Davis
2024-08-06 13:32   ` syzbot
2024-08-06 13:39 ` Edward Adam Davis
2024-08-06 14:04   ` syzbot
2024-08-07  0:51 ` Edward Adam Davis
2024-08-07  1:22   ` syzbot
2024-08-07  1:18 ` Edward Adam Davis
2024-08-07  1:39   ` syzbot
2024-08-07  1:42 ` Edward Adam Davis
2024-08-07  2:00   ` syzbot
2024-08-07  8:02   ` Breno Leitao
2024-08-07 23:06     ` Edward Adam Davis
2024-08-07  2:38 ` Edward Adam Davis
2024-08-07  3:11   ` syzbot
2024-08-07  6:21 ` Edward Adam Davis
2024-08-07  6:40   ` syzbot
2024-08-07  6:56 ` Edward Adam Davis
2024-08-07  8:20   ` syzbot
2024-08-07  8:30 ` Edward Adam Davis
2024-08-07  9:14   ` syzbot
2024-08-07  9:29 ` Edward Adam Davis
2024-08-07 10:20   ` syzbot
2024-08-07 10:59 ` Edward Adam Davis
2024-08-07 12:12   ` syzbot
2024-08-07 12:35 ` [PATCH net-next] can: j1939: fix uaf in j1939_session_destroy Edward Adam Davis
2024-08-07 14:16   ` Jakub Kicinski
2024-08-07 23:08     ` [PATCH net-next V2] can: j1939: fix uaf warning " Edward Adam Davis
2024-08-08  7:49       ` Oleksij Rempel
2024-08-08 11:07         ` Edward Adam Davis
2024-08-08 11:57           ` Marc Kleine-Budde
2024-10-11 13:41           ` Sabyrzhan Tasbolatov [this message]
2024-10-11 14:10             ` Oleksij Rempel

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=20241011134124.3048936-1-snovitoll@gmail.com \
    --to=snovitoll@gmail.com \
    --cc=davem@davemloft.net \
    --cc=eadavis@qq.com \
    --cc=edumazet@google.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=leitao@debian.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=robin@protonic.nl \
    --cc=socketcan@hartkopp.net \
    --cc=syzbot+ad601904231505ad6617@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /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

all inboxes | Powered by JetHome®