Skip to contentSkip to conversation

Fix size of parameter to connect()

PATCH Superseded Mirsad Goran Todorovac 5 participants 14 messages Jan 6, 2023 – Jan 9, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix size of parameter to connect()

From: Mirsad Goran Todorovac <[email protected]>

Adjust size parameter in connect() to match the type of the parameter, to fix "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.

Thanks and regards,
Mirsad Todorovac

Cc "David S. Miller" <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Kuniyuki Iwashima <[email protected]>
Cc Florian Westphal <[email protected]>
---
 tools/testing/selftests/net/af_unix/test_unix_oob.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/af_unix/test_unix_oob.c +1 -1
index b57e91e1c3f2..532459a15067 100644
@@ -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);
                exit(1);

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

Signature · 4 lines
System engineer
Faculty of Graphic Arts | Academy of Fine Arts
University of Zagreb, Republic of Croatia
The European Union
#1 lore raw

PATCH 1/1 Fix size of parameter to connect()

Hi,

Thanks for the patch.

From:   Mirsad Goran Todorovac <[email protected]>
Date:   Fri, 6 Jan 2023 18:18:58 +0100
Quoted 4 lines

From: Mirsad Goran Todorovac <[email protected]>

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

Could you wrap the changelog to 75 chars except for log (strace below) ? checkpatch.pl will help.

  $ git show HEAD --format=email | ./scripts/checkpatch.pl
Quoted 6 lines

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:

Quoted 7 lines

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.

Every patch that fixes networking code has to be applied cleanly on net.git.
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/

But the patch can not be applied to net.git.
Could you check this ?
https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/

Also, the mail title should be

[PATCH Tree Version Nth/Total] subsystem: Description.

Next time, Tree is net and Version is v2, and we need not write 1/1, so the subject should be

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

Please see here for details.
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/Documentation/process/maintainer-netdev.rst

Quoted 3 lines

Thanks and regards,
Mirsad Todorovac

You can remove these lines.

Quoted 2 lines

In this case, you are the reporter and the author of the patch, so the Reported-by tag is not needed. Instead, you have to add your SOB tag.

Quoted 8 lines
Cc "David S. Miller" <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Kuniyuki Iwashima <[email protected]>
Cc Florian Westphal <[email protected]>

Please add Fixes tag as I said here.
https://lore.kernel.org/netdev/[email protected]/#r

Thank you,
Kuniyuki

Quoted 29 lines
---
  tools/testing/selftests/net/af_unix/test_unix_oob.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/af_unix/test_unix_oob.c +1 -2
index b57e91e1c3f2..532459a15067 100644
@@ -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);
                 exit(1);
 
--

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

Signature · 4 lines
System engineer
Faculty of Graphic Arts | Academy of Fine Arts
University of Zagreb, Republic of Croatia
The European Union
#2 lore raw

Hi,

Quoted 3 lines · Kuniyuki Iwashima

Hi,

Thanks for the patch.

Thank you for your quick review. I had to do the homework before replying.

Quoted 11 lines
From:   Mirsad Goran Todorovac <[email protected]>
Date:   Fri, 6 Jan 2023 18:18:58 +0100
Quoted 4 lines

From: Mirsad Goran Todorovac <[email protected]>

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

Could you wrap the changelog to 75 chars except for log (strace below) ? checkpatch.pl will help.

   $ git show HEAD --format=email | ./scripts/checkpatch.pl

The complete result according to the guidelines will be in the followup email.

Quoted 9 lines
Quoted 9 lines

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)

Quoted 8 lines
Quoted 3 lines
BUG: The filename is trimmed to sizeof (struct sockaddr).

The patch is generated against the "vanilla" torvalds mainline tree 6.2-rc2.

Every patch that fixes networking code has to be applied cleanly on net.git.
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/

But the patch can not be applied to net.git.

I have tested the patch against net.git, and it is a verbatim copy (tested by diff).

Quoted 11 lines

Could you check this ?
https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/

Also, the mail title should be

[PATCH Tree Version Nth/Total] subsystem: Description.

Next time, Tree is net and Version is v2, and we need not write 1/1, so the subject should be

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

Got it. Will do in the followup email.

Quoted 9 lines

Please see here for details.
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/Documentation/process/maintainer-netdev.rst

Quoted 3 lines

