mbox series

[v1,net,00/11] af_unix: Fix bunch of MSG_OOB bugs and add new tests.

Message ID 20240625013645.45034-1-kuniyu@amazon.com (mailing list archive)
Headers show
Series af_unix: Fix bunch of MSG_OOB bugs and add new tests. | expand

Message

Kuniyuki Iwashima June 25, 2024, 1:36 a.m. UTC
This series rewrites the selftest for AF_UNIX MSG_OOB and fixes
bunch of bugs that AF_UNIX behaves differently compared to TCP.

Note that the test discovered few more bugs in TCP side, which
will be fixed in another series.


Kuniyuki Iwashima (11):
  selftest: af_unix: Remove test_unix_oob.c.
  selftest: af_unix: Add msg_oob.c.
  af_unix: Stop recv(MSG_PEEK) at consumed OOB skb.
  af_unix: Don't stop recv(MSG_DONTWAIT) if consumed OOB skb is at the
    head.
  selftest: af_unix: Add non-TCP-compliant test cases in msg_oob.c.
  af_unix: Don't stop recv() at consumed ex-OOB skb.
  selftest: af_unix: Add SO_OOBINLINE test cases in msg_oob.c
  selftest: af_unix: Check SIGURG after every send() in msg_oob.c
  selftest: af_unix: Check EPOLLPRI after every send()/recv() in
    msg_oob.c
  af_unix: Fix wrong ioctl(SIOCATMARK) when consumed OOB skb is at the
    head.
  selftest: af_unix: Check SIOCATMARK after every send()/recv() in
    msg_oob.c.

 net/unix/af_unix.c                            |  37 +-
 tools/testing/selftests/net/.gitignore        |   1 -
 tools/testing/selftests/net/af_unix/Makefile  |   2 +-
 tools/testing/selftests/net/af_unix/msg_oob.c | 734 ++++++++++++++++++
 .../selftests/net/af_unix/test_unix_oob.c     | 436 -----------
 5 files changed, 766 insertions(+), 444 deletions(-)
 create mode 100644 tools/testing/selftests/net/af_unix/msg_oob.c
 delete mode 100644 tools/testing/selftests/net/af_unix/test_unix_oob.c

Comments

Jakub Kicinski June 26, 2024, 12:43 a.m. UTC | #1
On Mon, 24 Jun 2024 18:36:34 -0700 Kuniyuki Iwashima wrote:
> This series rewrites the selftest for AF_UNIX MSG_OOB and fixes
> bunch of bugs that AF_UNIX behaves differently compared to TCP.

I like pairing the fix with the selftest, but at the same time
"let's rewrite the selftest first" gives me pause. We have 40 LoC
of actual changes here and 1000 LoC of test churn.

I guess we'll find out on Thursday if we went too far :)

>  net/unix/af_unix.c                            |  37 +-
>  tools/testing/selftests/net/.gitignore        |   1 -
>  tools/testing/selftests/net/af_unix/Makefile  |   2 +-
>  tools/testing/selftests/net/af_unix/msg_oob.c | 734 ++++++++++++++++++
>  .../selftests/net/af_unix/test_unix_oob.c     | 436 -----------
>  5 files changed, 766 insertions(+), 444 deletions(-)
>  create mode 100644 tools/testing/selftests/net/af_unix/msg_oob.c
>  delete mode 100644 tools/testing/selftests/net/af_unix/test_unix_oob.c
Kuniyuki Iwashima June 26, 2024, 1:31 a.m. UTC | #2
From: Jakub Kicinski <kuba@kernel.org>
Date: Tue, 25 Jun 2024 17:43:18 -0700
> On Mon, 24 Jun 2024 18:36:34 -0700 Kuniyuki Iwashima wrote:
> > This series rewrites the selftest for AF_UNIX MSG_OOB and fixes
> > bunch of bugs that AF_UNIX behaves differently compared to TCP.
> 
> I like pairing the fix with the selftest, but at the same time
> "let's rewrite the selftest first" gives me pause. We have 40 LoC
> of actual changes here and 1000 LoC of test churn.
> 
> I guess we'll find out on Thursday if we went too far :)

I hope it's worth for finding 4 AF_UNIX bugs and 2 ancient TCP ones,
let's see 
patchwork-bot+netdevbpf@kernel.org June 27, 2024, 10:10 a.m. UTC | #3
Hello:

This series was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Mon, 24 Jun 2024 18:36:34 -0700 you wrote:
> This series rewrites the selftest for AF_UNIX MSG_OOB and fixes
> bunch of bugs that AF_UNIX behaves differently compared to TCP.
> 
> Note that the test discovered few more bugs in TCP side, which
> will be fixed in another series.
> 
> 
> [...]

Here is the summary with links:
  - [v1,net,01/11] selftest: af_unix: Remove test_unix_oob.c.
    https://git.kernel.org/netdev/net/c/7d139181a891
  - [v1,net,02/11] selftest: af_unix: Add msg_oob.c.
    https://git.kernel.org/netdev/net/c/d098d77232c3
  - [v1,net,03/11] af_unix: Stop recv(MSG_PEEK) at consumed OOB skb.
    https://git.kernel.org/netdev/net/c/b94038d841a9
  - [v1,net,04/11] af_unix: Don't stop recv(MSG_DONTWAIT) if consumed OOB skb is at the head.
    https://git.kernel.org/netdev/net/c/93c99f21db36
  - [v1,net,05/11] selftest: af_unix: Add non-TCP-compliant test cases in msg_oob.c.
    https://git.kernel.org/netdev/net/c/f5ea0768a255
  - [v1,net,06/11] af_unix: Don't stop recv() at consumed ex-OOB skb.
    https://git.kernel.org/netdev/net/c/36893ef0b661
  - [v1,net,07/11] selftest: af_unix: Add SO_OOBINLINE test cases in msg_oob.c
    https://git.kernel.org/netdev/net/c/436352e8e57e
  - [v1,net,08/11] selftest: af_unix: Check SIGURG after every send() in msg_oob.c
    https://git.kernel.org/netdev/net/c/d02689e6860d
  - [v1,net,09/11] selftest: af_unix: Check EPOLLPRI after every send()/recv() in msg_oob.c
    https://git.kernel.org/netdev/net/c/48a998373090
  - [v1,net,10/11] af_unix: Fix wrong ioctl(SIOCATMARK) when consumed OOB skb is at the head.
    https://git.kernel.org/netdev/net/c/e400cfa38bb0
  - [v1,net,11/11] selftest: af_unix: Check SIOCATMARK after every send()/recv() in msg_oob.c.
    https://git.kernel.org/netdev/net/c/91b7186c8d14

You are awesome, thank you!