From patchwork Sat Jan 7 03:40:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mirsad Todorovac X-Patchwork-Id: 40307 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1146698wrt; Fri, 6 Jan 2023 19:50:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXsZwmU6RSF4mdGVw+9ekQsNasof31bAf8s/WW9/B1Y4wZHcyoCHHTatXb+qEt6tzrferymE X-Received: by 2002:a05:6a20:4e10:b0:aa:4010:8886 with SMTP id gk16-20020a056a204e1000b000aa40108886mr64313822pzb.1.1673063440240; Fri, 06 Jan 2023 19:50:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673063440; cv=none; d=google.com; s=arc-20160816; b=FF0a/75/NDlMLuZ9kQUKo7SAK859V0ZJ4npiPHrWQeRhRTJ7OdGUViTwkzActOtgj3 bieLVpnFHpQTAKBau0Aef3ny6FMKIpRqU1WdHwOUAHoRYwg169M7Q86Gr9/twJCP1dFZ bCmbrc9lUvb0SjAGeQ+AXD33Wyd3QQDZVM3mciC1cJ+U/qATqj3LUigA5+R0ouuVWMuD bufSqx0CmYo5VnSgsgITPul1wcmhtYn+eBYrBobB72F0oMGyUzlRh/wM2U3lvYswFf/i AHuCKgsW8YIGb5OyYt+WbJnQ6QQjgGyDvxilIfnNGiw0/KRA+WKBBdbPvkJMvQj3d+B/ MSnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature:dkim-signature; bh=RYzen5uUJVmFq0YTEfMERrlCGthoCMjDXwhl/Yw+ioM=; b=nVHjL7fi2/9bj4KeA/9hITvnyzDajPnyk9r744Zf0NWyE/pUYEQ26JBHBtganOTTH+ 6igNEebZsN3hlJbca+vR03+/DO/sY/zb1ori/CcN2NzapBl+IVTRM+oLgm0JiUGYnwmi sIPV8dVgE1ColsY0iE11EFkdxAQL7RX66XjY6xVkEwWTDJilY90wVBHNc5DEmdhpaWE4 V6qt/dJHYUGXAGQdCdsBNehvRe04+r0gmKD7VrbBB1qBSwAR8Qk/ufYi+7IxWQYYiYFf kKzx4areZRSC2hLJ/ut6/+u1o11Q+ONhdzUW0ounutR1WJrmlGf7inwIsYTyoOzbcTub cBQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@alu.hr header.s=mail header.b=fcu4Hcuz; dkim=fail header.i=@alu.hr header.s=mail header.b=Byfgq7kO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=alu.hr Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n64-20020a632743000000b004aebc6eac92si489253pgn.467.2023.01.06.19.50.25; Fri, 06 Jan 2023 19:50:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@alu.hr header.s=mail header.b=fcu4Hcuz; dkim=fail header.i=@alu.hr header.s=mail header.b=Byfgq7kO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=alu.hr Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236716AbjAGDki (ORCPT + 99 others); Fri, 6 Jan 2023 22:40:38 -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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754302706877916596?= X-GMAIL-MSGID: =?utf-8?q?1754334169902781721?= 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 Reviewed-by: Kuniyuki Iwashima --- 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(-) -- 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 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);