Thanks and regards,
Mirsad Todorovac

You can remove these lines.

Sure.

Quoted 6 lines
Quoted 1 line

In this case, you are the reporter and the author of the patch, so the Reported-by tag is not needed. Instead, you have to add your SOB tag.

OK.

Quoted 27 lines
Quoted 8 lines
Cc "David S. Miller" <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Kuniyuki Iwashima <[email protected]>
Cc Florian Westphal <[email protected]>

Please add Fixes tag as I said here.
https://lore.kernel.org/netdev/[email protected]/#r

Thank you,
Kuniyuki

Quoted 11 lines
---
   tools/testing/selftests/net/af_unix/test_unix_oob.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/af_unix/test_unix_oob.c +0 -0
index b57e91e1c3f2..532459a15067 100644
@@ -124,7 +124,7 @@ void producer(struct sockaddr_un *consumer_addr)
 
Quoted 8 lines

tools/testing/selftests/net/af_unix/test_unix_oob.c void producer(struct sockaddr_un *consumer_addr) · line 130

Quoted 8 lines
tools/testing/selftests/net/af_unix/test_unix_oob.c +1 -1
          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);
                  exit(1);

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

Signature · 4 lines
System engineer
Faculty of Graphic Arts | Academy of Fine Arts
University of Zagreb, Republic of Croatia
The European Union
#3 lore raw

PATCH v2 1/1 af_unix: selftest: Fix the size of the parameter to connect()

In reply to Kuniyuki Iwashima

From: Mirsad Goran Todorovac <[email protected]>

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" <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Kuniyuki Iwashima <[email protected]>
Cc Florian Westphal <[email protected]>
Fixes 314001f0bf92 ("af_unix: Add OOB support")
---
 tools/testing/selftests/net/af_unix/test_unix_oob.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/af_unix/test_unix_oob.c +1 -1
index b57e91e1c3f2..532459a15067 100644
@@ -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);
 

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

Signature · 4 lines
System engineer
Faculty of Graphic Arts | Academy of Fine Arts
University of Zagreb, Republic of Croatia
The European Union
maintainer
#4 lore raw

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

Quoted 2 lines · 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).

Quoted 11 lines
Cc "David S. Miller" <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Kuniyuki Iwashima <[email protected]>
Cc Florian Westphal <[email protected]>
Fixes 314001f0bf92 ("af_unix: Add OOB support")

no new line here

Quoted 1 line

---

still doesn't apply, probably because there are two email footers

#5 lore raw

PATCH v3 1/1 af_unix: selftest: Fix the size of the parameter to connect()

From: Mirsad Goran Todorovac <[email protected]>

Adjust size parameter in connect() to match the type of the parameter, to fix "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).
Cc "David S. Miller" <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Kuniyuki Iwashima <[email protected]>
Cc Florian Westphal <[email protected]>
Fixes 314001f0bf92 ("af_unix: Add OOB support")

---

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

 tools/testing/selftests/net/af_unix/test_unix_oob.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/af_unix/test_unix_oob.c +1 -1
index b57e91e1c3f2..532459a15067 100644
@@ -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);
                exit(1);
Signature · 9 lines
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
#6 lore raw

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

In reply to Jakub Kicinski
Quoted 19 lines · Jakub Kicinski
Quoted 2 lines · 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).

Quoted 11 lines
Cc "David S. Miller" <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Kuniyuki Iwashima <[email protected]>
Cc Florian Westphal <[email protected]>
Fixes 314001f0bf92 ("af_unix: Add OOB support")
Quoted 5 lines

no new line here

Quoted 1 line

---

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

Signature · 9 lines
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
maintainer
#7 lore raw

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

Quoted 5 lines · On Sat, 7 Jan 2023 02:42:43 +0100 Mirsad Goran Todorovac wrote:
Quoted 1 line

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 ?

#8 lore raw

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

Quoted 7 lines · Jakub Kicinski
Quoted 5 lines · On Sat, 7 Jan 2023 02:42:43 +0100 Mirsad Goran Todorovac wrote:
Quoted 1 line

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.

Quoted 5 lines

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

#9 lore raw

PATCH v4 1/1 af_unix: selftest: Fix the size of the parameter to connect()

In reply to Jakub Kicinski

From: Mirsad Goran Todorovac <[email protected]>

