This commit is contained in:
slymattz 2025-04-10 23:50:53 +02:00 committed by GitHub
commit bea2b401ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 34 additions and 168 deletions

View file

@ -1,6 +1,6 @@
# Template file for 'libtirpc'
pkgname=libtirpc
version=1.3.5
version=1.3.6
revision=1
build_style=gnu-configure
hostmakedepends="pkg-config mit-krb5-devel"
@ -12,7 +12,7 @@ license="BSD-3-Clause"
homepage="https://sourceforge.net/projects/libtirpc/"
changelog="http://git.linux-nfs.org/?p=steved/libtirpc.git;a=shortlog"
distfiles="${SOURCEFORGE_SITE}/${pkgname}/${pkgname}-${version}.tar.bz2"
checksum=9b31370e5a38d3391bf37edfa22498e28fe2142467ae6be7a17c9068ec0bf12f
checksum=bbd26a8f0df5690a62a47f6aa30f797f3ef8d02560d1bc449a83066b5a1d3508
case "$XBPS_TARGET_MACHINE" in
*-musl) makedepends+=" musl-legacy-compat" ;;

View file

@ -0,0 +1,6 @@
#!/bin/sh
exec 2>&1
[ -r ./conf ] && . ./conf
exec nfsdcld ${OPTS:- --foreground}

View file

@ -1,5 +1,5 @@
--- a/utils/gssd/gssd.c 2024-08-20 14:30:33.000000000 +0200
+++ b/utils/gssd/gssd.c 2024-09-08 13:01:06.098924979 +0200
--- a/utils/gssd/gssd.c 2025-03-29 16:21:54.000000000 +0100
+++ b/utils/gssd/gssd.c 2025-03-31 22:19:59.859489111 +0200
@@ -65,6 +65,7 @@
#include <dirent.h>
#include <netdb.h>
@ -50,8 +50,8 @@
break;
}
}
--- a/utils/gssd/gssd_proc.c 2024-08-20 14:30:33.000000000 +0200
+++ b/utils/gssd/gssd_proc.c 2024-09-08 13:19:02.841249423 +0200
--- a/utils/gssd/gssd_proc.c 2025-03-29 16:21:54.000000000 +0100
+++ b/utils/gssd/gssd_proc.c 2025-03-31 22:26:32.351326749 +0200
@@ -73,6 +73,7 @@
#ifdef HAVE_TIRPC_GSS_SECCREATE
#include <rpc/rpcsec_gss.h>
@ -111,7 +111,7 @@
#ifdef HAVE_TIRPC_GSS_SECCREATE
memset(&req, 0, sizeof(req));
req.my_cred = sec.cred;
@@ -553,8 +554,8 @@
@@ -567,8 +568,8 @@
int err, resp = -1;
pthread_t tid = pthread_self();
@ -122,7 +122,7 @@
*chg_err = change_identity(uid);
if (*chg_err) {
@@ -602,8 +603,8 @@
@@ -616,8 +617,8 @@
int success = 0;
pthread_t tid = pthread_self();
@ -133,7 +133,7 @@
do {
gssd_refresh_krb5_machine_credential(clp->servername,
@@ -943,8 +944,8 @@
@@ -957,8 +958,8 @@
free(tinfo);
return ret;
}
@ -144,7 +144,7 @@
tinfo->tid = th;
pthread_mutex_lock(&active_thread_list_lock);
@@ -1008,7 +1009,7 @@
@@ -1022,7 +1023,7 @@
}
lbuf[lbuflen-1] = 0;
@ -153,8 +153,8 @@
lbuf, clp->relpath);
for (p = strtok(lbuf, " "); p; p = strtok(NULL, " ")) {
--- a/utils/gssd/krb5_util.c 2024-08-20 14:30:33.000000000 +0200
+++ b/utils/gssd/krb5_util.c 2024-09-08 13:25:58.884113095 +0200
--- a/utils/gssd/krb5_util.c 2025-03-29 16:21:54.000000000 +0100
+++ b/utils/gssd/krb5_util.c 2025-03-31 22:25:50.008589085 +0200
@@ -123,6 +123,7 @@
#include <sys/types.h>
@ -163,7 +163,7 @@
#include "nfslib.h"
#include "gssd.h"
@@ -426,8 +427,8 @@
@@ -420,8 +421,8 @@
now += 300;
pthread_mutex_lock(&ple_lock);
if (ple->ccname && ple->endtime > now && !nocache && !force_renew) {
@ -174,18 +174,18 @@
code = 0;
pthread_mutex_unlock(&ple_lock);
goto out;
@@ -527,8 +528,8 @@
}
@@ -478,8 +479,8 @@
pthread_mutex_unlock(&ple_lock);
code = 0;
- printerr(2, "%s(0x%lx): principal '%s' ccache:'%s'\n",
- __func__, tid, pname, cc_name);
- printerr(2, "%s(0x%lx): principal '%s' ccache:'%s'\n",
- __func__, tid, pname, ple->ccname);
+ printerr(2, "%s(0x%" PRIxPTR "): principal '%s' ccache:'%s'\n",
+ __func__, (uintptr_t)tid, pname, cc_name);
+ __func__, (uintptr_t)tid, pname, ple->ccname);
out:
#ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS
if (init_opts)
@@ -667,8 +668,8 @@
if (opts)
krb5_get_init_creds_opt_free(context, opts);
@@ -614,8 +615,8 @@
/* Get full target hostname */
retval = getaddrinfo(inhost, NULL, &hints, &addrs);
if (retval) {
@ -196,7 +196,7 @@
goto out;
}
strncpy(outhost, addrs->ai_canonname, outhostlen);
@@ -677,8 +678,8 @@
@@ -624,8 +625,8 @@
*c = tolower(*c);
if (get_verbosity() && strcmp(inhost, outhost))
@ -207,12 +207,12 @@
retval = 0;
out:
@@ -1021,7 +1022,7 @@
@@ -968,7 +969,7 @@
tried_upper = 1;
}
} else {
- printerr(2, "find_keytab_entry(0x%lx): Success getting keytab entry for '%s'\n",tid, spn);
+ printerr(2, "find_keytab_entry(0x%" PRIxPTR "): Success getting keytab entry for '%s'\n", (uintptr_t)tid, spn);
+ printerr(2, "find_keytab_entry(0x%" PRIxPTR "): Success getting keytab entry for '%s'\n",(uintptr_t)tid, spn);
retval = 0;
goto out;
}

