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 E943BC54EBC for ; Mon, 9 Jan 2023 01:15:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233712AbjAIBPj (ORCPT ); Sun, 8 Jan 2023 20:15:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230219AbjAIBPg (ORCPT ); Sun, 8 Jan 2023 20:15:36 -0500 Received: from smtp-fw-6001.amazon.com (smtp-fw-6001.amazon.com [52.95.48.154]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD31A9FC3; Sun, 8 Jan 2023 17:15:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1673226936; x=1704762936; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Tzdk/KaJxyH01KkCF6YkesSdqVT3pEjQXiFVNSArzuQ=; b=IAeNi3FjCMe5/kplEn2adbJZ407IGhaLHRlzbKuuY7ovP9kTp5KSCVXH slIdVQfIHt4cJi1oCWSDLQBo7Pcpslgfbwwz+s6vxGVV00Bep/2qYcwH4 69N6Q8plLVtIZbZH1GFY9D5H4yuDJDMQeDihRp1deABwgqdGcISo/RN3A U=; X-IronPort-AV: E=Sophos;i="5.96,311,1665446400"; d="scan'208";a="286283629" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-iad-1a-m6i4x-bbc6e425.us-east-1.amazon.com) ([10.43.8.2]) by smtp-border-fw-6001.iad6.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2023 01:15:33 +0000 Received: from EX13MTAUWB002.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan3.iad.amazon.com [10.40.163.38]) by email-inbound-relay-iad-1a-m6i4x-bbc6e425.us-east-1.amazon.com (Postfix) with ESMTPS id 9506881178; Mon, 9 Jan 2023 01:15:29 +0000 (UTC) Received: from EX19D004ANA001.ant.amazon.com (10.37.240.138) by EX13MTAUWB002.ant.amazon.com (10.43.161.202) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Mon, 9 Jan 2023 01:15:28 +0000 Received: from 88665a182662.ant.amazon.com (10.43.160.120) by EX19D004ANA001.ant.amazon.com (10.37.240.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1118.7; Mon, 9 Jan 2023 01:15:24 +0000 From: Kuniyuki Iwashima To: CC: , , , , , , , , , , , Subject: Re: [PATCH net v4] af_unix: selftest: Fix the size of the parameter to connect() Date: Mon, 9 Jan 2023 10:15:12 +0900 Message-ID: <20230109011512.15267-1-kuniyu@amazon.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.43.160.120] X-ClientProxiedBy: EX13D34UWA004.ant.amazon.com (10.43.160.177) To EX19D004ANA001.ant.amazon.com (10.37.240.138) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mirsad Goran Todorovac Date: Sat, 7 Jan 2023 04:40:20 +0100 (CET) > 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 You can check the current status here. https://patchwork.kernel.org/project/netdevbpf/patch/alpine.DEB.2.21.2301070437400.26826@domac.alu.hr/ PS: you may want to check config not to send a mail as multipart next time. Thank you, Kuniyuki > --- > > 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