Adjust size parameter in connect() to match the type of the parameter, to fix "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).
Cc "David S. Miller" <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Kuniyuki Iwashima <[email protected]>
Cc Florian Westphal <[email protected]>
Fixes 314001f0bf92 ("af_unix: Add OOB support")

---

The patch is generated against the "vanilla" Torvalds mainline tree 6.2-rc2. (Tested and applies against the net.git tree.)

 tools/testing/selftests/net/af_unix/test_unix_oob.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/af_unix/test_unix_oob.c +1 -1
index b57e91e1c3f2..532459a15067 100644
@@ -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);
 		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

Reviewed-by on v4 1/1
#10 lore raw

Re: [PATCH net v4] af_unix: selftest: Fix the size of the parameter to connect()

From:   Mirsad Goran Todorovac <[email protected]>
Date:   Sat, 7 Jan 2023 04:40:20 +0100 (CET)
Quoted 18 lines

From: Mirsad Goran Todorovac <[email protected]>

Adjust size parameter in connect() to match the type of the parameter, to fix "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).
Quoted 10 lines
Cc "David S. Miller" <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Kuniyuki Iwashima <[email protected]>
Cc Florian Westphal <[email protected]>
Fixes 314001f0bf92 ("af_unix: Add OOB support")

You can check the current status here.
https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/

PS: you may want to check config not to send a mail as multipart next time.

Thank you,
Kuniyuki

Quoted 33 lines

---

The patch is generated against the "vanilla" Torvalds mainline tree 6.2-rc2. (Tested and applies against the net.git tree.)

 tools/testing/selftests/net/af_unix/test_unix_oob.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/af_unix/test_unix_oob.c +1 -2
index b57e91e1c3f2..532459a15067 100644
@@ -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);
 		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

#11 lore raw

Re: [PATCH net v4] af_unix: selftest: Fix the size of the parameter to connect()

Quoted 31 lines · Kuniyuki Iwashima
From:   Mirsad Goran Todorovac <[email protected]>
Date:   Sat, 7 Jan 2023 04:40:20 +0100 (CET)
Quoted 18 lines

From: Mirsad Goran Todorovac <[email protected]>

Adjust size parameter in connect() to match the type of the parameter, to fix "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).
Quoted 10 lines
Cc "David S. Miller" <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Kuniyuki Iwashima <[email protected]>
Cc Florian Westphal <[email protected]>
Fixes 314001f0bf92 ("af_unix: Add OOB support")
Quoted 4 lines

You can check the current status here.
https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/

Thank you very much for your time on this, Koniyuki, Jakub.

Quoted 1 line

PS: you may want to check config not to send a mail as multipart next time.

Done! Thanks for the hint. This should work:

[ Sending Preferences ]

      [X]  Do Not Generate Sender Header
      [ ]  Use Sender Instead of X-X-Sender
      [X]  Do Not Send Flowed Text
      [X]  Downgrade Multipart to Text

Maybe add this to Documentation/process/email-clients.rst, section Alpine? It could save some round-trips ...

Thanks,
Mirsad

Signature · 9 lines
Mirsad Todorovac
System engineer
Faculty of Graphic Arts | Academy of Fine Arts
University of Zagreb
Republic of Croatia, the European Union
--
Sistem inženjer
Grafički fakultet | Akademija likovnih umjetnosti
Sveučilište u Zagrebu
#12 lore raw

Re: [PATCH net v4] af_unix: selftest: Fix the size of the parameter to connect()

In reply to Mirsad Goran Todorovac
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:

Quoted 11 lines · On Sat, 7 Jan 2023 04:40:20 +0100 (CET) you wrote:

From: Mirsad Goran Todorovac <[email protected]>

Adjust size parameter in connect() to match the type of the parameter, to fix "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.

[...]

Here is the summary with links:
- [net,v4] af_unix: selftest: Fix the size of the parameter to connect()

    https://git.kernel.org/netdev/net/c/7d6ceeb1875c

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#13 lore raw

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

In reply to Jakub Kicinski
Quoted 7 lines · Jakub Kicinski
Quoted 5 lines · On Sat, 7 Jan 2023 02:42:43 +0100 Mirsad Goran Todorovac wrote:
Quoted 1 line

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.

Quoted 5 lines

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

Signature · 9 lines
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