diff options
-rw-r--r-- | cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 | 35 | ||||
-rw-r--r-- | lib/msun/ld128/e_rem_pio2l.h | 2 | ||||
-rw-r--r-- | lib/msun/ld128/s_logl.c | 2 | ||||
-rw-r--r-- | lib/msun/ld80/e_rem_pio2l.h | 2 | ||||
-rw-r--r-- | lib/msun/ld80/s_logl.c | 2 | ||||
-rw-r--r-- | lib/msun/src/e_rem_pio2.c | 2 | ||||
-rw-r--r-- | lib/msun/src/e_rem_pio2f.c | 2 | ||||
-rw-r--r-- | lib/msun/src/s_ccosh.c | 23 | ||||
-rw-r--r-- | lib/msun/src/s_ccoshf.c | 18 | ||||
-rw-r--r-- | lib/msun/src/s_csinh.c | 23 | ||||
-rw-r--r-- | lib/msun/src/s_csinhf.c | 18 | ||||
-rw-r--r-- | usr.sbin/chroot/chroot.c | 57 |
12 files changed, 125 insertions, 61 deletions
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 index 853538949a4d..a98d851b9998 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 @@ -20,7 +20,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 16, 2025 +.Dd July 30, 2025 .Dt DTRACE 1 .Os .Sh NAME @@ -517,6 +517,17 @@ option is not specified, .Nm does not permit the compilation or enabling of a D program that contains destructive actions. +.Pp +Set the +.Va security.bsd.allow_destructive_dtrace +.Xr loader 8 +tunable +to +.Ql 0 +to disallow the possibility of enabling destructive actions system-wide at any point at all. +Any attempts to enable destructive actions will cause +.Nm +to exit with a runtime error. .It Fl x Ar arg Op Ns = Ns value Enable or modify a DTrace runtime option or D compiler option. Boolean options are enabled by specifying their name. @@ -803,11 +814,18 @@ failed or that the specified request could not be satisfied. .It 2 Invalid command line options or arguments were specified. .El -.Sh HISTORY -The -.Nm -utility first appeared in -.Fx 7.1 . +.Sh DIAGNOSTICS +.Bl -diag +.It dtrace: could not enable tracing: Permission denied +This can happen when +.Nm +fails to enable destructive actions because +.Va security.bsd.allow_destructive_dtrace +is set to +.Ql 0 +in +.Xr loader.conf 5 . +.El .Sh SEE ALSO .Xr cpp 1 , .Xr dtrace_audit 4 , @@ -826,3 +844,8 @@ utility first appeared in .Rs .%T Solaris Dynamic Tracing Guide .Re +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 7.1 . diff --git a/lib/msun/ld128/e_rem_pio2l.h b/lib/msun/ld128/e_rem_pio2l.h index 35ed0b865a7c..d38a027dc215 100644 --- a/lib/msun/ld128/e_rem_pio2l.h +++ b/lib/msun/ld128/e_rem_pio2l.h @@ -56,7 +56,7 @@ pio2_2t = 2.0670321098263988236496903051604844e-43L, /* 0x127044533e63a0105df5 pio2_3 = 2.0670321098263988236499468110329591e-43L, /* 0x127044533e63a0105e00000000000.0p-254 */ pio2_3t = -2.5650587247459238361625433492959285e-65L; /* -0x159c4ec64ddaeb5f78671cbfb2210.0p-327 */ -static inline __always_inline int +static __always_inline int __ieee754_rem_pio2l(long double x, long double *y) { union IEEEl2bits u,u1; diff --git a/lib/msun/ld128/s_logl.c b/lib/msun/ld128/s_logl.c index 8961dd0c96db..734e0a8c2d4d 100644 --- a/lib/msun/ld128/s_logl.c +++ b/lib/msun/ld128/s_logl.c @@ -445,7 +445,7 @@ struct ld { #endif #ifdef STRUCT_RETURN -static inline __always_inline void +static __always_inline void k_logl(long double x, struct ld *rp) #else long double diff --git a/lib/msun/ld80/e_rem_pio2l.h b/lib/msun/ld80/e_rem_pio2l.h index d9e4d3a0941f..ee35b28c83fd 100644 --- a/lib/msun/ld80/e_rem_pio2l.h +++ b/lib/msun/ld80/e_rem_pio2l.h @@ -68,7 +68,7 @@ pio2_2t = 6.36831716351095013979e-25L, /* 0xc51701b839a25205.0p-144 */ pio2_3t = -2.75299651904407171810e-37L; /* -0xbb5bf6c7ddd660ce.0p-185 */ #endif -static inline __always_inline int +static __always_inline int __ieee754_rem_pio2l(long double x, long double *y) { union IEEEl2bits u,u1; diff --git a/lib/msun/ld80/s_logl.c b/lib/msun/ld80/s_logl.c index 459374d7d164..2305a906bd4e 100644 --- a/lib/msun/ld80/s_logl.c +++ b/lib/msun/ld80/s_logl.c @@ -445,7 +445,7 @@ struct ld { #endif #ifdef STRUCT_RETURN -static inline __always_inline void +static __always_inline void k_logl(long double x, struct ld *rp) #else long double diff --git a/lib/msun/src/e_rem_pio2.c b/lib/msun/src/e_rem_pio2.c index ef4107af94cb..d31cce4d6912 100644 --- a/lib/msun/src/e_rem_pio2.c +++ b/lib/msun/src/e_rem_pio2.c @@ -47,7 +47,7 @@ pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ #ifdef INLINE_REM_PIO2 -static __inline __always_inline +static __always_inline #endif int __ieee754_rem_pio2(double x, double *y) diff --git a/lib/msun/src/e_rem_pio2f.c b/lib/msun/src/e_rem_pio2f.c index 26f6bc85791b..1740b4f49a58 100644 --- a/lib/msun/src/e_rem_pio2f.c +++ b/lib/msun/src/e_rem_pio2f.c @@ -39,7 +39,7 @@ pio2_1 = 1.57079631090164184570e+00, /* 0x3FF921FB, 0x50000000 */ pio2_1t = 1.58932547735281966916e-08; /* 0x3E5110b4, 0x611A6263 */ #ifdef INLINE_REM_PIO2F -static __inline __always_inline +static __always_inline #endif int __ieee754_rem_pio2f(float x, double *y) diff --git a/lib/msun/src/s_ccosh.c b/lib/msun/src/s_ccosh.c index 95ed3a32ddd7..145d9673f392 100644 --- a/lib/msun/src/s_ccosh.c +++ b/lib/msun/src/s_ccosh.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl + * Copyright (c) 2005-2025 Bruce D. Evans and Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,7 +49,7 @@ static const double huge = 0x1p1023; double complex ccosh(double complex z) { - double x, y, h; + double c, h, s, x, y; int32_t hx, hy, ix, iy, lx, ly; x = creal(z); @@ -65,14 +65,16 @@ ccosh(double complex z) if (ix < 0x7ff00000 && iy < 0x7ff00000) { if ((iy | ly) == 0) return (CMPLX(cosh(x), x * y)); + + sincos(y, &s, &c); if (ix < 0x40360000) /* |x| < 22: normal case */ - return (CMPLX(cosh(x) * cos(y), sinh(x) * sin(y))); + return (CMPLX(cosh(x) * c, sinh(x) * s)); /* |x| >= 22, so cosh(x) ~= exp(|x|) */ if (ix < 0x40862e42) { /* x < 710: exp(|x|) won't overflow */ - h = exp(fabs(x)) * 0.5; - return (CMPLX(h * cos(y), copysign(h, x) * sin(y))); + h = exp(fabs(x)) / 2; + return (CMPLX(h * c, copysign(h, x) * s)); } else if (ix < 0x4096bbaa) { /* x < 1455: scale to avoid overflow */ z = __ldexp_cexp(CMPLX(fabs(x), y), -1); @@ -80,7 +82,7 @@ ccosh(double complex z) } else { /* x >= 1455: the result always overflows */ h = huge * x; - return (CMPLX(h * h * cos(y), h * sin(y))); + return (CMPLX(h * h * c, h * s)); } } @@ -130,7 +132,9 @@ ccosh(double complex z) if (ix == 0x7ff00000 && lx == 0) { if (iy >= 0x7ff00000) return (CMPLX(INFINITY, x * (y - y))); - return (CMPLX(INFINITY * cos(y), x * sin(y))); + + sincos(y, &s, &c); + return (CMPLX(INFINITY * c, x * s)); } /* @@ -155,3 +159,8 @@ ccos(double complex z) /* ccos(z) = ccosh(I * z) */ return (ccosh(CMPLX(-cimag(z), creal(z)))); } + +#if (LDBL_MANT_DIG == 53) +__weak_reference(ccosh, ccoshl); +__weak_reference(ccos, ccosl); +#endif diff --git a/lib/msun/src/s_ccoshf.c b/lib/msun/src/s_ccoshf.c index ba97a390c832..2851157ead42 100644 --- a/lib/msun/src/s_ccoshf.c +++ b/lib/msun/src/s_ccoshf.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl + * Copyright (c) 2005-2025 Bruce D. Evans and Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,7 @@ static const float huge = 0x1p127; float complex ccoshf(float complex z) { - float x, y, h; + float c, h, s, x, y; int32_t hx, hy, ix, iy; x = crealf(z); @@ -56,14 +56,16 @@ ccoshf(float complex z) if (ix < 0x7f800000 && iy < 0x7f800000) { if (iy == 0) return (CMPLXF(coshf(x), x * y)); + + sincosf(y, &s, &c); if (ix < 0x41100000) /* |x| < 9: normal case */ - return (CMPLXF(coshf(x) * cosf(y), sinhf(x) * sinf(y))); + return (CMPLXF(coshf(x) * c, sinhf(x) * s)); /* |x| >= 9, so cosh(x) ~= exp(|x|) */ if (ix < 0x42b17218) { /* x < 88.7: expf(|x|) won't overflow */ - h = expf(fabsf(x)) * 0.5F; - return (CMPLXF(h * cosf(y), copysignf(h, x) * sinf(y))); + h = expf(fabsf(x)) / 2; + return (CMPLXF(h * c, copysignf(h, x) * s)); } else if (ix < 0x4340b1e7) { /* x < 192.7: scale to avoid overflow */ z = __ldexp_cexpf(CMPLXF(fabsf(x), y), -1); @@ -71,7 +73,7 @@ ccoshf(float complex z) } else { /* x >= 192.7: the result always overflows */ h = huge * x; - return (CMPLXF(h * h * cosf(y), h * sinf(y))); + return (CMPLXF(h * h * c, h * s)); } } @@ -87,7 +89,9 @@ ccoshf(float complex z) if (ix == 0x7f800000) { if (iy >= 0x7f800000) return (CMPLXF(INFINITY, x * (y - y))); - return (CMPLXF(INFINITY * cosf(y), x * sinf(y))); + + sincosf(y, &s, &c); + return (CMPLXF(INFINITY * c, x * s)); } return (CMPLXF(((long double)x * x) * (y - y), diff --git a/lib/msun/src/s_csinh.c b/lib/msun/src/s_csinh.c index 1bd78b1e49bf..8ea97970af7f 100644 --- a/lib/msun/src/s_csinh.c +++ b/lib/msun/src/s_csinh.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl + * Copyright (c) 2005-2025 Bruce D. Evans and Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,7 +49,7 @@ static const double huge = 0x1p1023; double complex csinh(double complex z) { - double x, y, h; + double c, h, s, x, y; int32_t hx, hy, ix, iy, lx, ly; x = creal(z); @@ -65,14 +65,16 @@ csinh(double complex z) if (ix < 0x7ff00000 && iy < 0x7ff00000) { if ((iy | ly) == 0) return (CMPLX(sinh(x), y)); + + sincos(y, &s, &c); if (ix < 0x40360000) /* |x| < 22: normal case */ - return (CMPLX(sinh(x) * cos(y), cosh(x) * sin(y))); + return (CMPLX(sinh(x) * c, cosh(x) * s)); /* |x| >= 22, so cosh(x) ~= exp(|x|) */ if (ix < 0x40862e42) { /* x < 710: exp(|x|) won't overflow */ - h = exp(fabs(x)) * 0.5; - return (CMPLX(copysign(h, x) * cos(y), h * sin(y))); + h = exp(fabs(x)) / 2; + return (CMPLX(copysign(h, x) * c, h * s)); } else if (ix < 0x4096bbaa) { /* x < 1455: scale to avoid overflow */ z = __ldexp_cexp(CMPLX(fabs(x), y), -1); @@ -80,7 +82,7 @@ csinh(double complex z) } else { /* x >= 1455: the result always overflows */ h = huge * x; - return (CMPLX(h * cos(y), h * h * sin(y))); + return (CMPLX(h * c, h * h * s)); } } @@ -129,7 +131,9 @@ csinh(double complex z) if (ix == 0x7ff00000 && lx == 0) { if (iy >= 0x7ff00000) return (CMPLX(x, y - y)); - return (CMPLX(x * cos(y), INFINITY * sin(y))); + + sincos(y, &s, &c); + return (CMPLX(x * c, INFINITY * s)); } /* @@ -155,3 +159,8 @@ csin(double complex z) z = csinh(CMPLX(cimag(z), creal(z))); return (CMPLX(cimag(z), creal(z))); } + +#if (LDBL_MANT_DIG == 53) +__weak_reference(csinh, csinhl); +__weak_reference(csin, csinl); +#endif diff --git a/lib/msun/src/s_csinhf.c b/lib/msun/src/s_csinhf.c index b1f333955e53..530ac63b6a27 100644 --- a/lib/msun/src/s_csinhf.c +++ b/lib/msun/src/s_csinhf.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl + * Copyright (c) 2005-2025 Bruce D. Evans and Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,7 @@ static const float huge = 0x1p127; float complex csinhf(float complex z) { - float x, y, h; + float c, h, s, x, y; int32_t hx, hy, ix, iy; x = crealf(z); @@ -56,14 +56,16 @@ csinhf(float complex z) if (ix < 0x7f800000 && iy < 0x7f800000) { if (iy == 0) return (CMPLXF(sinhf(x), y)); + + sincosf(y, &s, &c); if (ix < 0x41100000) /* |x| < 9: normal case */ - return (CMPLXF(sinhf(x) * cosf(y), coshf(x) * sinf(y))); + return (CMPLXF(sinhf(x) * c, coshf(x) * s)); /* |x| >= 9, so cosh(x) ~= exp(|x|) */ if (ix < 0x42b17218) { /* x < 88.7: expf(|x|) won't overflow */ - h = expf(fabsf(x)) * 0.5F; - return (CMPLXF(copysignf(h, x) * cosf(y), h * sinf(y))); + h = expf(fabsf(x)) / 2; + return (CMPLXF(copysignf(h, x) * c, h * s)); } else if (ix < 0x4340b1e7) { /* x < 192.7: scale to avoid overflow */ z = __ldexp_cexpf(CMPLXF(fabsf(x), y), -1); @@ -71,7 +73,7 @@ csinhf(float complex z) } else { /* x >= 192.7: the result always overflows */ h = huge * x; - return (CMPLXF(h * cosf(y), h * h * sinf(y))); + return (CMPLXF(h * c, h * h * s)); } } @@ -87,7 +89,9 @@ csinhf(float complex z) if (ix == 0x7f800000) { if (iy >= 0x7f800000) return (CMPLXF(x, y - y)); - return (CMPLXF(x * cosf(y), INFINITY * sinf(y))); + + sincosf(y, &s, &c); + return (CMPLXF(x * c, INFINITY * s)); } return (CMPLXF(((long double)x + x) * (y - y), diff --git a/usr.sbin/chroot/chroot.c b/usr.sbin/chroot/chroot.c index 208be32f85ab..b762157046d6 100644 --- a/usr.sbin/chroot/chroot.c +++ b/usr.sbin/chroot/chroot.c @@ -73,7 +73,9 @@ main(int argc, char *argv[]) gid = 0; uid = 0; + gids = 0; user = group = grouplist = NULL; + gidlist = NULL; nonprivileged = false; while ((ch = getopt(argc, argv, "G:g:u:n")) != -1) { switch(ch) { @@ -89,6 +91,11 @@ main(int argc, char *argv[]) break; case 'G': grouplist = optarg; + + /* + * XXX Why not allow us to drop all of our supplementary + * groups? + */ if (*grouplist == '\0') usage(); break; @@ -120,29 +127,37 @@ main(int argc, char *argv[]) } } - ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1; - if ((gidlist = malloc(sizeof(gid_t) * ngroups_max)) == NULL) - err(1, "malloc"); - for (gids = 0; - (p = strsep(&grouplist, ",")) != NULL && gids < ngroups_max; ) { - if (*p == '\0') - continue; - - if (isdigit((unsigned char)*p)) { - gidlist[gids] = (gid_t)strtoul(p, &endp, 0); - if (*endp != '\0') - goto getglist; - } else { + if (grouplist != NULL) { + ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1; + if ((gidlist = malloc(sizeof(gid_t) * ngroups_max)) == NULL) + err(1, "malloc"); + /* Populate the egid slot in our groups to avoid accidents. */ + if (gid == 0) + gidlist[0] = getegid(); + else + gidlist[0] = gid; + for (gids = 1; (p = strsep(&grouplist, ",")) != NULL && + gids < ngroups_max; ) { + if (*p == '\0') + continue; + + if (isdigit((unsigned char)*p)) { + gidlist[gids] = (gid_t)strtoul(p, &endp, 0); + if (*endp != '\0') + goto getglist; + } else { getglist: - if ((gp = getgrnam(p)) != NULL) - gidlist[gids] = gp->gr_gid; - else - errx(1, "no such group `%s'", p); + if ((gp = getgrnam(p)) != NULL) + gidlist[gids] = gp->gr_gid; + else + errx(1, "no such group `%s'", p); + } + gids++; } - gids++; + + if (p != NULL && gids == ngroups_max) + errx(1, "too many supplementary groups provided"); } - if (p != NULL && gids == ngroups_max) - errx(1, "too many supplementary groups provided"); if (user != NULL) { if (isdigit((unsigned char)*user)) { @@ -168,7 +183,7 @@ main(int argc, char *argv[]) if (chdir(argv[0]) == -1 || chroot(".") == -1) err(1, "%s", argv[0]); - if (gids && setgroups(gids, gidlist) == -1) + if (gidlist != NULL && setgroups(gids, gidlist) == -1) err(1, "setgroups"); if (group && setgid(gid) == -1) err(1, "setgid"); |