diff --git a/share/man/man4/options.4 b/share/man/man4/options.4 index 3fdf8bd94..a6ed33cc4 100644 --- a/share/man/man4/options.4 +++ b/share/man/man4/options.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: options.4,v 1.270 2023/12/14 13:34:23 claudio Exp $ +.\" $OpenBSD: options.4,v 1.271 2024/05/05 07:26:58 jsg Exp $ .\" $NetBSD: options.4,v 1.21 1997/06/25 03:13:00 thorpej Exp $ .\" .\" Copyright (c) 1998 Theo de Raadt @@ -34,7 +34,7 @@ .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .\" -.Dd $Mdocdate: December 14 2023 $ +.Dd $Mdocdate: May 5 2024 $ .Dt OPTIONS 4 .Os .Sh NAME @@ -253,18 +253,6 @@ With this option, only the superuser can set them, and they can't be cleared if the securelevel is greater than 0. See also .Xr chflags 1 . -.It Cd option FFS_SOFTUPDATES -Enables a scheme that uses partial ordering of buffer cache operations -to allow metadata updates in FFS to happen asynchronously, increasing write -performance significantly. -Normally, the FFS filesystem writes metadata updates synchronously which exacts -a performance penalty in favor of filesystem integrity. -With soft updates, the performance of asynchronous writes is gained while -retaining the safety of synchronous metadata updates. -.Pp -Soft updates must be enabled on a per-filesystem basis. -See -.Xr mount 8 . .It Cd option FIFO Adds support for .At V diff --git a/sys/conf/GENERIC b/sys/conf/GENERIC index 3ab6eb1bc..9ffe0fc34 100644 --- a/sys/conf/GENERIC +++ b/sys/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.295 2024/03/13 14:43:31 bluhm Exp $ +# $OpenBSD: GENERIC,v 1.296 2024/05/05 07:26:58 jsg Exp $ # # Machine-independent option; used by all architectures for their # GENERIC kernel @@ -29,7 +29,6 @@ option UVM_SWAP_ENCRYPT# support encryption of pages going to swap option FFS # UFS option FFS2 # UFS2 -option FFS_SOFTUPDATES # Soft updates option UFS_DIRHASH # hash large directories option QUOTA # UFS quotas option EXT2FS # Second Extended Filesystem diff --git a/sys/conf/param.c b/sys/conf/param.c index b6b5b9919..ac994d920 100644 --- a/sys/conf/param.c +++ b/sys/conf/param.c @@ -1,4 +1,4 @@ -/* $OpenBSD: param.c,v 1.49 2023/07/04 09:47:51 jsg Exp $ */ +/* $OpenBSD: param.c,v 1.50 2024/05/05 06:14:37 jsg Exp $ */ /* $NetBSD: param.c,v 1.16 1996/03/12 03:08:40 mrg Exp $ */ /* @@ -39,13 +39,6 @@ #include #include -#include -#include -#include -#include -#include -#include -#include #include #include #ifdef SYSVSHM @@ -55,9 +48,6 @@ #ifdef SYSVSEM #include #endif -#ifdef SYSVMSG -#include -#endif /* * System parameter formulae. diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 92d2f5e10..fe1aa9fc7 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.335 2023/11/10 17:43:39 krw Exp $ */ +/* $OpenBSD: sd.c,v 1.336 2024/05/04 16:40:38 kn Exp $ */ /* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */ /*- @@ -1771,7 +1771,7 @@ validate: } if (dp.disksize == 0) - goto die; + return -1; /* * Restrict secsize values to powers of two between 512 and 64k. diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c deleted file mode 100644 index e69de29bb..000000000 diff --git a/sys/ufs/ffs/ffs_softdep_stub.c b/sys/ufs/ffs/ffs_softdep_stub.c deleted file mode 100644 index e69de29bb..000000000 diff --git a/sys/ufs/ffs/softdep.h b/sys/ufs/ffs/softdep.h deleted file mode 100644 index e69de29bb..000000000 diff --git a/usr.bin/awk/FIXES b/usr.bin/awk/FIXES index c4eef3bd8..15c463067 100644 --- a/usr.bin/awk/FIXES +++ b/usr.bin/awk/FIXES @@ -25,15 +25,23 @@ THIS SOFTWARE. This file lists all bug fixes, changes, etc., made since the second edition of the AWK book was published in September 2023. +May 4, 2024 + Fixed a use-after-free bug with ARGV for "delete ARGV". + Also ENVtab is no longer global. Thanks to Benjamin Sturz + for spotting the ARGV issue and Todd Miller for the fix. + +May 3, 2024: + Remove warnings when compiling with g++. Thanks to Arnold Robbins. + Apr 22, 2024: - fixed regex engine gototab reallocation issue that was - introduced during the Nov 24 rewrite. Thanks to Arnold Robbins. + Fixed regex engine gototab reallocation issue that was + Introduced during the Nov 24 rewrite. Thanks to Arnold Robbins. Fixed a scan bug in split in the case the separator is a single - character. thanks to Oguz Ismail for spotting the issue. + character. Thanks to Oguz Ismail for spotting the issue. Mar 10, 2024: - fixed use-after-free bug in fnematch due to adjbuf invalidating - the pointers to buf. thanks to github user caffe3 for spotting + Fixed use-after-free bug in fnematch due to adjbuf invalidating + the pointers to buf. Thanks to github user caffe3 for spotting the issue and providing a fix, and to Miguel Pineiro Jr. for the alternative fix. MAX_UTF_BYTES in fnematch has been replaced with awk_mb_cur_max. diff --git a/usr.bin/awk/b.c b/usr.bin/awk/b.c index 89f4918b7..82f652216 100644 --- a/usr.bin/awk/b.c +++ b/usr.bin/awk/b.c @@ -1,4 +1,4 @@ -/* $OpenBSD: b.c,v 1.51 2024/04/25 18:33:53 millert Exp $ */ +/* $OpenBSD: b.c,v 1.52 2024/05/04 22:59:21 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -651,7 +651,7 @@ static int set_gototab(fa *f, int state, int ch, int val) /* hide gototab implem f->gototab[state].entries[0].state = val; f->gototab[state].inuse++; return val; - } else if (ch > f->gototab[state].entries[f->gototab[state].inuse-1].ch) { + } else if ((unsigned)ch > f->gototab[state].entries[f->gototab[state].inuse-1].ch) { // not seen yet, insert and return gtt *tab = & f->gototab[state]; if (tab->inuse + 1 >= tab->allocated) @@ -875,7 +875,7 @@ bool fnematch(fa *pfa, FILE *f, char **pbuf, int *pbufsize, int quantum) * Call u8_rune with at least awk_mb_cur_max ahead in * the buffer until EOF interferes. */ - if (k - j < awk_mb_cur_max) { + if (k - j < (int)awk_mb_cur_max) { if (k + awk_mb_cur_max > buf + bufsize) { char *obuf = buf; adjbuf(&buf, &bufsize, diff --git a/usr.bin/awk/lib.c b/usr.bin/awk/lib.c index 225c76968..e6a22bc6c 100644 --- a/usr.bin/awk/lib.c +++ b/usr.bin/awk/lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib.c,v 1.55 2023/11/28 20:54:38 millert Exp $ */ +/* $OpenBSD: lib.c,v 1.57 2024/05/05 02:55:34 jsg Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -332,14 +332,16 @@ int readcsvrec(char **pbuf, int *pbufsize, FILE *inf, bool newflag) /* csv can h char *getargv(int n) /* get ARGV[n] */ { + Array *ap; Cell *x; char *s, temp[50]; - extern Array *ARGVtab; + extern Cell *ARGVcell; + ap = (Array *)ARGVcell->sval; snprintf(temp, sizeof(temp), "%d", n); - if (lookup(temp, ARGVtab) == NULL) + if (lookup(temp, ap) == NULL) return NULL; - x = setsymtab(temp, "", 0.0, STR, ARGVtab); + x = setsymtab(temp, "", 0.0, STR, ap); s = getsval(x); DPRINTF("getargv(%d) returns |%s|\n", n, s); return s; @@ -845,10 +847,10 @@ int isclvar(const char *s) /* is s of form var=something ? */ { const char *os = s; - if (!isalpha((uschar) *s) && *s != '_') + if (!isalpha((uschar)*s) && *s != '_') return 0; for ( ; *s; s++) - if (!(isalnum((uschar) *s) || *s == '_')) + if (!(isalnum((uschar)*s) || *s == '_')) break; return *s == '=' && s > os; } diff --git a/usr.bin/awk/main.c b/usr.bin/awk/main.c index 11296ce12..ef5a724a8 100644 --- a/usr.bin/awk/main.c +++ b/usr.bin/awk/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.69 2024/04/25 18:33:53 millert Exp $ */ +/* $OpenBSD: main.c,v 1.70 2024/05/04 22:59:21 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -23,7 +23,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ****************************************************************/ -const char *version = "version 20240422"; +const char *version = "version 20240504"; #define DEBUG #include @@ -66,22 +66,42 @@ static noreturn void fpecatch(int n { extern Node *curnode; #ifdef SA_SIGINFO - static const char *emsg[] = { - [0] = "Unknown error", - [FPE_INTDIV] = "Integer divide by zero", - [FPE_INTOVF] = "Integer overflow", - [FPE_FLTDIV] = "Floating point divide by zero", - [FPE_FLTOVF] = "Floating point overflow", - [FPE_FLTUND] = "Floating point underflow", - [FPE_FLTRES] = "Floating point inexact result", - [FPE_FLTINV] = "Invalid Floating point operation", - [FPE_FLTSUB] = "Subscript out of range", - }; + const char *mesg = NULL; + + switch (si->si_code) { + case FPE_INTDIV: + mesg = "Integer divide by zero"; + break; + case FPE_INTOVF: + mesg = "Integer overflow"; + break; + case FPE_FLTDIV: + mesg = "Floating point divide by zero"; + break; + case FPE_FLTOVF: + mesg = "Floating point overflow"; + break; + case FPE_FLTUND: + mesg = "Floating point underflow"; + break; + case FPE_FLTRES: + mesg = "Floating point inexact result"; + break; + case FPE_FLTINV: + mesg = "Invalid Floating point operation"; + break; + case FPE_FLTSUB: + mesg = "Subscript out of range"; + break; + case 0: + default: + mesg = "Unknown error"; + break; + } #endif dprintf(STDERR_FILENO, "floating point exception%s%s\n", #ifdef SA_SIGINFO - ": ", (size_t)si->si_code < sizeof(emsg) / sizeof(emsg[0]) && - emsg[si->si_code] ? emsg[si->si_code] : emsg[0] + ": ", mesg #else "", "" #endif diff --git a/usr.bin/awk/run.c b/usr.bin/awk/run.c index 6220d5787..81bf4bd29 100644 --- a/usr.bin/awk/run.c +++ b/usr.bin/awk/run.c @@ -1,4 +1,4 @@ -/* $OpenBSD: run.c,v 1.85 2024/04/25 18:33:53 millert Exp $ */ +/* $OpenBSD: run.c,v 1.86 2024/05/04 22:59:21 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -725,7 +725,7 @@ int u8_byte2char(const char *s, int bytenum) return charnum; } -/* runetochar() adapted from rune.c in the Plan 9 distributione */ +/* runetochar() adapted from rune.c in the Plan 9 distribution */ enum { @@ -2063,7 +2063,7 @@ static char *nawk_tolower(const char *s) Cell *bltin(Node **a, int n) /* builtin functions. a[0] is type, a[1] is arg list */ { Cell *x, *y; - Awkfloat u; + Awkfloat u = 0; int t, sz; Awkfloat tmp; char *buf, *fmt; @@ -2539,7 +2539,7 @@ Cell *dosub(Node **a, int subop) /* sub and gsub */ const char *start; const char *noempty = NULL; /* empty match disallowed here */ size_t m = 0; /* match count */ - size_t whichm; /* which match to select, 0 = global */ + size_t whichm = 0; /* which match to select, 0 = global */ int mtype; /* match type */ if (a[0] == NULL) { /* 0 => a[1] is already-compiled regexpr */ diff --git a/usr.bin/awk/tran.c b/usr.bin/awk/tran.c index c2bb1e022..ba31583e9 100644 --- a/usr.bin/awk/tran.c +++ b/usr.bin/awk/tran.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tran.c,v 1.38 2023/10/30 17:52:54 millert Exp $ */ +/* $OpenBSD: tran.c,v 1.39 2024/05/04 22:59:21 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -58,8 +58,7 @@ Cell *fnrloc; /* FNR */ Cell *ofsloc; /* OFS */ Cell *orsloc; /* ORS */ Cell *rsloc; /* RS */ -Array *ARGVtab; /* symbol table containing ARGV[...] */ -Array *ENVtab; /* symbol table containing ENVIRON[...] */ +Cell *ARGVcell; /* cell with symbol table containing ARGV[...] */ Cell *rstartloc; /* RSTART */ Cell *rlengthloc; /* RLENGTH */ Cell *subseploc; /* SUBSEP */ @@ -108,36 +107,39 @@ void syminit(void) /* initialize symbol table with builtin vars */ void arginit(int ac, char **av) /* set up ARGV and ARGC */ { + Array *ap; Cell *cp; int i; char temp[50]; ARGC = &setsymtab("ARGC", "", (Awkfloat) ac, NUM, symtab)->fval; cp = setsymtab("ARGV", "", 0.0, ARR, symtab); - ARGVtab = makesymtab(NSYMTAB); /* could be (int) ARGC as well */ + ap = makesymtab(NSYMTAB); /* could be (int) ARGC as well */ free(cp->sval); - cp->sval = (char *) ARGVtab; + cp->sval = (char *) ap; for (i = 0; i < ac; i++) { double result; snprintf(temp, sizeof(temp), "%d", i); if (is_number(*av, & result)) - setsymtab(temp, *av, result, STR|NUM, ARGVtab); + setsymtab(temp, *av, result, STR|NUM, ap); else - setsymtab(temp, *av, 0.0, STR, ARGVtab); + setsymtab(temp, *av, 0.0, STR, ap); av++; } + ARGVcell = cp; } void envinit(char **envp) /* set up ENVIRON variable */ { + Array *ap; Cell *cp; char *p; cp = setsymtab("ENVIRON", "", 0.0, ARR, symtab); - ENVtab = makesymtab(NSYMTAB); + ap = makesymtab(NSYMTAB); free(cp->sval); - cp->sval = (char *) ENVtab; + cp->sval = (char *) ap; for ( ; *envp; envp++) { double result; @@ -147,9 +149,9 @@ void envinit(char **envp) /* set up ENVIRON variable */ continue; *p++ = 0; /* split into two strings at = */ if (is_number(p, & result)) - setsymtab(*envp, p, result, STR|NUM, ENVtab); + setsymtab(*envp, p, result, STR|NUM, ap); else - setsymtab(*envp, p, 0.0, STR, ENVtab); + setsymtab(*envp, p, 0.0, STR, ap); p[-1] = '='; /* restore in case env is passed down to a shell */ } } diff --git a/usr.sbin/rcctl/rcctl.8 b/usr.sbin/rcctl/rcctl.8 index 10acf76cb..63e191a4a 100644 --- a/usr.sbin/rcctl/rcctl.8 +++ b/usr.sbin/rcctl/rcctl.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: rcctl.8,v 1.44 2023/03/01 17:27:45 ajacoutot Exp $ +.\" $OpenBSD: rcctl.8,v 1.45 2024/05/05 08:16:45 ajacoutot Exp $ .\" .\" Copyright (c) 2014 Antoine Jacoutot .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: March 1 2023 $ +.Dd $Mdocdate: May 5 2024 $ .Dt RCCTL 8 .Os .Sh NAME @@ -187,8 +187,8 @@ exits with 0 if the daemon or service is enabled and 1 if it is not. .Nm Cm getdef Ar daemon | service Op Cm status exits with 0 if the daemon or service is enabled by default and 1 if it is not. -.Nm Cm ls failed -exits with 1 if an enabled daemon is not running. +.Nm Cm ls failed | rogue +exits with 1 if an enabled daemon is not running or vice versa. Otherwise, the .Nm utility exits with 0 on success, and >0 if an error occurs