Linux CAN drivers development
 help / color / mirror / Atom feed
From: Felix Maurer <fmaurer@redhat.com>
To: Oliver Hartkopp <socketcan@hartkopp.net>,
	Marc Kleine-Budde <mkl@pengutronix.de>,
	linux-can@vger.kernel.org
Cc: Davide Caratti <dcaratti@redhat.com>,
	Filippo Storniolo <fstornio@redhat.com>
Subject: Re: Advancing the testing for the CAN subsystem
Date: Mon, 24 Feb 2025 15:17:08 +0100	[thread overview]
Message-ID: <face3939-a260-47b9-bd1f-ea68b377f783@redhat.com> (raw)
In-Reply-To: <79891c7f-4a8b-4909-af6e-55598bf024e5@hartkopp.net>

Hi Oliver, all,

On 21.02.25 09:04, Oliver Hartkopp wrote:
> Hi Felix, all,
> 
> by now I was only aware of syzbot who is sometimes showing up with some
> splats
> 
> and the Linux Test Project (LTP)
> 
> https://github.com/linux-test-project/ltp/tree/master/testcases/network/can
> 
> which e.g. provides CAN filter tests which you can also find in the can-
> tests repo.
> 
> On 20.02.25 14:03, Felix Maurer wrote:
>> Hi Marc, Oliver, and linux-can community,
>>
>> we are reaching out to you because we would like to advance the testing
>> of the kernel CAN subsystem. We, that's Davide, Filippo and I, are
>> volunteering to provide the patches for this, but would like to get your
>> feedback and opinions first.
> 
> I would definitely like it and support it :-)

Great to hear :-)

>> We know about the can-tests repository[1] and think this is a good
>> starting point for our efforts. Currently, there are two main activities
>> we'd like to do:
>>
>> - Promote the test cases in can-tests to become part of the kernel
>> selftests: This would mainly get the tests closer to the upstream kernel
>> development, both in terms of maintenance and actually running them. CI
>> systems like LKFT and CKI could easily be continuously running the
>> tests.
> 
> Ok. Just for my understanding: Bringing the test cases into tools/
> testing/selftests would be the enabler to run LKFT and CKI, right?

It's not strictly necessary to have the test cases in
tools/testing/selftests to run them in LKFT and CKI, but it makes
running them much simpler. The selftests are already built in most
kernel CIs and often automatically run. In contrast, an external repo
would require to define a test case for each CI system.

> Does it have any impact or improvement for syzbot or LTP too, e.g. that
> we can also improve their test quality?

I don't think this would automatically improve syzbot or LTP.

As far as I know, LTP doesn't run the kernel selftests. It would rather
be an alternative place for the tests if they should (for some reason)
be separate from the kernel tree. But imho, bringing the test cases
closer to the kernel is a good thing. It makes sure the test cases match
the kernel version and makes them easy to discover and run for contributors.

syzbot is unrelated to other test cases. It relies on it's own
definitions to fuzz the kernel. For networking, there are two different
approaches to these definitions:

1) the definition of the syscall interfaces for a subsystem, e.g., in
[2] for CAN which I think is where the current sysbot splats are coming
from. New syscalls, options, etc. would need to be added there to extend
coverage, which should be the matter of a pull request. I only took a
quick look so I can't say for sure what might be missing here, but I
didn't see a mention of the cangw netlink interface and ISOTP there.
syzcaller might be able to discover bugs there as well by fuzzing
syscalls in general, but it of course works way better when there is a
definition of the interface available.

2) For all protocols over Ethernet, syzkaller can do external network
fuzzing [3]. With that, the network stack is fuzzed from the "outside"
by sending it packets as if they were coming from another machine,
guided by definitions of the protocols, similar to the syscall
definitions. I think it's a long shot to enable similar testing for CAN
and not something I would aim for in the near future.

[2]:
https://github.com/google/syzkaller/blob/master/sys/linux/socket_can.txt
[3]:
https://github.com/google/syzkaller/blob/master/docs/linux/external_fuzzing_network.md

>> The downside is that existing automation depending on can-tests
>> (which we don't know about) would need to be modified.
> 
> I don't know about any existing automation based in can-tests either.
> The reason for the can-test was mostly to document my own PoCs when
> adding new features.
> 
> I have no objections to stay with this repo as a PoC playground that
> might also help developers to get inspirations - and start something new
> with the current code base which aims to fuel the kernel selftests.

Okay, that's good to know can-tests is mostly PoCs for new features. It
can stay around of course, I know other subsystems have similar repos
(xdp for example). I'd add a note though that the selftests exist for
already merged features.

>> - Extend the coverage of the tests: This could include testing for,
>> e.g., vcan, vxcan, and the cangw netlink interface. But we're open to
>> feedback here if you see any pressing areas.
> 
> I see no pressing areas right now. But the recently integrated CAN XL
> support might get some attention ;-)

Alright, I'll keep that in the back of my head :-)

Thanks,
   Felix


      reply	other threads:[~2025-02-24 14:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-20 13:03 Advancing the testing for the CAN subsystem Felix Maurer
2025-02-21  8:04 ` Oliver Hartkopp
2025-02-24 14:17   ` Felix Maurer [this message]

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=face3939-a260-47b9-bd1f-ea68b377f783@redhat.com \
    --to=fmaurer@redhat.com \
    --cc=dcaratti@redhat.com \
    --cc=fstornio@redhat.com \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=socketcan@hartkopp.net \
    /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