* [Buildroot] [PATCH 1/1] package/nfs-utils: fix build failure due to glibc <= 2.24
@ 2023-11-16 20:16 Petr Vorel
2023-11-27 17:09 ` Yann E. MORIN
0 siblings, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2023-11-16 20:16 UTC (permalink / raw)
To: buildroot; +Cc: Petr Vorel, Giulio Benetti
From: Petr Vorel <petr.vorel@gmail.com>
Backport upstream patches that check if <sys/random.h> exists or not. If
it doesn't exist it uses uses the corresponding syscall.
NOTE: This would not be enough on Linux kernel < 3.17, but that's old
enough.
Fixes: http://autobuild.buildroot.net/results/c5fde6099a8b228a8bdc3154d1e47dfa192e94ed/
Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
Hi,
I'm sorry for the noise (I sent unsubscribed).
NOTE: I was not able to test the build, therefore it *should* fix it.
Kind regards,
Petr
| 42 +++++++
| 43 +++++++
...kend_sqlite.c-Add-getrandom-fallback.patch | 113 ++++++++++++++++++
3 files changed, 198 insertions(+)
create mode 100644 package/nfs-utils/0003-reexport-fsidd.c-Remove-unused-headers.patch
create mode 100644 package/nfs-utils/0004-support-reexport.c-Remove-unused-headers.patch
create mode 100644 package/nfs-utils/0005-support-backend_sqlite.c-Add-getrandom-fallback.patch
--git a/package/nfs-utils/0003-reexport-fsidd.c-Remove-unused-headers.patch b/package/nfs-utils/0003-reexport-fsidd.c-Remove-unused-headers.patch
new file mode 100644
index 0000000000..0331a8c9f8
--- /dev/null
+++ b/package/nfs-utils/0003-reexport-fsidd.c-Remove-unused-headers.patch
@@ -0,0 +1,42 @@
+From 1a4edb2aa6b9b88fcdcb8d82b262467d06527623 Mon Sep 17 00:00:00 2001
+From: Petr Vorel <pvorel@suse.cz>
+Date: Fri, 10 Nov 2023 10:35:33 -0500
+Subject: [PATCH 1/3] reexport/fsidd.c: Remove unused headers
+
+Some of them are needed but included elsewhere, e.g. <string.h>
+included in xcommon.h, but at least <sys/random.h> is removed due
+further code simplification.
+
+Fixes: 6fd2732d ("export: Add fsidd")
+Signed-off-by: Petr Vorel <pvorel@suse.cz>
+Signed-off-by: Steve Dickson <steved@redhat.com>
+Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
+Upstream: https://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commit;h=1a4edb2aa6b9b88fcdcb8d82b262467d06527623
+---
+ 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 <dlfcn.h>
+ #endif
+ #include <event2/event.h>
+-#include <limits.h>
+-#include <stdint.h>
+-#include <stdio.h>
+-#include <sys/random.h>
+-#include <sys/socket.h>
+-#include <sys/stat.h>
+-#include <sys/types.h>
+-#include <sys/un.h>
+-#include <sys/vfs.h>
+-#include <unistd.h>
+
+ #include "conffile.h"
+ #include "reexport_backend.h"
+--
+2.42.0
+
--git a/package/nfs-utils/0004-support-reexport.c-Remove-unused-headers.patch b/package/nfs-utils/0004-support-reexport.c-Remove-unused-headers.patch
new file mode 100644
index 0000000000..23d3e80ada
--- /dev/null
+++ b/package/nfs-utils/0004-support-reexport.c-Remove-unused-headers.patch
@@ -0,0 +1,43 @@
+From bdc79f02c17fc9ec7461d48007105caac789cef4 Mon Sep 17 00:00:00 2001
+From: Petr Vorel <pvorel@suse.cz>
+Date: Fri, 10 Nov 2023 10:39:05 -0500
+Subject: [PATCH 2/3] support/reexport.c: Remove unused headers
+
+Some of them are needed but included elsewhere, e.g. <sys/socket.h>
+included in nfslib.h or <string.h> included in xcommon.h, but at least
+<sys/random.h> is removed due further code simplification.
+
+Fixes: 878674b3 ("Add reexport helper library")
+Reviewed-by: Richard Weinberger <richard@nod.at>
+Signed-off-by: Petr Vorel <pvorel@suse.cz>
+Signed-off-by: Steve Dickson <steved@redhat.com>
+Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
+Upstream: https://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commit;h=bdc79f02c17fc9ec7461d48007105caac789cef4
+---
+ 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 <dlfcn.h>
+ #endif
+-#include <stdint.h>
+-#include <stdio.h>
+-#include <sys/random.h>
+-#include <sys/stat.h>
+ #include <sys/types.h>
+ #include <sys/vfs.h>
+-#include <unistd.h>
+ #include <errno.h>
+-#include <sys/socket.h>
+-#include <sys/un.h>
+
+ #include "nfsd_path.h"
+ #include "conffile.h"
+--
+2.42.0
+
diff --git a/package/nfs-utils/0005-support-backend_sqlite.c-Add-getrandom-fallback.patch b/package/nfs-utils/0005-support-backend_sqlite.c-Add-getrandom-fallback.patch
new file mode 100644
index 0000000000..71c42f74b1
--- /dev/null
+++ b/package/nfs-utils/0005-support-backend_sqlite.c-Add-getrandom-fallback.patch
@@ -0,0 +1,113 @@
+From f92fd6ca815025c435dabf45da28472ac0aa04a4 Mon Sep 17 00:00:00 2001
+From: Petr Vorel <pvorel@suse.cz>
+Date: Fri, 10 Nov 2023 10:59:29 -0500
+Subject: [PATCH 3/3] support/backend_sqlite.c: Add getrandom() fallback
+
+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 <pvorel@suse.cz>
+Signed-off-by: Steve Dickson <steved@redhat.com>
+Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
+Upstream: https://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commit;h=f92fd6ca815025c435dabf45da28472ac0aa04a4
+---
+ 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 <stdlib.h> /* for NULL */
++ #include <sys/random.h>
++ ]],
++ [[ 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 <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <sys/random.h>
+ #include <unistd.h>
+
++#ifdef HAVE_GETRANDOM
++# include <sys/random.h>
++# 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;
+--
+2.42.0
+
--
2.42.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [Buildroot] [PATCH 1/1] package/nfs-utils: fix build failure due to glibc <= 2.24
2023-11-16 20:16 [Buildroot] [PATCH 1/1] package/nfs-utils: fix build failure due to glibc <= 2.24 Petr Vorel
@ 2023-11-27 17:09 ` Yann E. MORIN
2023-12-03 21:56 ` Petr Vorel
0 siblings, 1 reply; 5+ messages in thread
From: Yann E. MORIN @ 2023-11-27 17:09 UTC (permalink / raw)
To: Petr Vorel; +Cc: Petr Vorel, Giulio Benetti, buildroot
Petr, All,
On 2023-11-16 21:16 +0100, Petr Vorel spake thusly:
> From: Petr Vorel <petr.vorel@gmail.com>
>
> Backport upstream patches that check if <sys/random.h> exists or not. If
> it doesn't exist it uses uses the corresponding syscall.
>
> NOTE: This would not be enough on Linux kernel < 3.17, but that's old
> enough.
I guess that's about kernel headers, i.e. that would cause a build
filure, not a runtime one?
If so, that would need a dependency on kern el headers;
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_17
> Fixes: http://autobuild.buildroot.net/results/c5fde6099a8b228a8bdc3154d1e47dfa192e94ed/
> Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
> Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
> ---
> Hi,
>
> I'm sorry for the noise (I sent unsubscribed).
>
> NOTE: I was not able to test the build, therefore it *should* fix it.
Giulio reported build failures with this patch applied, and also:
[--SNIP--]
> diff --git a/package/nfs-utils/0003-reexport-fsidd.c-Remove-unused-headers.patch b/package/nfs-utils/0003-reexport-fsidd.c-Remove-unused-headers.patch
> new file mode 100644
> index 0000000000..0331a8c9f8
> --- /dev/null
> +++ b/package/nfs-utils/0003-reexport-fsidd.c-Remove-unused-headers.patch
> @@ -0,0 +1,42 @@
> +From 1a4edb2aa6b9b88fcdcb8d82b262467d06527623 Mon Sep 17 00:00:00 2001
> +From: Petr Vorel <pvorel@suse.cz>
> +Date: Fri, 10 Nov 2023 10:35:33 -0500
> +Subject: [PATCH 1/3] reexport/fsidd.c: Remove unused headers
$ make check-package
package/nfs-utils/0003-reexport-fsidd.c-Remove-unused-headers.patch:4: generate your patches with 'git format-patch -N'
package/nfs-utils/0004-support-reexport.c-Remove-unused-headers.patch:4: generate your patches with 'git format-patch -N'
package/nfs-utils/0005-support-backend_sqlite.c-Add-getrandom-fallback.patch:4: generate your patches with 'git format-patch -N'
Regards,
Yann E. MORIN.
> +
> +Some of them are needed but included elsewhere, e.g. <string.h>
> +included in xcommon.h, but at least <sys/random.h> is removed due
> +further code simplification.
> +
> +Fixes: 6fd2732d ("export: Add fsidd")
> +Signed-off-by: Petr Vorel <pvorel@suse.cz>
> +Signed-off-by: Steve Dickson <steved@redhat.com>
> +Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
> +Upstream: https://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commit;h=1a4edb2aa6b9b88fcdcb8d82b262467d06527623
> +---
> + 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 <dlfcn.h>
> + #endif
> + #include <event2/event.h>
> +-#include <limits.h>
> +-#include <stdint.h>
> +-#include <stdio.h>
> +-#include <sys/random.h>
> +-#include <sys/socket.h>
> +-#include <sys/stat.h>
> +-#include <sys/types.h>
> +-#include <sys/un.h>
> +-#include <sys/vfs.h>
> +-#include <unistd.h>
> +
> + #include "conffile.h"
> + #include "reexport_backend.h"
> +--
> +2.42.0
> +
> diff --git a/package/nfs-utils/0004-support-reexport.c-Remove-unused-headers.patch b/package/nfs-utils/0004-support-reexport.c-Remove-unused-headers.patch
> new file mode 100644
> index 0000000000..23d3e80ada
> --- /dev/null
> +++ b/package/nfs-utils/0004-support-reexport.c-Remove-unused-headers.patch
> @@ -0,0 +1,43 @@
> +From bdc79f02c17fc9ec7461d48007105caac789cef4 Mon Sep 17 00:00:00 2001
> +From: Petr Vorel <pvorel@suse.cz>
> +Date: Fri, 10 Nov 2023 10:39:05 -0500
> +Subject: [PATCH 2/3] support/reexport.c: Remove unused headers
> +
> +Some of them are needed but included elsewhere, e.g. <sys/socket.h>
> +included in nfslib.h or <string.h> included in xcommon.h, but at least
> +<sys/random.h> is removed due further code simplification.
> +
> +Fixes: 878674b3 ("Add reexport helper library")
> +Reviewed-by: Richard Weinberger <richard@nod.at>
> +Signed-off-by: Petr Vorel <pvorel@suse.cz>
> +Signed-off-by: Steve Dickson <steved@redhat.com>
> +Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
> +Upstream: https://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commit;h=bdc79f02c17fc9ec7461d48007105caac789cef4
> +---
> + 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 <dlfcn.h>
> + #endif
> +-#include <stdint.h>
> +-#include <stdio.h>
> +-#include <sys/random.h>
> +-#include <sys/stat.h>
> + #include <sys/types.h>
> + #include <sys/vfs.h>
> +-#include <unistd.h>
> + #include <errno.h>
> +-#include <sys/socket.h>
> +-#include <sys/un.h>
> +
> + #include "nfsd_path.h"
> + #include "conffile.h"
> +--
> +2.42.0
> +
> diff --git a/package/nfs-utils/0005-support-backend_sqlite.c-Add-getrandom-fallback.patch b/package/nfs-utils/0005-support-backend_sqlite.c-Add-getrandom-fallback.patch
> new file mode 100644
> index 0000000000..71c42f74b1
> --- /dev/null
> +++ b/package/nfs-utils/0005-support-backend_sqlite.c-Add-getrandom-fallback.patch
> @@ -0,0 +1,113 @@
> +From f92fd6ca815025c435dabf45da28472ac0aa04a4 Mon Sep 17 00:00:00 2001
> +From: Petr Vorel <pvorel@suse.cz>
> +Date: Fri, 10 Nov 2023 10:59:29 -0500
> +Subject: [PATCH 3/3] support/backend_sqlite.c: Add getrandom() fallback
> +
> +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 <pvorel@suse.cz>
> +Signed-off-by: Steve Dickson <steved@redhat.com>
> +Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
> +Upstream: https://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commit;h=f92fd6ca815025c435dabf45da28472ac0aa04a4
> +---
> + 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 <stdlib.h> /* for NULL */
> ++ #include <sys/random.h>
> ++ ]],
> ++ [[ 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 <stdio.h>
> + #include <stdlib.h>
> + #include <string.h>
> +-#include <sys/random.h>
> + #include <unistd.h>
> +
> ++#ifdef HAVE_GETRANDOM
> ++# include <sys/random.h>
> ++# 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;
> +--
> +2.42.0
> +
> --
> 2.42.0
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [Buildroot] [PATCH 1/1] package/nfs-utils: fix build failure due to glibc <= 2.24
2023-11-27 17:09 ` Yann E. MORIN
@ 2023-12-03 21:56 ` Petr Vorel
0 siblings, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2023-12-03 21:56 UTC (permalink / raw)
To: Yann E. MORIN; +Cc: Giulio Benetti, Petr Vorel, buildroot
> Petr, All,
> On 2023-11-16 21:16 +0100, Petr Vorel spake thusly:
> > From: Petr Vorel <petr.vorel@gmail.com>
> > Backport upstream patches that check if <sys/random.h> exists or not. If
> > it doesn't exist it uses uses the corresponding syscall.
> > NOTE: This would not be enough on Linux kernel < 3.17, but that's old
> > enough.
> I guess that's about kernel headers, i.e. that would cause a build
> filure, not a runtime one?
> If so, that would need a dependency on kern el headers;
> depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_17
Thank you, sure, I'll add it in v2.
> > Fixes: http://autobuild.buildroot.net/results/c5fde6099a8b228a8bdc3154d1e47dfa192e94ed/
> > Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
> > Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
> > ---
> > Hi,
> > I'm sorry for the noise (I sent unsubscribed).
> > NOTE: I was not able to test the build, therefore it *should* fix it.
> Giulio reported build failures with this patch applied, and also:
Yes, Giulio reported it to me as well. I plan to fix this issue in upstream
first. Unfortunately I'm very busy now, I hope I'll get to this soon.
> [--SNIP--]
> > diff --git a/package/nfs-utils/0003-reexport-fsidd.c-Remove-unused-headers.patch b/package/nfs-utils/0003-reexport-fsidd.c-Remove-unused-headers.patch
> > new file mode 100644
> > index 0000000000..0331a8c9f8
> > --- /dev/null
> > +++ b/package/nfs-utils/0003-reexport-fsidd.c-Remove-unused-headers.patch
> > @@ -0,0 +1,42 @@
> > +From 1a4edb2aa6b9b88fcdcb8d82b262467d06527623 Mon Sep 17 00:00:00 2001
> > +From: Petr Vorel <pvorel@suse.cz>
> > +Date: Fri, 10 Nov 2023 10:35:33 -0500
> > +Subject: [PATCH 1/3] reexport/fsidd.c: Remove unused headers
> $ make check-package
> package/nfs-utils/0003-reexport-fsidd.c-Remove-unused-headers.patch:4: generate your patches with 'git format-patch -N'
> package/nfs-utils/0004-support-reexport.c-Remove-unused-headers.patch:4: generate your patches with 'git format-patch -N'
> package/nfs-utils/0005-support-backend_sqlite.c-Add-getrandom-fallback.patch:4: generate your patches with 'git format-patch -N'
And I will fix this as well.
Kind regards,
Petr
> Regards,
> Yann E. MORIN.
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <20231116192104.2618421-1-pevik@seznam.cz>]
* Re: [Buildroot] [PATCH 1/1] package/nfs-utils: fix build failure due to glibc <= 2.24
[not found] <20231116192104.2618421-1-pevik@seznam.cz>
@ 2023-11-16 21:49 ` Giulio Benetti
[not found] ` <CAB1t1Cw8gJ+r64niKMymhvem9jdpVASC4fa4qEuDj5+4sp2HCQ@mail.gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Giulio Benetti @ 2023-11-16 21:49 UTC (permalink / raw)
To: Petr Vorel, buildroot; +Cc: Petr Vorel
Hi Petr,
On 16/11/23 20:21, Petr Vorel wrote:
> From: Petr Vorel <petr.vorel@gmail.com>
>
> Backport upstream patches that check if <sys/random.h> exists or not. If
> it doesn't exist it uses uses the corresponding syscall.
>
> NOTE: This would not be enough on Linux kernel < 3.17, but that's old
> enough.
>
> Fixes: http://autobuild.buildroot.net/results/c5fde6099a8b228a8bdc3154d1e47dfa192e94ed/
> Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
> Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
> ---
> Hi,
>
> NOTE: I was not able to test the build, therefore it *should* fix it.
thanks for the patch, I've just give a try but I think that the patches
that remove the headers are too aggressive. Indeed the build results in
this log:
https://pastebin.com/FAkLGE8d
To reproduce the build failure you have to issue:
$ wget
http://git.buildroot.net/buildroot-test/plain/utils/br-reproduce-build
$ chmod a+x br-reproduce-build
$ ./br-reproduce-build c5fde6099a8b228a8bdc3154d1e47dfa192e94ed
and then you can try to apply this patch on:
c5fde6099a8b228a8bdc3154d1e47dfa192e94ed/buildroot
and try again to fix the build failure.
For what it's worth there is a pending patch containing 2 local patches
that have not been applied upstream because your patches were better
to deal with getrandom(), but it fixes this problem:
https://patchwork.ozlabs.org/project/buildroot/patch/20231026121235.567459-1-giulio.benetti@benettiengineering.com/
Can you take a look and check the difference between my patches
and yours?
Thank you!
Best regards
--
Giulio Benetti
CEO&CTO@Benetti Engineering sas
> Kind regards,
> Petr
>
> ...export-fsidd.c-Remove-unused-headers.patch | 42 +++++++
> ...ort-reexport.c-Remove-unused-headers.patch | 43 +++++++
> ...kend_sqlite.c-Add-getrandom-fallback.patch | 113 ++++++++++++++++++
> 3 files changed, 198 insertions(+)
> create mode 100644 package/nfs-utils/0003-reexport-fsidd.c-Remove-unused-headers.patch
> create mode 100644 package/nfs-utils/0004-support-reexport.c-Remove-unused-headers.patch
> create mode 100644 package/nfs-utils/0005-support-backend_sqlite.c-Add-getrandom-fallback.patch
>
> diff --git a/package/nfs-utils/0003-reexport-fsidd.c-Remove-unused-headers.patch b/package/nfs-utils/0003-reexport-fsidd.c-Remove-unused-headers.patch
> new file mode 100644
> index 0000000000..0331a8c9f8
> --- /dev/null
> +++ b/package/nfs-utils/0003-reexport-fsidd.c-Remove-unused-headers.patch
> @@ -0,0 +1,42 @@
> +From 1a4edb2aa6b9b88fcdcb8d82b262467d06527623 Mon Sep 17 00:00:00 2001
> +From: Petr Vorel <pvorel@suse.cz>
> +Date: Fri, 10 Nov 2023 10:35:33 -0500
> +Subject: [PATCH 1/3] reexport/fsidd.c: Remove unused headers
> +
> +Some of them are needed but included elsewhere, e.g. <string.h>
> +included in xcommon.h, but at least <sys/random.h> is removed due
> +further code simplification.
> +
> +Fixes: 6fd2732d ("export: Add fsidd")
> +Signed-off-by: Petr Vorel <pvorel@suse.cz>
> +Signed-off-by: Steve Dickson <steved@redhat.com>
> +Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
> +Upstream: https://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commit;h=1a4edb2aa6b9b88fcdcb8d82b262467d06527623
> +---
> + 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 <dlfcn.h>
> + #endif
> + #include <event2/event.h>
> +-#include <limits.h>
> +-#include <stdint.h>
> +-#include <stdio.h>
> +-#include <sys/random.h>
> +-#include <sys/socket.h>
> +-#include <sys/stat.h>
> +-#include <sys/types.h>
> +-#include <sys/un.h>
> +-#include <sys/vfs.h>
> +-#include <unistd.h>
> +
> + #include "conffile.h"
> + #include "reexport_backend.h"
> +--
> +2.42.0
> +
> diff --git a/package/nfs-utils/0004-support-reexport.c-Remove-unused-headers.patch b/package/nfs-utils/0004-support-reexport.c-Remove-unused-headers.patch
> new file mode 100644
> index 0000000000..23d3e80ada
> --- /dev/null
> +++ b/package/nfs-utils/0004-support-reexport.c-Remove-unused-headers.patch
> @@ -0,0 +1,43 @@
> +From bdc79f02c17fc9ec7461d48007105caac789cef4 Mon Sep 17 00:00:00 2001
> +From: Petr Vorel <pvorel@suse.cz>
> +Date: Fri, 10 Nov 2023 10:39:05 -0500
> +Subject: [PATCH 2/3] support/reexport.c: Remove unused headers
> +
> +Some of them are needed but included elsewhere, e.g. <sys/socket.h>
> +included in nfslib.h or <string.h> included in xcommon.h, but at least
> +<sys/random.h> is removed due further code simplification.
> +
> +Fixes: 878674b3 ("Add reexport helper library")
> +Reviewed-by: Richard Weinberger <richard@nod.at>
> +Signed-off-by: Petr Vorel <pvorel@suse.cz>
> +Signed-off-by: Steve Dickson <steved@redhat.com>
> +Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
> +Upstream: https://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commit;h=bdc79f02c17fc9ec7461d48007105caac789cef4
> +---
> + 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 <dlfcn.h>
> + #endif
> +-#include <stdint.h>
> +-#include <stdio.h>
> +-#include <sys/random.h>
> +-#include <sys/stat.h>
> + #include <sys/types.h>
> + #include <sys/vfs.h>
> +-#include <unistd.h>
> + #include <errno.h>
> +-#include <sys/socket.h>
> +-#include <sys/un.h>
> +
> + #include "nfsd_path.h"
> + #include "conffile.h"
> +--
> +2.42.0
> +
> diff --git a/package/nfs-utils/0005-support-backend_sqlite.c-Add-getrandom-fallback.patch b/package/nfs-utils/0005-support-backend_sqlite.c-Add-getrandom-fallback.patch
> new file mode 100644
> index 0000000000..71c42f74b1
> --- /dev/null
> +++ b/package/nfs-utils/0005-support-backend_sqlite.c-Add-getrandom-fallback.patch
> @@ -0,0 +1,113 @@
> +From f92fd6ca815025c435dabf45da28472ac0aa04a4 Mon Sep 17 00:00:00 2001
> +From: Petr Vorel <pvorel@suse.cz>
> +Date: Fri, 10 Nov 2023 10:59:29 -0500
> +Subject: [PATCH 3/3] support/backend_sqlite.c: Add getrandom() fallback
> +
> +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 <pvorel@suse.cz>
> +Signed-off-by: Steve Dickson <steved@redhat.com>
> +Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
> +Upstream: https://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commit;h=f92fd6ca815025c435dabf45da28472ac0aa04a4
> +---
> + 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 <stdlib.h> /* for NULL */
> ++ #include <sys/random.h>
> ++ ]],
> ++ [[ 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 <stdio.h>
> + #include <stdlib.h>
> + #include <string.h>
> +-#include <sys/random.h>
> + #include <unistd.h>
> +
> ++#ifdef HAVE_GETRANDOM
> ++# include <sys/random.h>
> ++# 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;
> +--
> +2.42.0
> +
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-12-03 21:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-16 20:16 [Buildroot] [PATCH 1/1] package/nfs-utils: fix build failure due to glibc <= 2.24 Petr Vorel
2023-11-27 17:09 ` Yann E. MORIN
2023-12-03 21:56 ` Petr Vorel
[not found] <20231116192104.2618421-1-pevik@seznam.cz>
2023-11-16 21:49 ` Giulio Benetti
[not found] ` <CAB1t1Cw8gJ+r64niKMymhvem9jdpVASC4fa4qEuDj5+4sp2HCQ@mail.gmail.com>
2023-11-17 10:27 ` Giulio Benetti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox