From patchwork Fri Jan 6 19:28:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mirsad Todorovac X-Patchwork-Id: 40231 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp990593wrt; Fri, 6 Jan 2023 11:30:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXuWwjEx6hFWIkTiWzhjON/5fbdHrrnk/D8n/K2qKxpCQmdMwRCoptz+iLnXdj8YZPSrs1lh X-Received: by 2002:a17:906:e98:b0:7c1:39e:db7e with SMTP id p24-20020a1709060e9800b007c1039edb7emr62116253ejf.59.1673033434785; Fri, 06 Jan 2023 11:30:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673033434; cv=none; d=google.com; s=arc-20160816; b=f9ofJMQEMyMr/DTNlQ/YD+flOi3/5w9h/S5uBlQKIemrKuxjRa2P+ZVGsKwbYzVG2g JEQKImmee2PeDg96o41dO8tEea9zfl5kmsL7UadConj8EYV2UVed5FaIJC9WuZPehR2S fysm+muS5Sq5BqVELYhxT/mTPmtyRRlX6d/yWG+PJTwBLa6x028ZGzw18vV8ERZj+g3O y0MKICYucNSiF0Zys5QzBGmHlszfLFLb8nfzSZOE7kJbbW/lV2J5IHWjN3X+rWHHI/x0 AjYRpvbDwv8x0nV3c+fxm1npj53L/ikgSjZP+LygmaPoxdLyNQJh/bqpUxmRdlL8nzPa hJ0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=zQVjPYgW+yEmbkMg4S5wXHiLOfC5HANRIpbsOQesxNk=; b=vdIsuxGeCmSGQ/89v03RV9Tz69SflgWjeQUN0xI3aDUEoRP3BgdJIR/ZgxQ8TUm/DV 9GtLZynzKRNv+43yd4+f7xU5soHw/AjumlMHzkJ1i3FYp1dYt1yplWFxEDxpkvNBT6ND B0p3F+K+K0aCtqpErzSgpoHY0zNxKT7aQSsL7EL7T4JStCFVGHjGS6+zcSw3LUdGmoaM 80jN9cC/X2QS7YpH4hXSqseT2Wo/btvDAuTQPpRJcblHgIsJRhz3RoMDei0ifJI36nLN VuBtEOprv5Xzs00L4guk6T/uz05bomnQl8LU9ssGqJcIXygRhRvmdKnscnKWLcLfMNnn Kpsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=Ety5o8ha; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=BiwEXruc; 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=NONE sp=NONE dis=NONE) header.from=alu.unizg.hr Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d11-20020a50c88b000000b0048b6bca0c4bsi1988820edh.565.2023.01.06.11.30.11; Fri, 06 Jan 2023 11:30:34 -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.unizg.hr header.s=mail header.b=Ety5o8ha; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=BiwEXruc; 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=NONE sp=NONE dis=NONE) header.from=alu.unizg.hr Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231620AbjAFT2l (ORCPT + 99 others); Fri, 6 Jan 2023 14:28:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229752AbjAFT2i (ORCPT ); Fri, 6 Jan 2023 14:28:38 -0500 Received: from domac.alu.hr (domac.alu.unizg.hr [161.53.235.3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12E1526DB; Fri, 6 Jan 2023 11:28:38 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by domac.alu.hr (Postfix) with ESMTP id EDEC8604F1; Fri, 6 Jan 2023 20:28:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=alu.unizg.hr; s=mail; t=1673033316; bh=pkj5eZw69uhq7PAkgnV5pcK3+tC4Sfkn0s8g4WltJmE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Ety5o8haNBbW+RifhVPXyGmX2hKK0NB9ij6NSjaYRlDf963W7LAMpuDY76eIHX3R6 6ifhVI/YLsLwCd9JEHsaEj9wLhQ0kKMQVldaWgm9vMTvtS0k8oEQUbJqYJbMi8xkhe dsj1yvyfLv+vokrfitytxvkT3hxn9Wz4go557KoWGYOCG08iKtp/XXF9nCMThfEV1D RmibZb6tCYtzZCSa2Wp4tHEeNfKTv2O9wt/w3Qhlr+0nCbbr8muW4yzPV9gdKpY7qQ /9v5UmJRHq2TEF9QlsrEb2CterbHByfUHRdah/I/OPd0X6Jxf8RD8gchJGlsY556UP 8XidSd52AkF/g== 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 AJhsjG6nCrlb; Fri, 6 Jan 2023 20:28:33 +0100 (CET) Received: from [192.168.0.12] (unknown [188.252.196.35]) by domac.alu.hr (Postfix) with ESMTPSA id 54E68604F0; Fri, 6 Jan 2023 20:28:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=alu.unizg.hr; s=mail; t=1673033313; bh=pkj5eZw69uhq7PAkgnV5pcK3+tC4Sfkn0s8g4WltJmE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=BiwEXrucVJK+nf2UqsmGK7gOM/32OtlZRBNXHFc5VLOrCriwerp0hpnQ/z3EAiG/x rLOZ54sy0I1pwCQVFwBbj7VELIAwzEwkMyWSfjKx+orIIQjhXzhUWW7qbxwESZrKZv Saj7U57INZf/bCirAZ4LNlB2v2RYJ4SCWi5sr3IuMGBZzT5yqOjo2Zcc3MCmw5zquV B9+O3YHSGcL/xFFMi/qpRJaQYMqqkYSBkb4pgr1SrUnXkszVKE5+/r5rPVQ7r/dZ5q IfNbIthiBpRi7NWtbyr7OQ80qQK4yOwwjRMRq8FFQ1uOUitXgsYjmPBba3mcgis96A 20ti8+lmS7ylw== Message-ID: Date: Fri, 6 Jan 2023 20:28:33 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: [PATCH net v2] af_unix: selftest: Fix the size of the parameter to connect() Content-Language: en-US, hr To: Kuniyuki Iwashima Cc: davem@davemloft.net, edumazet@google.com, fw@strlen.de, kuba@kernel.org, kuniyu@amazon.co.jp, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, shuah@kernel.org References: <20230106175828.13333-1-kuniyu@amazon.com> From: Mirsad Goran Todorovac In-Reply-To: <20230106175828.13333-1-kuniyu@amazon.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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?1754302706877916596?= From: Mirsad Goran Todorovac 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 ] 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" 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 --- 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 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);