From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D243C54EBE for ; Sat, 7 Jan 2023 03:40:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236794AbjAGDk2 (ORCPT ); Fri, 6 Jan 2023 22:40:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236776AbjAGDk0 (ORCPT ); Fri, 6 Jan 2023 22:40:26 -0500 Received: from domac.alu.hr (domac.alu.unizg.hr [161.53.235.3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AACA18D5C8; Fri, 6 Jan 2023 19:40:24 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by domac.alu.hr (Postfix) with ESMTP id 43B47604F1; Sat, 7 Jan 2023 04:40:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=alu.hr; s=mail; t=1673062823; bh=j01mQb8I5u689YuQw+ChwSxg7IB7KBCJmP6hGzSe+so=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=fcu4HcuzuZ/P9jRH6RNpZubOP0xy9Tqn4dSo6j3CGQxmFZGhjfQG+Mys9uGCWCBKm DJ3c5FaRZ/EbntEbtvzYQW2PTdtLUtDko9Vz0/x/crn5Fwepklv3JyyF4C/+L4UZXI CseqPJig+KY5aAMgg+eQaDFIvEta/MJNLMyeDEsRNX1r16KTZJPj9UiTvwFmVtUwf/ 4WnucXvoS0K+/HthKcQ+jmop+lK7NWPdlJF+54CpbGndAM5xmPjk46Bb1kmA/mEgKl XninS0jUdwYpuYlTZxA0DHd1dbMa2RObEIFDihr4vYKb/py8UchrMDUdyhu03fPJri bBuy1yVAs6YeQ== X-Virus-Scanned: Debian amavisd-new at domac.alu.hr Received: from domac.alu.hr ([127.0.0.1]) by localhost (domac.alu.hr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UgvktLthh6J8; Sat, 7 Jan 2023 04:40:20 +0100 (CET) Received: by domac.alu.hr (Postfix, from userid 1014) id AB762604F2; Sat, 7 Jan 2023 04:40:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=alu.hr; s=mail; t=1673062820; bh=j01mQb8I5u689YuQw+ChwSxg7IB7KBCJmP6hGzSe+so=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=Byfgq7kO0qX1Vp0niERdxBYNDVVrBuM1JUY1zAaDnpV7uFjrb3E4+eeTJC1e/FaaS I3Nnk0lqf+oV7rcFMYzeiPX+rkQwcwos2p9HGhpGUPz7l73/BhawOFKxVXVnisQeqj nYT+5H8Js9zUElqI/sZhpWk7kHe/6ec5O0RlC4jw8MrzMt5a0HCZc67leIYxbAEx8v B6/VPQ+6YaOw+ui2NxisGHBesc2GM9KTteqwzPYRiVXEiWU8/VPxWQmPlsJ0oUlVf7 NZYZFBqlf6nwJ+8GJRANkR6/O1Y/Ef14KqMsEryghQrP4NyqSyaawOOuEX3w+jFX65 cujLnUJ3hy72w== Received: from localhost (localhost [127.0.0.1]) by domac.alu.hr (Postfix) with ESMTP id A612E604F1; Sat, 7 Jan 2023 04:40:20 +0100 (CET) Date: Sat, 7 Jan 2023 04:40:20 +0100 (CET) From: Mirsad Goran Todorovac To: Jakub Kicinski , Mirsad Goran Todorovac cc: Kuniyuki Iwashima , davem@davemloft.net, edumazet@google.com, fw@strlen.de, kuniyu@amazon.co.jp, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, shuah@kernel.org Subject: [PATCH net v4] af_unix: selftest: Fix the size of the parameter to connect() In-Reply-To: <20230106180808.51550e82@kernel.org> Message-ID: References: <20230106175828.13333-1-kuniyu@amazon.com> <20230106161450.1d5579bf@kernel.org> <8fb1a2c5-ee35-67eb-ef3c-e2673061850d@alu.unizg.hr> <20230106180808.51550e82@kernel.org> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="899744747-660964784-1673062820=:26826" Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --899744747-660964784-1673062820=:26826 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT From: Mirsad Goran Todorovac 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 ] 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" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: Shuah Khan Cc: Kuniyuki Iwashima Cc: Florian Westphal Reviewed-by: Florian Westphal Fixes: 314001f0bf92 ("af_unix: Add OOB support") Signed-off-by: Mirsad Goran Todorovac --- 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(-) 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); 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 --899744747-660964784-1673062820=:26826--