From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <mirsad.todorovac@alu.unizg.hr>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<kuniyu@amazon.co.jp>, <linux-kernel@vger.kernel.org>,
<linux-kselftest@vger.kernel.org>, <netdev@vger.kernel.org>,
<pabeni@redhat.com>, <shuah@kernel.org>, <kuniyu@amazon.com>
Subject: Re: PATCH [1/1]: Bug with sockaddr size in net/af_unix/test_unix_oob.c
Date: Tue, 3 Jan 2023 20:13:35 +0900 [thread overview]
Message-ID: <20230103111335.81600-1-kuniyu@amazon.com> (raw)
In-Reply-To: <9e809447-bde6-7376-5431-ea200064f957@alu.unizg.hr>
From: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
Date: Tue, 3 Jan 2023 11:28:19 +0100
> Hi all,
>
> There is a minor issue that prevents self test net/af_unix to run on my platform:
Hi,
Thanks for the report and fix.
The diff looks good.
Could you post a patch formally following these?
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/Documentation/process/maintainer-netdev.rst
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/Documentation/process/submitting-patches.rst
Subject should be like
[PATCH net v1] af_unix: Correct addr size for connect() in test_unix_oob.c.
and please add this tag just before your Signed-off-by tag.
Fixes: 314001f0bf92 ("af_unix: Add OOB support")
>
> # ./test_unix_oob
> Connect failed: No such file or directory
> Terminated
>
> Tracing reveals that bind tried to open a shorter AF_UNIX socket address:
s/bind/connect/
>
> # strace -f ./test_unix_oob
> .
> .
> .
> socket(AF_UNIX, SOCK_STREAM, 0) = 3
> getpid() = 453059
> unlink("unix_oob_453059") = -1 ENOENT (No such file or directory)
> bind(3, {sa_family=AF_UNIX, sun_path="unix_oob_453059"}, 110) = 0
> pipe2([4, 5], 0) = 0
> listen(3, 1) = 0
> clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fa6a6577a10) = 453060
> rt_sigaction(SIGURG, {sa_handler=0x5601e2d014c9, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO,
> sa_restorer=0x7fa6a623bcf0}, NULL, 8) = 0
> write(5, "S", 1) = 1
> accept(3, strace: Process 453060 attached
> <unfinished ...>
> [pid 453060] set_robust_list(0x7fa6a6577a20, 24) = 0
> [pid 453060] socket(AF_UNIX, SOCK_STREAM, 0) = 6
> [pid 453060] read(4, "S", 5) = 1
> [pid 453060] connect(6, {sa_family=AF_UNIX, sun_path="unix_oob_45305"}, 16) = -1 ENOENT (No such file or directory)
> .
> .
> .
>
> NOTE: bind used UNIX_AF addr "unix_oob_453059", while producer tries to connect to "unix_oob_45305".
>
> When pids were up to 5 digits it probably did not manifest, but logically the size of the
> consumer_addr is sizeof(struct sockaddr_un).
>
> Please find the patch attached:
>
> Thanks,
> Mirsad
>
> ------------------------------------------------------------------------------------------------
> diff --git a/tools/testing/selftests/net/af_unix/test_unix_oob.c b/tools/testing/selftests/net/af_unix/test_unix_oob.c
> index b57e91e1c3f2..7ea733239cd9 100644
> --- a/tools/testing/selftests/net/af_unix/test_unix_oob.c
> +++ b/tools/testing/selftests/net/af_unix/test_unix_oob.c
> @@ -124,7 +124,7 @@ void producer(struct sockaddr_un *consumer_addr)
>
> wait_for_signal(pipefd[0]);
> if (connect(cfd, (struct sockaddr *)consumer_addr,
> - sizeof(struct sockaddr)) != 0) {
> + sizeof(struct sockaddr_un)) != 0) {
While at it, please fix the indent.
> perror("Connect failed");
> kill(0, SIGTERM);
> exit(1);
>
> --
> Mirsad Goran Todorovac
> Sistem inženjer
> Grafički fakultet | Akademija likovnih umjetnosti
> Sveučilište u Zagrebu
> --
> System engineer
> Faculty of Graphic Arts | Academy of Fine Arts
> University of Zagreb, Republic of Croatia
> The European Union
prev parent reply other threads:[~2023-01-03 11:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-03 10:28 PATCH [1/1]: Bug with sockaddr size in net/af_unix/test_unix_oob.c Mirsad Goran Todorovac
2023-01-03 11:13 ` Kuniyuki Iwashima [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=20230103111335.81600-1-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=kuniyu@amazon.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mirsad.todorovac@alu.unizg.hr \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@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