View file

@ -1,103 +0,0 @@
--- a/support/nfsidmap/libnfsidmap.c
+++ b/support/nfsidmap/libnfsidmap.c
@@ -430,11 +430,17 @@
nobody_user = conf_get_str("Mapping", "Nobody-User");
if (nobody_user) {
- size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
+ long scbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);
+ size_t buflen = 1024; /*value on my gentoo glibc system that has _SC_GETPW_R_SIZE_MAX*/
struct passwd *buf;
struct passwd *pw = NULL;
int err;
+ /*sysconf can return -1 when _SC_GETPW_R_SIZE_MAX is not defined, like on musl systems, if cast to size_t this will lead
+ to an integer overflow, which leads to a buffer overflow and crashes svcgssd */
+ if (scbuflen > 0)
+ buflen = (size_t)scbuflen;
+
buf = malloc(sizeof(*buf) + buflen);
if (buf) {
err = getpwnam_r(nobody_user, buf, ((char *)buf) + sizeof(*buf), buflen, &pw);
@@ -451,10 +457,16 @@
nobody_group = conf_get_str("Mapping", "Nobody-Group");
if (nobody_group) {
- size_t buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
+ long scbuflen = sysconf(_SC_GETGR_R_SIZE_MAX);
+ size_t buflen = 1024; /*value on my gentoo glibc system that has _SC_GETGR_R_SIZE_MAX*/
struct group *buf;
struct group *gr = NULL;
int err;
+
+ /*sysconf can return -1 when _SC_GETGR_R_SIZE_MAX is not defined, like on musl systems, if cast to size_t this will lead
+ to an integer overflow, which leads to a buffer overflow and crashes svcgssd */
+ if (scbuflen > 0)
+ buflen = (size_t)scbuflen;
buf = malloc(sizeof(*buf) + buflen);
if (buf) {
--- a/support/nfsidmap/static.c
+++ b/support/nfsidmap/static.c
@@ -98,10 +98,14 @@
{
struct passwd *pw;
struct pwbuf *buf;
- size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
+ long scbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);
+ size_t buflen = 1024;
char *localname;
int err;
+ if (scbuflen > 0)
+ buflen = (size_t)scbuflen;
+
buf = malloc(sizeof(*buf) + buflen);
if (!buf) {
err = ENOMEM;
@@ -149,9 +153,13 @@
{
struct group *gr;
struct grbuf *buf;
- size_t buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
+ long scbuflen = sysconf(_SC_GETGR_R_SIZE_MAX);
+ size_t buflen = 1024;
char *localgroup;
int err;
+
+ if (scbuflen > 0)
+ buflen = (size_t)scbuflen;
buf = malloc(sizeof(*buf) + buflen);
if (!buf) {
--- a/support/nfsidmap/nss.c
+++ b/support/nfsidmap/nss.c
@@ -91,9 +91,13 @@
struct passwd *pw = NULL;
struct passwd pwbuf;
char *buf;
- size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
+ long scbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);
+ size_t buflen = 1024;
int err = -ENOMEM;
+ if (scbuflen > 0)
+ buflen = (size_t)scbuflen;
+
buf = malloc(buflen);
if (!buf)
goto out;
@@ -119,8 +123,12 @@
struct group *gr = NULL;
struct group grbuf;
char *buf;
- size_t buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
+ long scbuflen = sysconf(_SC_GETGR_R_SIZE_MAX);
+ size_t buflen = 1024;
int err;
+
+ if (scbuflen > 0)
+ buflen = (size_t)scbuflen;
if (domain == NULL)
domain = get_default_domain();

View file

@ -1,38 +0,0 @@
diff --git a/support/junction/path.c b/support/junction/path.c
index 13a14386..dd0f59a0 100644
--- a/support/junction/path.c
+++ b/support/junction/path.c
@@ -23,6 +23,12 @@
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
*/
+/* For musl */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <limits.h>
+
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/support/include/junction.h b/support/include/junction.h
index 7257d80b..d127dd55 100644
--- a/support/include/junction.h
+++ b/support/include/junction.h
@@ -26,6 +26,16 @@
#ifndef _NFS_JUNCTION_H_
#define _NFS_JUNCTION_H_
+/* For musl, refered to glibc's sys/cdefs.h */
+#ifndef __attribute_malloc__
+#define __attribute_malloc__ __attribute__((__malloc__))
+#endif
+
+/* For musl, refered to glibc's sys/stat.h */
+#ifndef ALLPERMS
+#define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)/* 07777 */
+#endif
+
#include <stdint.h>
/*

View file

@ -1,6 +1,6 @@
# Template file for 'nfs-utils'
pkgname=nfs-utils
version=2.7.1
version=2.8.3
revision=1
build_style=gnu-configure
configure_args="--with-statduser=nobody --enable-gss --enable-nfsv4
@ -13,14 +13,14 @@ maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later"
homepage="https://www.linux-nfs.org/"
distfiles="${KERNEL_SITE}/utils/${pkgname}/${version}/${pkgname}-${version}.tar.xz"
checksum=885c948a84a58bca4148f459588f9a7369dbb40dcc466f04e455c6b10fd0aa48
checksum=11e7c5847a8423a72931c865bd9296e7fd56ff270a795a849183900961711725
replaces="rpcgen>=0"
hostmakedepends="pkg-config libtirpc-devel rpcsvc-proto mit-krb5-devel"
makedepends="libblkid-devel libmount-devel libtirpc-devel
keyutils-devel libevent-devel mit-krb5-devel
device-mapper-devel libcap-devel sqlite-devel
libxml2-devel"
libxml2-devel libnl3-devel"
depends="rpcbind"
python_version=3
conf_files="/etc/exports"
@ -53,6 +53,7 @@ post_install() {
vsv rpcsvcgssd
vsv statd
vsv nfs-server
vsv nfsdcld
# replacement scripts
rm -rf ${DESTDIR}/usr/bin/start-statd
vbin ${FILESDIR}/start-statd