diff mbox series

[net,v2] af_unix: selftest: Fix the size of the parameter to connect()

Message ID b80ffedf-3f53-08f7-baf0-db0450b8853f@alu.unizg.hr (mailing list archive)
State New
Headers show
Series [net,v2] af_unix: selftest: Fix the size of the parameter to connect() | expand

Commit Message

Mirsad Todorovac Jan. 6, 2023, 7:28 p.m. UTC
From: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>

Adjust size parameter in connect() to match the type of the parameter, to
fix the "No such file or directory" error in selftests/net/af_unix/
test_oob_unix.c:127.

The existing code happens to work provided that the autogenerated pathname
is shorter than sizeof (struct sockaddr), which is why it hasn't been
noticed earlier.

Visible from the trace excerpt:

bind(3, {sa_family=AF_UNIX, sun_path="unix_oob_453059"}, 110) = 0
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fa6a6577a10) = 453060
[pid <child>] connect(6, {sa_family=AF_UNIX, sun_path="unix_oob_45305"}, 16) = -1 ENOENT (No such file or directory)

BUG: The filename is trimmed to sizeof (struct sockaddr).

The patch is generated against the "vanilla" torvalds mainline tree 6.2-rc2.
(Tested to apply against net.git tree.)

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
Cc: Florian Westphal <fw@strlen.de>
Reviewed-by: Florian Westphal <fw@strlen.de>
Fixes: 314001f0bf92 ("af_unix: Add OOB support")
Signed-off-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>

---
  tools/testing/selftests/net/af_unix/test_unix_oob.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)


--
Mirsad Goran Todorovac
Sistem inženjer
Grafički fakultet | Akademija likovnih umjetnosti
Sveučilište u Zagrebu

Comments

Jakub Kicinski Jan. 7, 2023, 12:14 a.m. UTC | #1
On Fri, 6 Jan 2023 20:28:33 +0100 Mirsad Goran Todorovac wrote:
> The patch is generated against the "vanilla" torvalds mainline tree 6.2-rc2.
> (Tested to apply against net.git tree.)

This kind of info belongs outside of the commit message (under the 
--- line).

> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Paolo Abeni <pabeni@redhat.com>
> Cc: Shuah Khan <shuah@kernel.org>
> Cc: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
> Cc: Florian Westphal <fw@strlen.de>
> Reviewed-by: Florian Westphal <fw@strlen.de>
> Fixes: 314001f0bf92 ("af_unix: Add OOB support")
> Signed-off-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
> 

no new line here

> ---

still doesn't apply, probably because there are two email footers
Mirsad Todorovac Jan. 7, 2023, 1:42 a.m. UTC | #2
On 07. 01. 2023. 01:14, Jakub Kicinski wrote:
> On Fri, 6 Jan 2023 20:28:33 +0100 Mirsad Goran Todorovac wrote:
>> The patch is generated against the "vanilla" torvalds mainline tree 6.2-rc2.
>> (Tested to apply against net.git tree.)
> 
> This kind of info belongs outside of the commit message (under the
> --- line).
> 
>> Cc: "David S. Miller" <davem@davemloft.net>
>> Cc: Eric Dumazet <edumazet@google.com>
>> Cc: Jakub Kicinski <kuba@kernel.org>
>> Cc: Paolo Abeni <pabeni@redhat.com>
>> Cc: Shuah Khan <shuah@kernel.org>
>> Cc: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
>> Cc: Florian Westphal <fw@strlen.de>
>> Reviewed-by: Florian Westphal <fw@strlen.de>
>> Fixes: 314001f0bf92 ("af_unix: Add OOB support")
>> Signed-off-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
>>
> 
> no new line here
> 
>> ---
> 
> still doesn't apply, probably because there are two email footers

Thank you for the guidelines to make your robots happy :), the next
time I will assume all these from start, provided that I find and
patch another bug or issue.

Thanks,
Mirsad
Jakub Kicinski Jan. 7, 2023, 2:08 a.m. UTC | #3
On Sat, 7 Jan 2023 02:42:43 +0100 Mirsad Goran Todorovac wrote:
> > still doesn't apply, probably because there are two email footers  
> 
> Thank you for the guidelines to make your robots happy :), the next
> time I will assume all these from start, provided that I find and
> patch another bug or issue.

Ah, sorry, wrong assumption :S

Your email client converts tabs to spaces, that's the problem.

Could you try get send-email ?
Mirsad Todorovac Jan. 7, 2023, 3:36 a.m. UTC | #4
On Fri, 6 Jan 2023, Jakub Kicinski wrote:

> On Sat, 7 Jan 2023 02:42:43 +0100 Mirsad Goran Todorovac wrote:
> > > still doesn't apply, probably because there are two email footers  
> > 
> > Thank you for the guidelines to make your robots happy :), the next
> > time I will assume all these from start, provided that I find and
> > patch another bug or issue.
> 
> Ah, sorry, wrong assumption :S
> 
> Your email client converts tabs to spaces, that's the problem.
> 
> Could you try get send-email ?

Sorry, couldn't make git send-email nor mutt IMAP running at such a short 
notice.

I've chosen Alpine due to advice in Documentation/process/email-clients.rst

Hope that will work.

Thank you for your patience with guidelines for this patch.

Thanks,
Mirsad

--
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
Mirsad Todorovac Jan. 8, 2023, 9:30 p.m. UTC | #5
On 07. 01. 2023. 03:08, Jakub Kicinski wrote:
> On Sat, 7 Jan 2023 02:42:43 +0100 Mirsad Goran Todorovac wrote:
>>> still doesn't apply, probably because there are two email footers  
>>
>> Thank you for the guidelines to make your robots happy :), the next
>> time I will assume all these from start, provided that I find and
>> patch another bug or issue.
> 
> Ah, sorry, wrong assumption :S
> 
> Your email client converts tabs to spaces, that's the problem.
> 
> Could you try get send-email ?

Sorry, Jakub, just to "remove this from stack", did the
[PATCH net v4] af_unix: selftest: Fix the size of the parameter to connect()
apply?

I can't seem to handle more than about half a dozen of bug reports at a time or
I started overlooking emails :(

Thanks,
Mirsad
diff mbox series

Patch

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..532459a15067 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(*consumer_addr)) != 0) {
  		perror("Connect failed");
  		kill(0, SIGTERM);