From nobody Tue Oct 7 01:58:30 2025 Received: from server-vie001.gnuweeb.org (server-vie001.gnuweeb.org [89.58.62.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 807C9136358; Wed, 16 Jul 2025 00:44:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.58.62.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752626653; cv=none; b=hiliZNIq4TjmoDg2Y87IKLUDb2CfCe2TQWQzoGeuwyFq3lCOqDTHbEAoCe2Q4oD5XJ3nE8w4av7G6o/LETUvD/HmTqgrMVdZB2srLxlFN82Jk1+pmWni8OmVSvj5PhTuwvekErmLeVAIZK+BdVjizs65azNuNnTydGh2NtP/edI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752626653; c=relaxed/simple; bh=qXPJQIFiRfArJHI2hJxIyZic9JZJqME6xG9/pMC8ThU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=L6J0nljL8sCrVutdDQXv7fgV2wsCgtldDcIn7kdjeq3i2GV8C00peQj3NoVeH8Xp7z4MnV5nlquAPRFqwDkHe1ySex73IIWOPEga7Kkc0AqfEmYHiiqZFOhc+xnxMVITaPC9k4BMbAYUboD9aqe1P58a7UJg3a5qqs4dvio607w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=gnuweeb.org; spf=pass smtp.mailfrom=gnuweeb.org; dkim=pass (2048-bit key) header.d=gnuweeb.org header.i=@gnuweeb.org header.b=RjED+O0s; arc=none smtp.client-ip=89.58.62.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=gnuweeb.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gnuweeb.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gnuweeb.org header.i=@gnuweeb.org header.b="RjED+O0s" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1752626649; bh=qXPJQIFiRfArJHI2hJxIyZic9JZJqME6xG9/pMC8ThU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Message-ID:Date:From: Reply-To:Subject:To:Cc:In-Reply-To:References:Resent-Date: Resent-From:Resent-To:Resent-Cc:User-Agent:Content-Type: Content-Transfer-Encoding; b=RjED+O0siu7WCt2PBzBZ1GMardXfqmI+Vts0SpGVckygqHgOMzalWSTkk9IE+C65r TmZvfq3M9ydn5jRskQ3PzY3rNNsCZQnpLHaVJLxbKmF3UVZz+BazoXDXhn5lNlHjJr 4GWQRGhxAwrga6FDxv+y1ThDoU1oGoGCDs5nHnOk7g9X+I8zlcTSI/S6VdvS+30zs/ eAcRagUNVu1ywPkgdlO/G/fh9z3+MLQPssUuIayyc8eM1CSS2Yw+fGjWCT0UUs6ecx GKvKcOBn42dk3QHAjSGYQvM3dH+vUQAyVv4BBle2iI//ghdbbLwID2F6dgIg2AKbP1 1opDovSSIz9Mw== Received: from localhost.localdomain (unknown [68.183.184.174]) by server-vie001.gnuweeb.org (Postfix) with ESMTPSA id 24DA02109A7C; Wed, 16 Jul 2025 00:44:07 +0000 (UTC) From: Alviro Iskandar Setiawan To: Jens Axboe Cc: Alviro Iskandar Setiawan , Ammar Faizi , GNU/Weeb Mailing List , Linux Kernel Mailing List , io-uring Mailing List Subject: [PATCH liburing v2 1/3] Bring back `CONFIG_HAVE_MEMFD_CREATE` to fix Android build error X-Gw-Bpl: wU/cy49Bu1yAPm0bW2qiliFUIEVf+EkEatAboK6pk2H2LSy2bfWlPAiP3YIeQ5aElNkQEhTV9Q== Date: Wed, 16 Jul 2025 07:44:00 +0700 Message-Id: <20250716004402.3902648-2-alviro.iskandar@gnuweeb.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250716004402.3902648-1-alviro.iskandar@gnuweeb.org> References: <20250716004402.3902648-1-alviro.iskandar@gnuweeb.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This partially reverts commit: 732bf609b670 ("test/io_uring_register: kill old memfd test") Bring back `CONFIG_HAVE_MEMFD_CREATE` to resolve Android build failures caused by: 93d3a7a70b4a ("examples/zcrx: udmabuf backed areas") It added a call to `memfd_create()`, which is unavailable on some Android toolchains, leading to the following build error: ``` zcrx.c:111:10: error: call to undeclared function 'memfd_create'; ISO C99= and \ later do not support implicit function declarations \ [-Wimplicit-function-declaration] 111 | memfd =3D memfd_create("udmabuf-test", MFD_ALLOW_SEALING); | ^ ``` This reversion is a preparation patch for a proper fix by ensuring `memfd_create()` usage is guarded and portable. It's only a partial revert because the test itself is not restored. v1 -> v2: - Omit the old memfd test because it's not needed anymore. Link: https://lore.kernel.org/io-uring/4bc75566-9cb5-42ec-a6b7-16e04062= e0c6@kernel.dk Co-authored-by: Ammar Faizi Signed-off-by: Ammar Faizi Signed-off-by: Alviro Iskandar Setiawan --- configure | 19 +++++++++++++++++++ test/io_uring_register.c | 11 +++++++++++ 2 files changed, 30 insertions(+) diff --git a/configure b/configure index 552f8ae..3c95214 100755 --- a/configure +++ b/configure @@ -379,6 +379,22 @@ if compile_prog "" "" "has_ucontext"; then fi print_config "has_ucontext" "$has_ucontext" =20 +########################################## +# check for memfd_create(2) +has_memfd_create=3D"no" +cat > $TMPC << EOF +#include +int main(int argc, char **argv) +{ + int memfd =3D memfd_create("test", 0); + return 0; +} +EOF +if compile_prog "-Werror=3Dimplicit-function-declaration" "" "has_memfd_cr= eate"; then + has_memfd_create=3D"yes" +fi +print_config "has_memfd_create" "$has_memfd_create" + ########################################## # Check NVME_URING_CMD support nvme_uring_cmd=3D"no" @@ -539,6 +555,9 @@ fi if test "$array_bounds" =3D "yes"; then output_sym "CONFIG_HAVE_ARRAY_BOUNDS" fi +if test "$has_memfd_create" =3D "yes"; then + output_sym "CONFIG_HAVE_MEMFD_CREATE" +fi if test "$nvme_uring_cmd" =3D "yes"; then output_sym "CONFIG_HAVE_NVME_URING" fi diff --git a/test/io_uring_register.c b/test/io_uring_register.c index b53a67d..405a812 100644 --- a/test/io_uring_register.c +++ b/test/io_uring_register.c @@ -32,6 +32,17 @@ static int pagesize; static rlim_t mlock_limit; static int devnull; =20 +#if !defined(CONFIG_HAVE_MEMFD_CREATE) +#include +#include + +int memfd_create(const char *name, unsigned int flags) +{ + return (int)syscall(SYS_memfd_create, name, flags); +} +#endif + + static int expect_fail(int fd, unsigned int opcode, void *arg, unsigned int nr_args, int error, int error2) { --=20 Alviro Iskandar Setiawan From nobody Tue Oct 7 01:58:30 2025 Received: from server-vie001.gnuweeb.org (server-vie001.gnuweeb.org [89.58.62.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E002517A31B; Wed, 16 Jul 2025 00:44:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.58.62.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752626655; cv=none; b=iInUP4l/KMVnzpXAfHWxfGsnhnCYqmEpD414QNuxg7YuQ4DpUUuGrZyYQmjSmhBWmUPWoJ+u22qzp6Bu4fMbNVKr6FNd+OmOHbIGjGhSoNJjCW6zCv8FRQs8KWQgbkUPlb1DWlUn2DD7h96VXkE0plGUFWx5HU+52RbKu/lgiVM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752626655; c=relaxed/simple; bh=3DOqD1KPdUGm7DrqjlCi+p1ytymuiTFbmOFk0unuYtw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TPPSDNqGEBPEuoLxlcz3Sf2BeBNm2ENlyHw3TLAqHIH0xz685mL9zVNqy9TCy1b7t4qPXjosHzBkJB4/mY+yP20mI2j3Z3m2qarqw2Oamho3S5bwVJ3rEPCOGuwhP7jwFGwSu/NSjomsCqlQ37CIcZfq2NtRZpKCLfPWhR3EiTw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=gnuweeb.org; spf=pass smtp.mailfrom=gnuweeb.org; dkim=pass (2048-bit key) header.d=gnuweeb.org header.i=@gnuweeb.org header.b=mm/semdS; arc=none smtp.client-ip=89.58.62.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=gnuweeb.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gnuweeb.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gnuweeb.org header.i=@gnuweeb.org header.b="mm/semdS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1752626651; bh=3DOqD1KPdUGm7DrqjlCi+p1ytymuiTFbmOFk0unuYtw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Message-ID:Date:From: Reply-To:Subject:To:Cc:In-Reply-To:References:Resent-Date: Resent-From:Resent-To:Resent-Cc:User-Agent:Content-Type: Content-Transfer-Encoding; b=mm/semdSH3Gw7+cJMStOt7o4emCCrFGel5zLaoPHn2YfBiwExR4EWzyyJdIi+tgx2 Qqd3NY2z/uSOPbFuidQw+k86onCC/hgkJF2G/+r7y08BO85kCi2qwgE3bRJejiuQfe Uk21vrrRa1Q42/PyTZEYJMqUw3PKebT2HFF1NLXecm1lIrOPkELf19mv7pDAp01pDr s2q6OL4kt/bHeXBlLNlumo3bZA8JF8kwV7pfQN7pm0QpeeoJ4cwKdeSRsm9uZKZF+d OF8elliCxMmxzQOPvAVvy2Ahq7O2/t+L04t3eC/nvIY1Sezdl3cSqUdNc8LB+pAGYp J+BMqgUkmXfKA== Received: from localhost.localdomain (unknown [68.183.184.174]) by server-vie001.gnuweeb.org (Postfix) with ESMTPSA id 4033D2109A7D; Wed, 16 Jul 2025 00:44:10 +0000 (UTC) From: Alviro Iskandar Setiawan To: Jens Axboe Cc: Alviro Iskandar Setiawan , Ammar Faizi , GNU/Weeb Mailing List , Linux Kernel Mailing List , io-uring Mailing List Subject: [PATCH liburing v2 2/3] test: Move `memfd_create()` to helpers.c, make it accessible for all tests X-Gw-Bpl: wU/cy49Bu1yAPm0bW2qiliFUIEVf+EkEatAboK6pk2H2LSy2bfWlPAiP3YIeQ5aElNkQEhTV9Q== Date: Wed, 16 Jul 2025 07:44:01 +0700 Message-Id: <20250716004402.3902648-3-alviro.iskandar@gnuweeb.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250716004402.3902648-1-alviro.iskandar@gnuweeb.org> References: <20250716004402.3902648-1-alviro.iskandar@gnuweeb.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Previously, the static definition of `memfd_create()` was limited to io_uring_register.c. Now, promote it to a shared location accessible to all test cases, ensuring that future tests using `memfd_create()` do not trigger build failures on Android targets where the syscall is undefined in the standard headers. It improves portability and prevents regressions across test builds. Co-authored-by: Ammar Faizi Signed-off-by: Ammar Faizi Signed-off-by: Alviro Iskandar Setiawan --- test/helpers.c | 8 ++++++++ test/helpers.h | 5 +++++ test/io_uring_register.c | 11 ----------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/test/helpers.c b/test/helpers.c index 0589548..f1d4477 100644 --- a/test/helpers.c +++ b/test/helpers.c @@ -18,6 +18,14 @@ #include "helpers.h" #include "liburing.h" =20 +#ifndef CONFIG_HAVE_MEMFD_CREATE +#include +int memfd_create(const char *name, unsigned int flags) +{ + return (int)syscall(SYS_memfd_create, name, flags); +} +#endif + /* * Helper for allocating memory in tests. */ diff --git a/test/helpers.h b/test/helpers.h index 3f0c11a..8ab0920 100644 --- a/test/helpers.h +++ b/test/helpers.h @@ -122,6 +122,11 @@ unsigned long long mtime_since_now(struct timeval *tv); unsigned long long utime_since(const struct timeval *s, const struct timev= al *e); unsigned long long utime_since_now(struct timeval *tv); =20 +#ifndef CONFIG_HAVE_MEMFD_CREATE +#include +#endif +int memfd_create(const char *name, unsigned int flags); + #ifdef __cplusplus } #endif diff --git a/test/io_uring_register.c b/test/io_uring_register.c index 405a812..b53a67d 100644 --- a/test/io_uring_register.c +++ b/test/io_uring_register.c @@ -32,17 +32,6 @@ static int pagesize; static rlim_t mlock_limit; static int devnull; =20 -#if !defined(CONFIG_HAVE_MEMFD_CREATE) -#include -#include - -int memfd_create(const char *name, unsigned int flags) -{ - return (int)syscall(SYS_memfd_create, name, flags); -} -#endif - - static int expect_fail(int fd, unsigned int opcode, void *arg, unsigned int nr_args, int error, int error2) { --=20 Alviro Iskandar Setiawan From nobody Tue Oct 7 01:58:30 2025 Received: from server-vie001.gnuweeb.org (server-vie001.gnuweeb.org [89.58.62.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF5C8199924; Wed, 16 Jul 2025 00:44:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.58.62.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752626657; cv=none; b=YIwDPJGNQyIKNPy9h+PkhJlU0MLSN4OmAgTUWnKhufZnS5gTfYkZrZKNk3k3hnevb8JbR3kgCmUORqCrrOcTnB/1TtkJeEoLS6X5QggL7prxwqTnxAP5I0ey425SXB29w56di97G0zOlTROnuV+sMliuzivjU9nPi3yg/d3zAlU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752626657; c=relaxed/simple; bh=Mx61kFRNQHY9qQ6RBZGwoOG4WieLMzliOmAtmIesLuo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hwK9GQ01s/VuFzwG42riEqv8Ayiv3s+g3cN/nd3yXl4qtCSeK9Oe3HAfF8ldKKRUqCYT7uSMYl2Giqot3EXj7sG0QX1sZis3UIQDo9ETXUGl6E2sPuWor0UdSeJmEXQT9mT1nlGOUourV2Bi10XJ/Hf0pFRyVogO5LS6ONJlkyk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=gnuweeb.org; spf=pass smtp.mailfrom=gnuweeb.org; dkim=pass (2048-bit key) header.d=gnuweeb.org header.i=@gnuweeb.org header.b=pgGZWFUA; arc=none smtp.client-ip=89.58.62.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=gnuweeb.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gnuweeb.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gnuweeb.org header.i=@gnuweeb.org header.b="pgGZWFUA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1752626654; bh=Mx61kFRNQHY9qQ6RBZGwoOG4WieLMzliOmAtmIesLuo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Message-ID:Date:From: Reply-To:Subject:To:Cc:In-Reply-To:References:Resent-Date: Resent-From:Resent-To:Resent-Cc:User-Agent:Content-Type: Content-Transfer-Encoding; b=pgGZWFUAselh4tfIJmgjTwnCZDdQxb2U3KybXWkAQZK0qJ8brqZ3cFElnjGdtDweL vhRAUY6aqXOQIj1lUXMbpikqdHKooAw1d115cRA/yg7pWQIzb8px8V9532Asam1TGS B0+Q/KXprdxYbjU6pfMT9H+GTjeBzSB/ktQj1lTGT1+0yLNyuoEnQyP5gwgnOQDmu8 9ra3VWV+x/kwrFnfJiklJ/1bxNjry+ygCFE6aBw7s0fdPv7QWM/E2QaAa4ZSTO4Ayi yQCSndhCUyPpGoRY+j8xOYAp4MupV2TvxRn/lqJ28mie202dd5hOxcwg5gNXYaljih vipBlz20MLcnQ== Received: from localhost.localdomain (unknown [68.183.184.174]) by server-vie001.gnuweeb.org (Postfix) with ESMTPSA id 5AF792109A7B; Wed, 16 Jul 2025 00:44:12 +0000 (UTC) From: Alviro Iskandar Setiawan To: Jens Axboe Cc: Alviro Iskandar Setiawan , Ammar Faizi , GNU/Weeb Mailing List , Linux Kernel Mailing List , io-uring Mailing List Subject: [PATCH liburing v2 3/3] examples: Add `memfd_create()` helper X-Gw-Bpl: wU/cy49Bu1yAPm0bW2qiliFUIEVf+EkEatAboK6pk2H2LSy2bfWlPAiP3YIeQ5aElNkQEhTV9Q== Date: Wed, 16 Jul 2025 07:44:02 +0700 Message-Id: <20250716004402.3902648-4-alviro.iskandar@gnuweeb.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250716004402.3902648-1-alviro.iskandar@gnuweeb.org> References: <20250716004402.3902648-1-alviro.iskandar@gnuweeb.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add `memfd_create()` helper to handle missing defintion on an environment where `CONFIG_HAVE_MEMFD_CREATE` is not defined. Fixes: 93d3a7a70b4a ("examples/zcrx: udmabuf backed areas") Co-authored-by: Ammar Faizi Signed-off-by: Ammar Faizi Signed-off-by: Alviro Iskandar Setiawan --- examples/helpers.c | 8 ++++++++ examples/helpers.h | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/examples/helpers.c b/examples/helpers.c index 483ddee..8c112f1 100644 --- a/examples/helpers.c +++ b/examples/helpers.c @@ -13,6 +13,14 @@ =20 #include "helpers.h" =20 +#ifndef CONFIG_HAVE_MEMFD_CREATE +#include +int memfd_create(const char *name, unsigned int flags) +{ + return (int)syscall(SYS_memfd_create, name, flags); +} +#endif + int setup_listening_socket(int port, int ipv6) { struct sockaddr_in srv_addr =3D { }; diff --git a/examples/helpers.h b/examples/helpers.h index 44543e1..0b6f15f 100644 --- a/examples/helpers.h +++ b/examples/helpers.h @@ -17,4 +17,9 @@ void *t_aligned_alloc(size_t alignment, size_t size); =20 void t_error(int status, int errnum, const char *format, ...); =20 +#ifndef CONFIG_HAVE_MEMFD_CREATE +#include +#endif +int memfd_create(const char *name, unsigned int flags); + #endif --=20 Alviro Iskandar Setiawan