From patchwork Wed Oct 25 19:46:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 13436652 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 86971C07545 for ; Wed, 25 Oct 2023 19:47:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229498AbjJYTrk (ORCPT ); Wed, 25 Oct 2023 15:47:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229548AbjJYTrj (ORCPT ); Wed, 25 Oct 2023 15:47:39 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA7AAC4 for ; Wed, 25 Oct 2023 12:47:36 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B5CF721977; Wed, 25 Oct 2023 19:47:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1698263249; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KyoyxoHLxR34o6Y+q9kpL0sozeOv6K0w0T45MTYU4ZA=; b=oEmcDQlMhC825MPmYi445031ha5Tu1vWKMutkE/nyOetI1Ae9Kag3BT4wKf/GWdd1wDLFd cVKOiYlKmx8tOf4Z8UOsqoJ7R4JqXfJBjwJDsTugqRxuNZ14yNN5M4VO9Gwl1k3MDd7lOP 8b3/1TcvaK4KfjAfao4UlXMuYZz6GjM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1698263249; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KyoyxoHLxR34o6Y+q9kpL0sozeOv6K0w0T45MTYU4ZA=; b=7yRN5KE689ETOW49syWqa+7GAZ5EOGHU4+KxQgyWmZpR9jSmLCFJyYvJATUvXulQ3LTnxK qDd1JjiNAmcRWxBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5E7F313A82; Wed, 25 Oct 2023 19:47:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id uFw2FNFwOWVwFQAAMHmgww (envelope-from ); Wed, 25 Oct 2023 19:47:29 +0000 From: Petr Vorel To: linux-nfs@vger.kernel.org Cc: Petr Vorel , Richard Weinberger , Steve Dickson Subject: [PATCH 1/3] reexport/fsidd.c: Remove unused headers Date: Wed, 25 Oct 2023 21:46:59 +0200 Message-ID: <20231025194701.456031-2-pvorel@suse.cz> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231025194701.456031-1-pvorel@suse.cz> References: <20231025194701.456031-1-pvorel@suse.cz> MIME-Version: 1.0 Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [0.72 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_MISSING_CHARSET(2.50)[]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.18)[70.17%] Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Some of them are needed but included elsewhere, e.g. included in xcommon.h, but at least is removed due further code simplification. Fixes: 6fd2732d ("export: Add fsidd") Signed-off-by: Petr Vorel --- support/reexport/fsidd.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/support/reexport/fsidd.c b/support/reexport/fsidd.c index d4b245e8..3e62b3fc 100644 --- a/support/reexport/fsidd.c +++ b/support/reexport/fsidd.c @@ -7,16 +7,6 @@ #include #endif #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "conffile.h" #include "reexport_backend.h" From patchwork Wed Oct 25 19:47:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 13436654 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 85EF6C0032E for ; Wed, 25 Oct 2023 19:53:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229441AbjJYTxi (ORCPT ); Wed, 25 Oct 2023 15:53:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbjJYTxi (ORCPT ); Wed, 25 Oct 2023 15:53:38 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 254C7137 for ; Wed, 25 Oct 2023 12:53:36 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B99B620083; Wed, 25 Oct 2023 19:47:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1698263250; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BSY05Y/j0KiF9CKum/n1LW8xkzF8moMuMjeBW6Vgi0E=; b=EyuW5tVJwh763QqgBULo6sSsJGJMcSxeHbpSGV0kS4wrUPQT4v50CNz2Fd2ouXCDQWc/Pq 1vDBNtyJSprJ1eo5Sdi6hzebEpqutwQpC0o028L3tR6F10yg9XuSYzCQUhOivinAfsN7Mi mOkMtRurnRr9Lu1Kb8jxZwEuUv3SWJs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1698263250; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BSY05Y/j0KiF9CKum/n1LW8xkzF8moMuMjeBW6Vgi0E=; b=cGNsXOG0KB0p6gT7/dH6tyEiUgoAP8HTlgTXVG6wlgT6e/hp+CKDxtL4u2MC6uHg6uzMN3 E3FO8SDj+vRIu9DA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C026413A9B; Wed, 25 Oct 2023 19:47:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id GJM7LdFwOWVwFQAAMHmgww (envelope-from ); Wed, 25 Oct 2023 19:47:29 +0000 From: Petr Vorel To: linux-nfs@vger.kernel.org Cc: Petr Vorel , Richard Weinberger , Steve Dickson Subject: [PATCH 2/3] support/reexport.c: Remove unused headers Date: Wed, 25 Oct 2023 21:47:00 +0200 Message-ID: <20231025194701.456031-3-pvorel@suse.cz> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231025194701.456031-1-pvorel@suse.cz> References: <20231025194701.456031-1-pvorel@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Some of them are needed but included elsewhere, e.g. included in nfslib.h or included in xcommon.h, but at least is removed due further code simplification. Fixes: 878674b3 ("Add reexport helper library") Signed-off-by: Petr Vorel Reviewed-by: Richard Weinberger --- support/reexport/reexport.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/support/reexport/reexport.c b/support/reexport/reexport.c index d9a700af..78516586 100644 --- a/support/reexport/reexport.c +++ b/support/reexport/reexport.c @@ -5,16 +5,9 @@ #ifdef HAVE_DLFCN_H #include #endif -#include -#include -#include -#include #include #include -#include #include -#include -#include #include "nfsd_path.h" #include "conffile.h" From patchwork Wed Oct 25 19:47:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 13436651 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 3C4E5C25B6B for ; Wed, 25 Oct 2023 19:47:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229441AbjJYTrk (ORCPT ); Wed, 25 Oct 2023 15:47:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbjJYTrj (ORCPT ); Wed, 25 Oct 2023 15:47:39 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DE1693 for ; Wed, 25 Oct 2023 12:47:36 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 2FD6E2199B; Wed, 25 Oct 2023 19:47:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1698263251; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gljzIdmLP8BYQ/heFOwqk/coLY1U9+Mw6Vt9T9/FimM=; b=xsCct/GxlU9A8YHYCOVncSFFNdy2vAHxlNgetB5p8SzdSnoZeJovC3j6SVcSyb+Nc0Huhp kRjd8btDRdOtDcwJUFgKcw84aoqOyf7sKqxyVWB01MVmyHxh8kBpkng/MIbdDTkE8KPfh4 xOTP2FPdAjFoKbn4OJPcjyaVyxmrb+4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1698263251; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gljzIdmLP8BYQ/heFOwqk/coLY1U9+Mw6Vt9T9/FimM=; b=tNPfnzpmt/2KRl9uQNsa9zh3bY7QdNrys3TAtw8MdJaC8pGqCP8sQocD+VSvRdELq8JYh0 Bx/SWmS7hw6MYvBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id CFFC313A9B; Wed, 25 Oct 2023 19:47:30 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 2L9ML9JwOWVwFQAAMHmgww (envelope-from ); Wed, 25 Oct 2023 19:47:30 +0000 From: Petr Vorel To: linux-nfs@vger.kernel.org Cc: Petr Vorel , Richard Weinberger , Steve Dickson Subject: [PATCH 3/3] support/backend_sqlite.c: Add getrandom() fallback Date: Wed, 25 Oct 2023 21:47:01 +0200 Message-ID: <20231025194701.456031-4-pvorel@suse.cz> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231025194701.456031-1-pvorel@suse.cz> References: <20231025194701.456031-1-pvorel@suse.cz> MIME-Version: 1.0 Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [0.82 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_MISSING_CHARSET(2.50)[]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.08)[63.94%] Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Allow to compile reexport on systems with older libc. (getrandom() wrapper is supported on glibc 2.25+ and musl 1.1.20+, uclibc-ng does not yet support it). getrandom() syscall is supported Linux 3.17+ (old enough to bother with a check). Signed-off-by: Petr Vorel --- Makefile.am | 1 + aclocal/getrandom.m4 | 16 ++++++++++++++++ configure.ac | 3 +++ support/reexport/backend_sqlite.c | 18 +++++++++++++++++- 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 aclocal/getrandom.m4 diff --git a/Makefile.am b/Makefile.am index 00220842..72ad4ba7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,6 +10,7 @@ EXTRA_DIST = \ autogen.sh \ \ aclocal/bsdsignals.m4 \ + aclocal/getrandom.m4 \ aclocal/nfs-utils.m4 \ aclocal/kerberos5.m4 \ aclocal/tcp-wrappers.m4 \ diff --git a/aclocal/getrandom.m4 b/aclocal/getrandom.m4 new file mode 100644 index 00000000..bc0fe16a --- /dev/null +++ b/aclocal/getrandom.m4 @@ -0,0 +1,16 @@ +dnl Checks for getrandom support (glibc 2.25+, musl 1.1.20+) +dnl +AC_DEFUN([AC_GETRANDOM], [ + AC_MSG_CHECKING(for getrandom()) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ + #include /* for NULL */ + #include + ]], + [[ return getrandom(NULL, 0U, 0U); ]] )], + [AC_DEFINE([HAVE_GETRANDOM], [1], [Define to 1 if you have the `getrandom' function.]) + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + + AC_SUBST(HAVE_GETRANDOM) +]) diff --git a/configure.ac b/configure.ac index 6fbcb974..4bff679d 100644 --- a/configure.ac +++ b/configure.ac @@ -277,6 +277,9 @@ AC_TCP_WRAPPERS # Arrange for large-file support AC_SYS_LARGEFILE +dnl Check for getrandom() libc support +AC_GETRANDOM + AC_CONFIG_SRCDIR([support/include/config.h.in]) AC_CONFIG_HEADERS([support/include/config.h]) diff --git a/support/reexport/backend_sqlite.c b/support/reexport/backend_sqlite.c index 132f30c4..0eb5ea37 100644 --- a/support/reexport/backend_sqlite.c +++ b/support/reexport/backend_sqlite.c @@ -7,9 +7,16 @@ #include #include #include -#include #include +#ifdef HAVE_GETRANDOM +# include +# if !defined(SYS_getrandom) && defined(__NR_getrandom) + /* usable kernel-headers, but old glibc-headers */ +# define SYS_getrandom __NR_getrandom +# endif +#endif + #include "conffile.h" #include "reexport_backend.h" #include "xlog.h" @@ -20,6 +27,15 @@ static sqlite3 *db; static int init_done; +#if !defined(HAVE_GETRANDOM) && defined(SYS_getrandom) +/* libc without function, but we have syscall */ +static int getrandom(void *buf, size_t buflen, unsigned int flags) +{ + return (syscall(SYS_getrandom, buf, buflen, flags)); +} +# define HAVE_GETRANDOM +#endif + static int prng_init(void) { int seed;