From patchwork Sat Apr 15 16:59:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ammar Faizi X-Patchwork-Id: 13212585 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 B200CC77B73 for ; Sat, 15 Apr 2023 16:59:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230021AbjDOQ73 (ORCPT ); Sat, 15 Apr 2023 12:59:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229989AbjDOQ72 (ORCPT ); Sat, 15 Apr 2023 12:59:28 -0400 Received: from gnuweeb.org (gnuweeb.org [51.81.211.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C50FD3C25; Sat, 15 Apr 2023 09:59:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1681577957; bh=QWY+Zl3F1B+NIqLmMETedIlIuKxQpaMYeUw+n9XJjn4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=VPmETBGuOfeU9HhDCmto5vPxpe3Q4+4tGX8NGPX1t+hlE8aGInj9W0c4RjyVnH5qf 6PG6z0Ln1PBof0KPRRbHYA7b9lOS5ovz6loK1t4ddKrcVXbL21VJ78gNs65fKKvu5Y VAQST6SDa+Ha1oUqG6nS+NlpnCHl9a8jqD3yFKykIQJb0RzoKgSRX55ETo15KNH2Ba HjyLIAqPquXL7fqEJBOalaewLLnkb0Hec+ca5K+E3ULG9NYA9EcXz6oz352GEcQhIp lk+5MTMRAOzz5CoMSQrEjDtLdytmcdS+E3d/e6TTRZv8kTrs1Vbe+cXKcgBp88wXA3 h1UfZ8SNB52Pg== Received: from localhost.localdomain (unknown [182.253.88.211]) by gnuweeb.org (Postfix) with ESMTPSA id AF4F324552A; Sat, 15 Apr 2023 23:59:14 +0700 (WIB) From: Ammar Faizi To: Jens Axboe Cc: Ammar Faizi , Pavel Begunkov , Alviro Iskandar Setiawan , io-uring Mailing List , Linux Kernel Mailing List , GNU/Weeb Mailing List Subject: [PATCH liburing 1/3] io_uring-udp: Fix the wrong IPv6 binary to string conversion Date: Sat, 15 Apr 2023 23:59:02 +0700 Message-Id: <20230415165904.791841-2-ammarfaizi2@gnuweeb.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230415165904.791841-1-ammarfaizi2@gnuweeb.org> References: <20230415165904.791841-1-ammarfaizi2@gnuweeb.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Another io_uring-udp fix. The verbose output shows the wrong address when using IPv6. When the address family is AF_INET6, the pointer should be cast to 'struct sockaddr_in6', not 'struct sockaddr_in'. While in there, also add a square bracket around the IP address to easily read the port number, especially for IPv6. Before this patch: port bound to 49567 received 4 bytes 28 from ::2400:6180:0:d1:0:0:47048 received 4 bytes 28 from ::2400:6180:0:d1:0:0:54755 received 4 bytes 28 from ::2400:6180:0:d1:0:0:57968 (the IPv6 address is wrong) After this patch: port bound to 48033 received 4 bytes 28 from [2400:6180:0:d1::6a4:a00f]:40456 received 4 bytes 28 from [2400:6180:0:d1::6a4:a00f]:50306 received 4 bytes 28 from [2400:6180:0:d1::6a4:a00f]:52291 Link: https://github.com/axboe/liburing/issues/814#issuecomment-1458862489 Fixes: https://github.com/axboe/liburing/issues/814 Fixes: 61d472b51e761e61c ("add an example for a UDP server") Signed-off-by: Ammar Faizi --- examples/io_uring-udp.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/examples/io_uring-udp.c b/examples/io_uring-udp.c index b81a5e7c47afd9c8..4697af171ba68999 100644 --- a/examples/io_uring-udp.c +++ b/examples/io_uring-udp.c @@ -271,14 +271,22 @@ static int process_cqe_recv(struct ctx *ctx, struct io_uring_cqe *cqe, } if (ctx->verbose) { + struct sockaddr_in *addr = io_uring_recvmsg_name(o); + struct sockaddr_in6 *addr6 = (void *)addr; char buff[INET6_ADDRSTRLEN + 1]; const char *name; - struct sockaddr_in *addr = io_uring_recvmsg_name(o); + void *paddr; - name = inet_ntop(ctx->af, &addr->sin_addr, buff, sizeof(buff)); + if (ctx->af == AF_INET6) + paddr = &addr6->sin6_addr; + else + paddr = &addr->sin_addr; + + name = inet_ntop(ctx->af, paddr, buff, sizeof(buff)); if (!name) name = ""; - fprintf(stderr, "received %u bytes %d from %s:%d\n", + + fprintf(stderr, "received %u bytes %d from [%s]:%d\n", io_uring_recvmsg_payload_length(o, cqe->res, &ctx->msg), o->namelen, name, (int)ntohs(addr->sin_port)); } From patchwork Sat Apr 15 16:59:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ammar Faizi X-Patchwork-Id: 13212586 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 E3FEEC77B70 for ; Sat, 15 Apr 2023 16:59:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230091AbjDOQ7a (ORCPT ); Sat, 15 Apr 2023 12:59:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230083AbjDOQ73 (ORCPT ); Sat, 15 Apr 2023 12:59:29 -0400 Received: from gnuweeb.org (gnuweeb.org [51.81.211.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 949874687; Sat, 15 Apr 2023 09:59:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1681577961; bh=x9aEcwLXXFbA5oEs9XXulDcubT9b5lxVpZJrOB80OIc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=E1S9V12Ki287O1DLY0Y2FnblJbzb2Jlh5E1O0R7aGriIBDxR4G9NzL03mUxOQstOa j9KSdK3kJW54L4yz7nyKagtnwU15NdVZQl8BJp9jILlhUGMe3F0A14PobebnqqX+6F zov6InZv7xd0N1nvmGiYXk/hVPgx32cxDWiXhryEydQCeMZRzjg1T9CLVlQIaCg6Hj ga1/DgtbgJMTPPJVnCbnU2uVzkDNeD8y+M1x54vPNofvgsxqcoJifBPLBWpKY894SE bhDi5G1d+Kgo2+/vO0tCLGQe1R61zsvfchkOi+HG6FC6u71KBPnLKpZUL40N6uqJC2 0JjK0zmH6znaA== Received: from localhost.localdomain (unknown [182.253.88.211]) by gnuweeb.org (Postfix) with ESMTPSA id 22C6824552E; Sat, 15 Apr 2023 23:59:17 +0700 (WIB) From: Ammar Faizi To: Jens Axboe Cc: Alviro Iskandar Setiawan , Pavel Begunkov , io-uring Mailing List , Linux Kernel Mailing List , GNU/Weeb Mailing List , Linux Parisc Mailing List , Ammar Faizi Subject: [PATCH liburing 2/3] github: Add hppa cross compiler Date: Sat, 15 Apr 2023 23:59:03 +0700 Message-Id: <20230415165904.791841-3-ammarfaizi2@gnuweeb.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230415165904.791841-1-ammarfaizi2@gnuweeb.org> References: <20230415165904.791841-1-ammarfaizi2@gnuweeb.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org From: Alviro Iskandar Setiawan Since commit 9c6689848ebf ("Default to mmap'ed provided buffers for hppa"), the core library has hppa specific code. Add hppa cross compiler on the GitHub bot CI to catch build breakage for this arch. Cc: Linux Parisc Mailing List Signed-off-by: Alviro Iskandar Setiawan Co-authored-by: Ammar Faizi Signed-off-by: Ammar Faizi --- .github/workflows/build.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fed5b38c3a507336..8dd22dfd125692de 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -85,6 +85,13 @@ jobs: cc: mips-linux-gnu-gcc cxx: mips-linux-gnu-g++ + # hppa + - arch: hppa + cc_pkg: gcc-hppa-linux-gnu + cxx_pkg: g++-hppa-linux-gnu + cc: hppa-linux-gnu-gcc + cxx: hppa-linux-gnu-g++ + env: FLAGS: -g -O3 -Wall -Wextra -Werror -Wno-sign-compare ${{matrix.extra_flags}} From patchwork Sat Apr 15 16:59:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ammar Faizi X-Patchwork-Id: 13212587 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 25B7FC7619A for ; Sat, 15 Apr 2023 16:59:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230117AbjDOQ7d (ORCPT ); Sat, 15 Apr 2023 12:59:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230099AbjDOQ7b (ORCPT ); Sat, 15 Apr 2023 12:59:31 -0400 Received: from gnuweeb.org (gnuweeb.org [51.81.211.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF6B42D73; Sat, 15 Apr 2023 09:59:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1681577964; bh=1HH1sIzyttjvQASCsqW0jgwLWUwEbTPpuWqZnbijq/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=qb2BIxW8QpC8r13B8e90DEP8nr0o+UZXO29J6oTUidco+3YRU9XxxtwVOsyn7mBVM mQl3HD/B0jh4lmIydIJyHsiNkDt3OKiPI3S+r+KrIV1211PraAZ+gORvTLXbUOnFoQ 6og34vaFtvVSgUPZNoYxphrQdFuxKK+EsgUTkAvViqkdj06BMbjIkC71BYIRlaBF8b Nqt4RDHo7OT9CB5rU7wQ5barDHeTu695P0I5NXM2W0zSI8+m5Q3s/bxDkqVLOx6VEd 3G2BxQyejemTIzzmlHzMYvLGwTPojnf3DxdPLH/rQ7slxsWh8WtsS7UZaxn+zb9e53 KFcnHtQwMm1WQ== Received: from localhost.localdomain (unknown [182.253.88.211]) by gnuweeb.org (Postfix) with ESMTPSA id D47ED245532; Sat, 15 Apr 2023 23:59:21 +0700 (WIB) From: Ammar Faizi To: Jens Axboe Cc: Ammar Faizi , Pavel Begunkov , Alviro Iskandar Setiawan , io-uring Mailing List , Linux Kernel Mailing List , GNU/Weeb Mailing List Subject: [PATCH liburing 3/3] man/io_uring_cqe_get_data.3: Fix a misleading return value Date: Sat, 15 Apr 2023 23:59:04 +0700 Message-Id: <20230415165904.791841-4-ammarfaizi2@gnuweeb.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230415165904.791841-1-ammarfaizi2@gnuweeb.org> References: <20230415165904.791841-1-ammarfaizi2@gnuweeb.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Since commit 8ecd3fd959634df8 ("Don't clear sqe->user_data as part of command prep"), the prep functions no longer zero the user data. If the user_data is not set, it will contain whatever previous value in it. Therefore, the returned value when the user_data is-not-set is not always NULL. And oh, someone once hit an issue because they assume the return value is NULL if the user_data is not set. See the link below. Fix the manpage, tell that the return value will be undefined. Link: https://github.com/axboe/liburing/issues/575#issuecomment-1110516140 Signed-off-by: Ammar Faizi --- man/io_uring_cqe_get_data.3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/io_uring_cqe_get_data.3 b/man/io_uring_cqe_get_data.3 index 4cbb32cd864e12c2..a4d2988a49d92aa8 100644 --- a/man/io_uring_cqe_get_data.3 +++ b/man/io_uring_cqe_get_data.3 @@ -46,7 +46,7 @@ or If the .I user_data value has been set before submitting the request, it will be returned. -Otherwise the functions returns NULL. +Otherwise, the return value is undefined. .SH SEE ALSO .BR io_uring_get_sqe (3), .BR io_uring_sqe_set_data (3),