Commit Graph

21179 Commits

Author SHA1 Message Date
rin ea48808d5f libpthread/Makefile: trailing whitespace 2023-09-14 03:17:02 +00:00
dholland bd3bb89429 ctime.3: fix merge mistake
The paragraphs about the *_r and *_z/rz functions belong at the end of
the section (or somewhere like that), not affixed to the description of
difftime in the middle of the list of functions.
2023-09-12 21:56:05 +00:00
uwe 01a19e2f71 sparc_v8.S: fix v8 .mul/.umul versions to conform to psABI
Both .mul and .umul are defined to return the most significant 32 bits
of the result in %o1, but v8 multiplication instructions put them in
%y.  Move them to %o1.  Nothing in the gcc generated code depends on
this, but hand-written assembly can rely on this and e.g. Self does.
2023-09-11 12:00:45 +00:00
christos 03645a16a3 PR/57609: Carl Engvall: Add salen checks but accept larger sizes
(upto sockaddr_storage)
2023-09-08 18:17:41 +00:00
ad 340135473f raise() has understood threads for a long time, don't reimplment it. 2023-09-07 19:59:20 +00:00
riastradh 83df26257c pam_ksu(8): Allow homedir access during kuserok.
Otherwise, the default kuserok logic to look at ~targetuser/.k5login
would be blocked by the security measure to thwart NetBSD-SA2023-005.

(There are other ways, e.g. setting SYSTEM-K5LOGIN in /etc/krb5.conf
so the file is /etc/k5login.d/user instead of ~user/.k5login, but
that's not the default configuration and there are plenty of
deployments that rely on ~user/.k5login today.)

I reviewed libkrb5 for homedir access checks.  There are three:

1. krb5_config_parse_file_multi, called only by:
   - verify_krb5_conf -- not relevant
   - krb5_config_parse_file -- not used here as far as I can tell,
     only by libhdb ldap logic and test code in heimdal
   - krb5_set_config_files -- used here only via krb5_init_context,
     which is done at this point

2. plugin_get_hosts in krbhst.c, used to look up hosts for KDC I/O,
   which shouldn't be happening at this point, so this is almost
   certainly unreachable; also it only appears to control whether
   some old plugin API can be used, long after we have read the krb5
   config controlling which plugins are available, so this is
   probably harmless

3. krb5_kuserok, which is the one we want to allow

Note: This will have to be updated again in the next Heimdal update,
which eliminates the global homedir access flag in favour of making
the default per-context homedir access flag conditional on !issuid.

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-09-07 11:27:57 +00:00
riastradh 40ca0b4614 lib: Handle various external lib directories with build_install.
This way, update builds track shlib major bumps correctly.

For example, suppose you had built Heimdal's libkrb5.so.27 and
libgssapi.so.11 linked against it, and then you updated past the recent
shlib major bump raising them to libkrb5.so.28 and libgssapi.so.12.

Without this change, the build will make the following sequence of
targets (interleaved with some others):

1. make dependall in libkrb5
2. make dependall in libgssapi
3. make install in libkrb5
4. make install in libgssapi

The existing .WAIT tags in SUBDIR ensure that (1) happens before (2)
and (3) happens before (4).  Unfortunately, this sequence is wrong,
because it will produce the following effect:

1. make dependall in libkrb5 builds libkrb5.so.28
2. make dependall in libgssapi builds libgssapi.so.12, linked against
   libkrb5.so.27
3. make install in libkrb5 installs libkrb5.so.28
4. make install in libgssapi installs libgssapi.so.12

Why the out-of-date libkrb5.so.27 in step (2)?  Because we just pass
-L${DESTDIR}/usr/lib -lkrb5 to the linker (or the equivalent with
--sysroot and implied -L/usr/lib), and ${DESTDIR}/usr/lib still has
only libkrb5.so.27 by the time of step (2), not libkrb5.so.28.

Now any applications that link against libkrb5.so _and_ libgssapi.so
will get libkrb5.so.28 and libgssapi.so.12 -- but transitively, via
libgssapi.so.12, they will also get libkrb5.so.27, which is a recipe
for disaster.

Splicing the Heimdal library subdirectories into lib/Makefile, as
this does, ensures that we run make dependall _and_ make install in
libkrb5 _before_ make dependall in libgssapi, giving the following
correct sequence:

1. make dependall in libkrb5 builds libkrb5.so.28
2. make install in libkrb5 installs libkrb5.so.28
3. make dependall in libgssapi builds libgssapi.so.12, linked against
   libkrb5.so.28
4. make install in libgssapi installs libgssapi.so.12

Note that LIBDPLIBS isn't enough here, as implemented.  LIBDPLIBS
ensures that the incremental build will remake libgssapi.so.  But it
doesn't ensure that the new libkrb5.so.28 is available before then,
so it doesn't prevent this problem.

We use the same mechanism for crypto/external/bsd/openssl/lib
already; this just extends it to other external library collections.

As an alternative, in principle perhaps we could teach LIBDPLIBS to
ensure that libkrb5.so comes out of the libkrb5 objdir, and not out
of ${DESTDIR}/usr/lib.  But that requires some work to make happen,
and make it reliable, whereas this approach we've already confirmed
works without other adverse consequences (besides leaving
grody-looking mechanism lying around) for the libcrypto major bump
already.  We need to get this pulled up to the branch so all the
other major bumps it required are handled correctly by update builds.

XXX pullup-10
2023-09-06 23:44:42 +00:00
ad 22b5550884 Node that aarch64 implements CAS. 2023-09-06 20:17:42 +00:00
riastradh 4604ab506a */shlib_version: Ensure a boring line between RCS id and all else.
This makes cherry-picks easier by avoiding conflicts between the RCS
id and the interesting changes.
2023-09-06 12:48:15 +00:00
mrg c580d690fa apply -Wno-dangling-pointer to callcontext.c.
puffs_cc_getcc() uses a mask against a stack variable to find the
struct puffs_cc stashed below the stack, triggering the dangling
pointer problem.
2023-09-05 00:12:14 +00:00
mrg 407611763a apply ${CC_WNO_STRINGOP_OVERFLOW} for crypt.c.
init_perm() takes a larger array than IE3264[] is, but it doesn't use more
for this instance.
2023-09-04 23:00:48 +00:00
mrg 0ad391080c fix pointer vs array function definition issues.
for the backend End and Data functions, use "char buf[HASH_STRLEN]"
instead of "char *buf", to match the public functions.

fixes GCC 12 warning.
2023-09-04 20:51:39 +00:00
riastradh 3587d6f89c libc_aligned, libc_fp: Add missing close-paren.
Did this ever work?
2023-09-04 18:16:53 +00:00
riastradh 76060e8bb2 libss, liblwres: Delete makefiles for long-dead external libraries.
No functional change intended -- these haven't been used in years.
2023-09-04 18:16:42 +00:00
riastradh ad69f62aa2 Recursively revbump all dependents of libcrypto.
Otherwise any existing software linked against the openssl11
libcrypto.so.14 and any of these libraries will suddenly start
pulling in libcrypto.so.15 at the same time, leading to mayhem in the
address space.

PR lib/57603

XXX pullup-10
2023-09-04 18:12:44 +00:00
mrg 377714d879 avoid array-bounds issues by using more complete types.
also, don't cast to a type that includes an extra, unused, member.

while here, replace the hard coded offsets in setjmp.S and some
asserts in longjmp.c with assym.h and shared structures for all
the movings parts, and asserts based upon those structures.

avoids GCC 12 warnings.
2023-09-03 21:41:45 +00:00
christos d5c6fca106 - cast GETNEXT to unsigned where it is being promoted to int to prevent
sign-extension (really it would have been better for PEEK*() and GETNEXT()
  to return unsigned char; this would have removed a ton of (uch) casts, but
  it is too intrusive for now).
- fix an isalpha that should have been iswalpha
2023-08-30 20:37:24 +00:00
rin 916b154777 libkvm: whitespace 2023-08-23 14:00:11 +00:00
rin 6c2fafb153 libexecinfo: whitespace, missing RCSID, no binary changes 2023-08-23 12:24:59 +00:00
rin c0141d3aff lib/Makefile: Hook libgmp also for MKGDB=yes build
Now, gdb 13 can be built by clang, at least on amd64.
2023-08-20 02:07:54 +00:00
andvar e616cf290c s/logigally/logically/. 2023-08-17 14:21:18 +00:00
rin 12ff6354c6 libcrypt: trailing white space 2023-08-14 02:22:35 +00:00
riastradh 03840421c9 vis(3): Per KNF, sys/param.h comes before sys/types.h.
Which is nice because that's also lexicographic.
2023-08-13 15:20:37 +00:00
riastradh dbb433e7d2 vis(3): Need <stdint.h> for SIZE_MAX, per C standard.
From Kyle Evans <kevans@FreeBSD.org>.

Followup to PR lib/57573.

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-08-13 15:19:24 +00:00
riastradh 5f1a044720 vis(3): Sort includes. No functional change intended.
Prompted by PR lib/57573.

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-08-13 15:19:13 +00:00
riastradh 45c2d29183 strncpy(3): More on how strlcpy is not a safe strncpy replacement. 2023-08-13 11:27:22 +00:00
wiz dde43aa723 memcpy: consistency in prototype and fix sentence 2023-08-13 04:20:07 +00:00
riastradh 8a22324f3b vis(3): Fix one more buffer overrun in an edge case.
PR lib/57573

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-08-12 12:48:52 +00:00
riastradh 6d340e9776 vis(3): Fix main part of PR lib/57573.
From Kyle Evans <kevans@FreeBSD.org>.

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-08-12 12:48:37 +00:00
riastradh c0d7be47dd vis(3): Avoid potential arithmetic overflow in maxolen.
Can't easily prove that this overflow is impossible, so let's add a
check.

Prompted by PR lib/57573.

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-08-12 12:48:17 +00:00
riastradh 5bc0959c19 vis(3): Call wcslen(start) only once.
It had better not change between these two times!

Prompted by PR lib/57573.

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-08-12 12:48:01 +00:00
riastradh 4476814b92 vis(3): Avoid arithmetic overflow before calloc(3).
Prompted by PR lib/57573.

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-08-12 12:47:17 +00:00
riastradh 0da31b0324 vis(3): Make mbslength unsigned.
Sprinkle assertions and comments justifying the proposition that it
would never go negative if signed.

Obviates need to worry about mblength > SSIZE_MAX.

Prompted by PR lib/57573.

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-08-12 12:46:50 +00:00
riastradh 292538aef5 vis(3): Make maxolen unsigned size_t, not ssize_t.
It is initialized once either to *dlen, which is unsigned size_t, or
to wcslen(start) * MB_MAX_LEN + 1, and wcslen returns unsigned size_t
too.  So there appears to have never been any reason for this to be
signed.

Part of PR lib/57573.

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-08-12 12:46:33 +00:00
riastradh 8663f611f9 strncpy(3): Fix column sizing. 2023-08-11 21:32:26 +00:00
riastradh f9ab7ea1fa strlcpy(3): Tweak markup. 2023-08-11 21:30:32 +00:00
riastradh 1e1d50bc3a strlcpy(3), strncpy(3): Omit needless (void) casts in examples.
The return values are not critical.
2023-08-11 21:20:39 +00:00
riastradh 13b8c448a3 strcpy(3), strlcpy(3), strncpy(3): Just say `byte', not `character'. 2023-08-11 21:17:16 +00:00
riastradh 312767bb97 strncpy(3): Tiny wording tweak. 2023-08-11 21:12:10 +00:00
riastradh 59f2c9f1d8 strncpy(3): Reword to make sentence structure parallel. 2023-08-11 21:11:21 +00:00
riastradh 0c12668de1 strncpy(3): Fix typo -- stpncpy, not stpcpy which is different. 2023-08-11 21:10:26 +00:00
riastradh 71bfa8b23f strncpy(3): Take another whack at clarifying this.
Emphasize the fixed-buffer nature of it, and that NUL-termination is
neither required on input nor guaranteed on output.
2023-08-11 21:09:11 +00:00
riastradh f6905a9fb3 strlcpy(3): Nix stray space between `NUL' and `-terminating'. 2023-08-11 16:34:28 +00:00
uwe cfbafd895b strlcpy(3): don't use \*[Ge] for >= - it's wrong for source code
In the PostScript output it produces the single mathematical "greater
or equal" symbol, not the ">=".
2023-08-11 16:06:10 +00:00
riastradh 86913c27a1 strcpy(3): Note that strlcpy(3) is a safer replacement for strcpy(3).
Suggest snprintf("%s") as a more portable alternative too.

Note that both strlcpy and snprintf still require the input to be
NUL-terminated.
2023-08-11 16:05:56 +00:00
riastradh 8d073134df strncpy(3): Rework the example in an attempt to improve exposition. 2023-08-11 16:04:25 +00:00
riastradh 970f82730a strncpy(3): Note strcpy(3) man page revision this forked from. 2023-08-11 15:37:55 +00:00
riastradh 79c9375f5b strcpy(3), strlcpy(3), strncpy(3): Use `.Tn NUL' for the zero byte.
Let's be consistent within these man pages.  (If someone else really
likes the unpronounceable `.Ql \e0' better, that's fine, you can go
through and systematically change all the man pages to use that after
we're done clarifying strcpy(3), strncpy(3), and strlcpy(3).)
2023-08-11 15:36:17 +00:00
uwe 21d6631bb6 strncpy(3): markup tweaks
NUL is a character name, not a defined name, use .Tn
.Ns has implicit .No effect
Use \*q for ASCII quotes (.Dq uses fancy typographical ones)
2023-08-11 13:18:24 +00:00
uwe ea622231f9 strncpy(3): use .Sm off/on around a fancy expression to avoid lots of Ns 2023-08-11 13:10:59 +00:00
ryoon 7bd94317cb Install strncpy.3 to fix build 2023-08-11 13:07:17 +00:00
riastradh dfb89f3791 strncpy(3): Slightly more consistency about NUL vs '\0' in the text. 2023-08-11 12:26:59 +00:00
riastradh 6a5dfcb3ba strncpy(3): Qualify example of strlcpy(3) with a major caveat. 2023-08-11 11:51:54 +00:00
riastradh d3fccc7122 strncpy(3), stpncpy(3): Split man page out of strcpy(3), stpcpy(3).
These are for substantively different purposes (fixed-width fields
with optional NUL padding vs NUL-terminated strings), so they don't
belong together.

Be more specific about the security issues.
2023-08-11 09:39:39 +00:00
riastradh f69a667415 strlcpy(3): Rework man page to clarify relation to strncpy(3).
Add caveats explaining when strlcpy(3) and strlcat(3) are dangerously
inadequate or inappropriate.

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-08-11 08:15:30 +00:00
mrg 45c979d21c remove the -O0 force for _int_strtod_l() and GCC 9, it's fixed in GCC 10 and 12.
this was triggering sh3 GCC 12 to fail compiles because of ssp.h's memcpy()
frontend having the always_inline attribute that didn't match -O0 or so.

tested with pkgsrc gcc9 to confirm it hangs there, but newer versions are fine.

also known as PR#55668, which now has a real fix (gcc 10 :-).
2023-08-11 06:02:46 +00:00
mrg aec4d439cd avoid various use-after-free issues.
create a ptrdiff_t offset between the start of an allocation region and
some interesting pointer, so it can be adjusted with this offset after
realloc() returns.

found by GCC 12.
2023-08-10 20:38:00 +00:00
riastradh 33ce193df2 libc/resolv/res_debug.c: Minor whitespace fixes. 2023-08-09 07:01:09 +00:00
riastradh b3b6b684eb libnpf(3): No need for weird padding any more.
cdbw_output never needed it at runtime, and the declaration no longer
makes gcc angry about not having it.
2023-08-08 10:36:04 +00:00
riastradh 72254be91c cdbw(3): Make cdbw_output descr parameter type less confusing.
This is a string of _up to_ 16 bytes, used with strncpy(..., 16).
Specifying `const char descr[16]', while formally equivalent to
`const char *descr' in standard C, now provokes the ire of gcc when
the caller does not provide a buffer of at least 16 bytes.
2023-08-08 10:34:08 +00:00
mrg 195e7a0895 avoid uninitialised variable accesses.
if __kernel_rem_pio2() or __kernel_rem_pio2f() are called with "nx" less
than 2, the local variable fq[0] may be accessed uninitialised.

__kernel_rem_pio2() has direct calls with nx = 1, and __kernel_rem_pio2f()
is called with a value starting at 3, but may be decreased to less than 2,
implied by this code , if not actually avoided by the tx[] setup above:
	nx = 3;
	while(tx[nx-1]==zero) nx--;     /* skip zero term */
	n  =  __kernel_rem_pio2f(tx,y,e0,nx,2,two_over_pi);

found by GCC 12.
2023-08-08 06:31:17 +00:00
rin 54684bbd74 libm: Add fma(3) and friends to m68k 2023-08-08 02:09:42 +00:00
riastradh a8b57fa134 libm: Add dummy remainderl and remquol.
These are pretty bad -- these aren't transcendental functions; not
rocket science to make them correctly rounded -- but let's just make
sure they're available in libm for netbsd-10.

XXX pullup-10
2023-08-07 08:54:40 +00:00
andvar 506971ff58 fix typos in comments and one definition, mainly s/sucket/socket/. 2023-08-03 20:45:49 +00:00
rin 03675fcefd Revert CC_WNO_USE_AFTER_FREE from Makefile's (thanks uwe@) 2023-08-03 14:56:36 +00:00
rin 91f8ac6d30 Sprinkle CC_WNO_USE_AFTER_FREE for GCC 12
All of them are blamed for idiom equivalent to:
	newbuf = realloc(buf, size);
	p = newbuf + (p - buf);
2023-08-03 13:36:08 +00:00
nia e6ea867424 Revert addition of epoll to libc until discussion concludes 2023-08-03 12:24:46 +00:00
gutteridge b60029512a select.2: note when pselect(2) was added 2023-08-01 23:33:04 +00:00
andvar 1e7139f024 fix RCSIDs. 2023-08-01 20:09:12 +00:00
christos b515b5959a Add companion mempcpy to wmempcpy, bump. 2023-08-01 17:51:24 +00:00
mrg f386908b27 convert explicit length check before unchecked snprintf() with just a
overflow checked snprintf().  for res_debug.c and res_query.c, convert
from sprintf() to snprintf().

tested scp and rcp fail properly with too-long paths.
tested getaddrinfo fails as expected for too-long domains.
tested dig and ping for similar (res_debug.c/res_query.c).
created a temporary fs with quotas to test edquota with a long EDITOR.
did not test ypserv directly, but it's the same pattern.

avoids GCC 12 snprintf() warnings, and reduces total code size.
2023-08-01 08:47:24 +00:00
mrg 1115bcb541 cdbw_output()'s 3rd argument must be a 16-byte char array, so pad the
string literals passed to it with enough nuls to make this true.

found by GCC 12.
2023-08-01 07:57:17 +00:00
mrg a916878419 pass the struct size to malloc(), not the pointer size.
found by GCC 12.
2023-08-01 07:56:23 +00:00
mrg f8570f8a97 fix simple mis-matched function prototype and definitions.
most of these are like, eg

   void foo(int[2]);

with either of these

   void foo(int*) { ... }
   void foo(int[]) { ... }

in some cases (such as stat or utimes* calls found in our header files),
we now match standard definition from opengroup.

found by GCC 12.
2023-08-01 07:04:14 +00:00
christos 6a8ddfc018 new gdb needs wmempcpy, give it to it. 2023-07-31 17:38:28 +00:00
rin fb68413f18 librump*: Require 10.99.7 or higher for __kevent100 2023-07-31 04:37:04 +00:00
rin 437217c4cf libc: Warn of __kevent50 when itself (not kevent) is referenced 2023-07-29 10:01:24 +00:00
wiz 6805bcc8e7 Fix some macro( usage)s 2023-07-28 23:41:16 +00:00
wiz f9cde7647a Remove Pp that have no effect. 2023-07-28 23:41:02 +00:00
christos d11110f473 Add epoll(2) from Theodore Preduta as part of GSoC 2023 2023-07-28 18:18:59 +00:00
rin af16b93898 vax/csu: __start: Use 0x0000 as entry mask instead of 0x0101 (two NOPs)
This was a quite common trick to able to load executables with a.out
headers stripped. Now, the system boots successfully into multi-user
mode without this trick.

Thanks ragge@ for kind explanation:
https://mail-index.netbsd.org/port-vax/2023/07/28/msg004397.html
2023-07-28 11:22:43 +00:00
rin e38ad7bbb4 vax/csu: Use register name provided by asm.h. No binary changes. 2023-07-28 07:17:30 +00:00
rin da4387c8fe vax/csu: __do_global_ctors_aux: Save actually-used r8, instead of r11
Thanks Kalvis Duckmanton for report and patch on tech-toolchain:
https://mail-index.netbsd.org/tech-toolchain/2023/07/28/msg004321.html
2023-07-28 07:04:41 +00:00
rin 09a8fdebe9 Fix formatting corruption for manpages from tzcode.
Comment out .TH macros, that cause mandoc(1) to run into man(7) mode.
2023-07-26 09:17:20 +00:00
skrll bf81166fc6 ENTRY / END indentation. NFCI. 2023-07-23 07:25:04 +00:00
skrll aa878f8760 Indentation consistency. NFCI. 2023-07-23 07:24:20 +00:00
gutteridge a20ee0c592 socket.2: simplify and improve some phrasing 2023-07-20 23:28:44 +00:00
riastradh 6df7a1dc79 libc: Use RB_TREE_INITIALIZER to nix initfini.c/_env.c coupling.
Doesn't actually help to remove _env.c from programs that don't use
it, though, because various internal things like __diagassert13 still
call getenv.
2023-07-18 11:44:32 +00:00
lukem 94b016701c librumpuser/configure: regen for URL fixes 2023-07-15 09:22:44 +00:00
lukem 9d506c2f2d librumpuser/configure: fix missing directory warning
Use "build-aux" instead of the non-existant "m4" as the
directory for AC_CONFIG_MACRO_DIR.

Avoids autoreconf warning:
  aclocal: warning: couldn't open directory 'm4': No such file or directory

No change to generated files.
2023-07-15 09:21:36 +00:00
lukem cfee6e9176 fix rump URLs
Link to https://github.com/rumpkernel/ instead of
a site now taken over by an SEO squatter.

Per discussion on github.com/rumpkernel issues with pooka.

PR misc/57501
2023-07-14 23:28:01 +00:00
pho 5261503048 refuse(3): Fix broken 3.5, 3.6, and 3.7 APIs
These API versions were completely missing from refuse/fs.c. User programs
could request these versions and build fine, but they couldn't even
initialize a FUSE context at run time.
2023-07-14 02:43:50 +00:00
christos 7eace3da0c Add memfd_create(2) from GSoC 2023 by Theodore Preduta 2023-07-10 02:31:54 +00:00
rin 124e9063d8 libm: Add missing fma(3) and friends for sh3. 2023-07-09 03:57:09 +00:00
simonb 2a7583869f Make mstats() decl match prototype so this compiles with -DMSTATS. 2023-07-08 04:09:26 +00:00
riastradh 67e5e79509 select(2), poll(2): Clarify return values. 2023-07-07 01:31:25 +00:00
uwe 5c44d8113a bsdmalloc(3): fix malloc() signature 2023-07-06 01:32:52 +00:00
riastradh d5888fcbdb libbsdmalloc: Use a multiply-overflow that clang supports too.
XXX pullup-10
2023-07-05 22:13:20 +00:00
lukem 0ae90b729a mk.conf(5): document rump variables
Update mk.conf(5) with the rump variables from
- lib/librumpuser/README.compileopts
- sys/rump/README.compileopts

Add cross-references back to mk.conf(5) in those files.

Ensure that the Default: is listed last in a description,
for consistency with the convention in this file.
2023-07-05 16:40:33 +00:00
riastradh 9e6ac21a6f libbsdmalloc: Make aligned_alloc(A, S) actually align when A > S.
XXX pullup-10
2023-07-05 12:08:49 +00:00
riastradh c9e3880ca2 libbsdmalloc: Lift C11 divisibility restriction on aligned_alloc.
Restriction was lifted in C17.

XXX pullup-10
2023-07-05 10:57:44 +00:00
rillig 3cc9538e51 bsdmalloc.3: fix typos in function parameters 2023-07-05 07:13:56 +00:00
riastradh 4651d9e04b libbsdmalloc: Fix build with DEBUG.
Nix __P while here.

XXX pullup-10
2023-07-05 01:15:47 +00:00
riastradh aeee56d1a9 libc: Fix missing membar_consumer in dl_iterate_phdr.
Pairs with the existing membar_producer.

XXX pullup-8
XXX pullup-9
XXX pullup-10
2023-07-04 19:24:25 +00:00
riastradh 6c3f4940f3 libbsdmalloc: Nix K&R definitions. Bump WARNS to 3. 2023-07-04 18:40:14 +00:00
riastradh 2daa8bfe20 libbsdmalloc: New man page.
XXX pullup-10
2023-07-04 16:23:15 +00:00
riastradh 77b23e4e0e libbsdmalloc: Bump shlib minor.
New symbols, new minor.

XXX pullup-10
2023-07-04 16:22:10 +00:00
riastradh d95fa52655 libbsdmalloc: Nix trailing whitespace.
No functional change intended.

XXX pullup-10
2023-07-04 15:09:04 +00:00
riastradh d6f78684fe libbsdmalloc: Provide all allocator front ends and fork hooks.
Front ends:

- aligned_alloc
- calloc
- posix_memalign

Fork hooks:

- _malloc_prefork
- _malloc_postfork
- _malloc_postfork_child

Otherwise these will pull in the jemalloc definitions from libc,
which (a) defeats the purpose, and (b) won't work correctly with
fork and threads.

Thanks to kre@ and the thread on tech-userlevel for pointing me in
the right direction to making this actually work to override
jemalloc:

https://mail-index.netbsd.org/tech-userlevel/2023/06/30/msg013957.html

Note: libbsdmalloc doesn't set errno=ENOMEM on malloc failure, but
these front ends do (even aligned_alloc, which is from C11, which
doesn't define ENOMEM at all, but this pacifies our aligned_alloc
tests in t_posix_memalign.c).  Might want to fix that.

XXX pullup-10
2023-07-04 15:08:55 +00:00
riastradh 437cf891b2 getrandom(2): Reduce editorializing tone in man page.
XXX pullup-10
2023-07-02 13:25:52 +00:00
dholland 4d2a6699db libc/shlib_version: note that *rand48* should be punted to libcompat 2023-07-02 00:52:04 +00:00
uwe 31f1ed95bf getentropy(3): use .Sx to xref CAVEATS 2023-06-30 22:15:14 +00:00
riastradh b36d83c44f getrandom(2), getentropy(3): Rework man pages.
Make supportable promises.  Omit needless verbiage.  Give caveats
with cross-references to entropy(7).  Emphasize that security is
necessarily relative to system configuration.

XXX pullup-10
2023-06-30 21:44:22 +00:00
riastradh d378359a95 vis(3): Avoid nonportable MIN in portable code. 2023-06-29 16:11:31 +00:00
msaitoh 37a23ecf39 Fix typo in comment. 2023-06-24 05:18:12 +00:00
wiz c8799c5889 libedit: fix pkg-config to really provide readline directory as intended 2023-06-21 21:44:31 +00:00
wiz c093f0b69f install pkg-config file for libedit
version number matches portable libedit
--cflags output matches portable libedit, since users probably want the
readline interface
2023-06-20 23:09:13 +00:00
riastradh ed4af7289b pam_krb5: Refuse to operate without a key to verify tickets.
New allow_kdc_spoof overrides this to restore previous behaviour
which was vulnerable to KDC spoofing, because without a host or
service key, pam_krb5 can't distinguish the legitimate KDC from a
spoofed one.

This way, having pam_krb5 enabled isn't dangerous even if you create
an empty /etc/krb5.conf to use client SSO without any host services.

Perhaps this should use krb5_verify_init_creds(3) instead, and
thereby respect the rather obscurely named krb5.conf option
verify_ap_req_nofail like the Linux pam_krb5 does, but:

- verify_ap_req_nofail is default-off (i.e., vulnerable by default),
- changing verify_ap_req_nofail to default-on would probably affect
  more things and therefore be riskier,
- allow_kdc_spoof is a much clearer way to spell the idea,
- this patch is a smaller semantic change and thus less risky, and
- a security change with compatibility issues shouldn't have a
  workaround that might introduce potentially worse security issues
  or more compatibility issues.

Perhaps this should use krb5_verify_user(3) with secure=1 instead,
for simplicity, but it's not clear how to do that without first
prompting for the password -- which we shouldn't do at all if we
later decide we won't be able to use it anyway -- and without
repeating a bunch of the logic here anyway to pick the service name.

References about verify_ap_req_nofail:
- mit-krb5 discussion about verify_ap_req_nofail:
  https://mailman.mit.edu/pipermail/krbdev/2011-January/009778.html
- Oracle has the default-secure setting in their krb5 system:
  https://docs.oracle.com/cd/E26505_01/html/E27224/setup-148.html
  https://docs.oracle.com/cd/E26505_01/html/816-5174/krb5.conf-4.html#REFMAN4krb5.conf-4
  https://docs.oracle.com/cd/E19253-01/816-4557/gihyu/
- Heimdal issue on verify_ap_req_nofail default:
  https://github.com/heimdal/heimdal/issues/1129
2023-06-20 22:17:18 +00:00
riastradh f9fe2f8c36 pam_ksu: No need for homedir access. 2023-06-20 22:17:09 +00:00
msaitoh 4e7cd69809 Fix typo. unknwon -> unknown 2023-06-19 08:40:29 +00:00
msaitoh 305f6951ac Fix typo in the document. From FreeBSD. 2023-06-19 08:24:21 +00:00
christos 85e497af98 Include the OpenSSL Makefile fragment so that build_install works on each
OpenSSL subdirectory.
2023-06-17 15:47:31 +00:00
andvar afc0aa83d8 fix typos in comments. 2023-06-16 20:01:20 +00:00
christos a3782680c6 Correct history (Brad Smith) 2023-06-11 15:28:21 +00:00
uwe 1ff3daa17a socket(2): change type flags list back to -tag
On second thought, convert the list of type flags back to -tag, but
don't make it -compact.  This way it's easier to see that it's related
to the list above.
2023-06-08 00:27:34 +00:00
uwe a9c3dfdd0a socket(2): fix macro invocation in a column 2023-06-06 23:31:01 +00:00
uwe eeed5a7d12 socket(2): use "provides" consistently in "type" descriptions 2023-06-06 23:29:16 +00:00
uwe 0c11cebb87 socket(2): use .Bl -column where appropriate 2023-06-06 23:27:15 +00:00
riastradh 9bf974fbd5 socket(2): Move prose list of socket type summaries into a table. 2023-06-06 09:14:27 +00:00
riastradh 98fb5a3b9b socket(2): Tidy up markup a bit.
Use a tag list, not a literal block with hand-formatted text, for
protocols and socket type flags.
2023-06-06 09:10:08 +00:00
lukem 230c41e44c adapt to ${CC_WNO_IMPLICIT_FALLTHROUGH}
Use ${CC_WNO_IMPLICIT_FALLTHROUGH} instead of
the older style more complex expressions.
2023-06-03 21:30:20 +00:00
andvar 11688feb47 fix various typos in comments and messages. 2023-06-03 20:41:44 +00:00
lukem c4b7a9e794 bsd.own.mk: rename GCC_NO_* to CC_WNO_*
Rename compiler-warning-disable variables from
	GCC_NO_warning
to
	CC_WNO_warning
where warning is the full warning name as used by the compiler.

GCC_NO_IMPLICIT_FALLTHRU is CC_WNO_IMPLICIT_FALLTHROUGH

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
2023-06-03 09:09:01 +00:00
lukem f937c412f3 bsd.own.mk: rename to CC_WNO_ADDRESS_OF_PACKED_MEMBER
Provide a single variable
	CC_WNO_ADDRESS_OF_PACKED_MEMBER
with options for both clang and gcc, to replace
	CLANG_NO_ADDR_OF_PACKED_MEMBER
	CC_NO_ADDR_OF_PACKED_MEMBER
	GCC_NO_ADDR_OF_PACKED_MEMBER

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
2023-06-03 08:52:53 +00:00
uwe 71118f0693 stat_flags(3): try to improve the descriptions
List all alternative forms recognized by string_to_flags(3).
Both "dump" and "nonodump" are the negative of "nodump".
string_to_flags does not recognize "snap".
Provide xrefs for flag descriptions where applicable.
2023-05-31 21:49:39 +00:00
christos f3bd495543 Fix some const qual (Piotr Pawel Stefaniak) 2023-05-30 11:53:40 +00:00
lukem c1aa87e38c libc: fix typo in comments: NO_SRSC -> NO_SRCS 2023-05-29 18:25:52 +00:00
riastradh 2a673dcfdb libpthread: New pthread__smt_wait to put CPU in low power for spin.
This is now distinct from pthread__smt_pause, which is for spin lock
backoff with no paired wakeup.

On Arm, there is a single-bit event register per CPU, and there are two
instructions to manage it:

- wfe, wait for event -- if event register is clear, enter low power
  mode and wait until event register is set; then exit low power mode
  and clear event register

- sev, signal event -- sets event register on all CPUs (other
  circumstances like interrupts also set the event register and cause
  wfe to wake)

These can be used to reduce the power consumption of spinning for a
lock, but only if they are actually paired -- if there's no sev, wfe
might hang indefinitely.  Currently only pthread_spin(3) actually
pairs them; the other lock primitives (internal lock, mutex, rwlock)
do not -- they have spin lock backoff loops, but no corresponding
wakeup to cancel a wfe.

It may be worthwhile to teach the other lock primitives to pair
wfe/sev, but that requires some performance measurement to verify
it's actually worthwhile.  So for now, we just make sure not to use
wfe when there's no sev, and keep everything else the same -- this
should fix severe performance degredation in libpthread on Arm
without hurting anything else.

No change in the generated code on amd64 and i386.  No change in the
generated code for pthread_spin.c on arm and aarch64 -- changes only
the generated code for pthread_lock.c, pthread_mutex.c, and
pthread_rwlock.c, as intended.

PR port-arm/57437

XXX pullup-10
2023-05-25 14:30:02 +00:00
riastradh 21ee6fc127 libpthread: Use __nothing, not /* nothing */, for empty macros.
No functional change intended -- just safer to do it this way in case
the macros are used in if branches or comma expressions.

PR port-arm/57437 (pthread__smt_pause/wake issue)

XXX pullup-10
2023-05-25 14:29:45 +00:00
skrll d0ff2affc8 Add the compat calls for renamed symbols so that configure scripts
can find them. sigprocmask being the most problematic.

RISC-V doesn't need the compat syscalls, but seeing them fail in
ktrace is helpful.
2023-05-19 06:50:07 +00:00
skrll 6d1cc151b5 No need for double semi-colon
Indent END the same as ENTRY.

NFCI.
2023-05-19 06:41:41 +00:00
skrll 83b9ddad41 KNF 2023-05-19 06:31:01 +00:00
andvar 7bca8c8e2e fix typos in comments. 2023-05-13 11:19:19 +00:00
christos c563a46740 fix cross references (from Anon Ymous) 2023-05-08 01:28:35 +00:00
skrll 75b842b847 RISC-V support that works on QEMU with a single hart.
Thanks for Simon Burge for plic(4).
2023-05-07 12:41:45 +00:00
uwe fadf4dba80 Fix spelling of Kurt Shoens surname.
PR misc/57389
2023-05-04 11:30:25 +00:00
uwe d13ac07234 pthread_create(3): minor markup tweaks 2023-04-29 21:37:07 +00:00
jschauma 9f411f7283 delete spurious space 2023-04-29 20:51:45 +00:00
blymn 3aed864489 Don't set the clear_to_eol variable in doupdate to NULL, this was a
leftover from previous code that makes no sense and makes worms(6)
crash randomly.  Thanks to kre@ for reporting this.
2023-04-28 07:12:39 +00:00
christos 4ee547369c pass lint. 2023-04-25 17:51:32 +00:00
christos 12863d4d79 PR/57376: Jorge Giner: readline file completion does not quote; do the same. 2023-04-24 20:02:53 +00:00
abs 384f6a9e2e Fix incorrect test for FUSE_USE_VERSION 34
(Thanks to Mark Davies for report)
2023-04-21 19:29:31 +00:00
christos ef8fd1897c Align types with readline-8.2 (wiz@) 2023-04-21 14:56:13 +00:00
mlelstv 9d5943131b Fix parsing a locale string with multiple components.
Also check for truncation of a long locale string.
2023-04-16 20:37:59 +00:00
rillig 597c9f09f2 libm: suppress lint warning about '>>' on signed integer
GCC has implementation-defined behavior for that case.
2023-04-10 19:23:02 +00:00
christos c41e469284 PR/57250: Martin Husemann: dtoa mishandles infinite doubles on 32bit big
endian machines. When long double support was added, the old code was kept
for the regular double code. This code was never used because WIDE_DOUBLE
was always defined in the Makefile. Remove that old code, and conditionalize
the WIDE_DOUBLE code based on if long doubles are different than doubles on
the specific platform.
2023-04-04 19:26:06 +00:00
skrll 85c3279dc2 Trailing whitespace 2023-04-02 07:26:17 +00:00
dholland d3728fec90 Fix lying comment. 2023-04-01 23:44:11 +00:00
rillig 5f84f05b9b libkvm: suppress lint warnings about extern declarations for now
This should be properly fixed by someone who is familiar with libkvm, as
it affects <sys/cpu_data.h> as well.
2023-04-01 09:08:11 +00:00
rillig cb5396addb libpuffs: ignore lint warning about nested extern for now
This should be properly fixed by someone familiar with puffs.
2023-03-31 04:51:32 +00:00
rillig b2baa50111 lint: warn about extern declarations outside headers
https://mail-index.netbsd.org/tech-userlevel/2023/03/15/msg013727.html
2023-03-28 14:44:34 +00:00
joerg a2c7f636a9 Use snprintf_ss in pthread__assertfunc and update comment in
pthread__errorfunc. snprintf can use locks in some code paths and we
only care about the restricted subset here.
2023-03-24 14:18:18 +00:00
riastradh 40028e8037 libm: Bump minor for new long double transcendental functions.
XXX Still missing: remquol, remainderl.
2023-03-23 12:38:13 +00:00
kre f1eb86a44f Add (newly added): expm1l log1pl log2l lgammal tgammal
so that the library gets the correct symbols defined in it.
2023-03-14 05:49:03 +00:00
riastradh 7739de6469 libm: Need <math.h> for __HAVE_LONG_DOUBLE.
Fixes missing definitions of lrintl, llrintl on various platforms.
2023-03-13 18:26:32 +00:00
riastradh 91f6ee0820 libm: Fill in more dummy long double transcendental functions.
This should cover everything from C99.
2023-03-13 18:18:36 +00:00
thorpej 8ff22ec6c6 Document the error code when O_REGULAR is specified and the last
path component is not a regular file.
2023-03-05 16:24:31 +00:00
riastradh 0670f81a19 mremap(2): Note MAP_REMAPDUP bug.
XXX pullup-10, unless we fix the bug first
2023-03-03 12:53:04 +00:00
riastradh 0119a38611 mremap(2): Fix example to use MAP_PRIVATE.
It is a historical accident that MAP_PRIVATE is assumed when neither
it nor MAP_SHARED is specified.

XXX pullup-9
XXX pullup-10
2023-03-01 20:08:41 +00:00
uwe af2cb705a7 mmap(2): minor markup tweaks 2023-03-01 15:11:28 +00:00
rillig 17359e5a32 hcreate.3: fix typo 2023-02-21 19:27:14 +00:00
gutteridge d6bd763cb8 intro.5: fix typo and grammar and simplify a phrase 2023-02-20 02:05:47 +00:00
andvar 2773222a6c s/chracter/character/ in documentation. 2023-02-13 23:02:27 +00:00
christos 7a0279c013 Remove unused stuff, and limit the scope of some of the used ones.
(from des@freebsd)
2023-02-04 14:34:28 +00:00
christos 3ce4aa662f Add a entry point for the complete function for FreeBSD compatibility with sh. 2023-02-03 22:01:42 +00:00
christos 0428f1e1b1 Don't clear the handle to el "sel" and set it earlier to prevent handling
a signal before the handle is set. (From: des at FreeBSD)
2023-02-03 19:47:38 +00:00
andvar 96dad784b6 fix few typos in comments. 2023-01-31 21:11:24 +00:00
simonb a411c1a557 Note that strchrnul() first appeared in glibc 2.1.1 and appeared in
FreeBSD 10 before it appeared in NetBSD 8.
2023-01-31 01:42:32 +00:00
rillig 2f7da51144 fmtmsg.3: fix typo 2023-01-22 13:38:48 +00:00
riastradh e10add6b30 inet(3): Fix typo in description of size argument.
This is the size of dst, not of src.  The size of src is determined
by the address family.

Fix markup while here: .Fa for function arguments, not .Ar which is
for command arguments.
2023-01-18 23:16:05 +00:00
simonb 1daaca1c6c KNF nit: opening brace of a function on next line. 2023-01-18 08:07:22 +00:00
uwe 3268a4e25e crypt(3): Minor markup tweaks 2023-01-17 14:27:11 +00:00
msaitoh 997fd87f7e s/charater/character/ in comment. 2023-01-17 14:13:48 +00:00
christos e42273ba0d put attributes first for c23 compliance. 2023-01-17 13:18:03 +00:00
riastradh 642ce581b2 crypt(3): Call it password hashing, not `encrypting'.
Tidy up some of the markup while here, and be consistent about
calling the neatly formatted US-ASCII string an `encoded password
hash').
2023-01-17 01:56:43 +00:00
christos 20fbed3887 Apply 9cfe9507fcc22cd4a0c4da486ea1c7f0de6b075f for C23 attribute compliance.
Requested by Jan-Benedict Glaw.
2023-01-15 18:12:37 +00:00
kre b666381035 Add errc() and verrc() to the list of functions which do not return,
but exit() instead.

This was omitted when the *c() set of functions were added in 2014.
2023-01-05 15:13:57 +00:00
nia 4afdaab748 setlocale.3: Reflect state of NetBSD locale support in the 21st century
Don't use LC_COLLATE in a real code example, since a real call to set
LC_COLLATE will fail. Mention this.

Inconsistencies noticed by khw on IRC.
2022-12-31 14:35:56 +00:00
riastradh ddb0a7e7a7 swab(3): Rewrite this to be understandable.
And make the tests work, and exercise all lengths up to 100.

Evidently the previous definition, presumably tightly optimized for
1980s-era compilers and CPUs, was too hard to understand, because it
was incorrectly tested for two decades and broken for years.

PR lib/57141

XXX pullup-8
XXX pullup-9
XXX pullup-10
2022-12-28 15:34:19 +00:00
kre aab5fac668 PR lib/57141 - never decrement len without actually performing a STEP. 2022-12-28 14:32:04 +00:00
wiz eb7b4f7765 Remove unneeded -D_OPENBSD_SOURCE 2022-12-21 17:44:15 +00:00
blymn 0d33635b3c Add more debug so a call to waddbytes can be traced to the caller. 2022-12-21 06:18:01 +00:00
blymn 9c6a0e327d Backout change to addnstr that broke other applications as n should be
the number of bytes to add - for multibyte characters n will be > 1.

Fix __slk_draw to pass in the actual length of the label instead of
the default label length because wide characters may make the
actual string length longer than the slk display length.
2022-12-20 04:57:01 +00:00
christos 93664a940b Handle the case the code originally intended to handle; systems where:
SIZE_MAX < PTRDIFF_MAX
2022-12-13 19:08:42 +00:00
skrll e311a492a7 Trailing whitespace 2022-12-13 12:43:32 +00:00
blymn 7c304c7fb1 Default the character width to 1 if wcwidth fails. 2022-12-12 21:14:15 +00:00
christos fa7b09b795 Merge in 2022g:
Although tzcode still works with C89, bugs found in recent routine
    maintenance indicate that bitrot has set in and that in practice
    C89 is no longer used to build tzcode.  As it is a maintenance
    burden, support for C89 is planned to be removed soon.  Instead,
    please use compilers compatible with C99, C11, C17, or C23.

    timegm, which tzcode implemented in 1989, will finally be
    standardized 34 years later as part of C23, so timegm is now
    supported even if STD_INSPIRED is not defined.

    Fix bug in zdump's tzalloc emulation on hosts that lack tm_zone.
    (Problem reported by Đoàn Trần Công Danh.)

    Fix bug in zic on hosts where malloc(0) yields NULL on success.
    (Problem reported by Tim McBrayer for AIX 6.1.)

    Fix zic configuration to avoid linkage failures on some platforms.
    (Problems reported by Gilmore Davidson and Igor Ivanov.)

    Work around MS-Windows nmake incompatibility with POSIX.
    (Problem reported by Manuela Friedrich.)

    Port mktime and strftime to debugging platforms where accessing
    uninitialized data has undefined behavior (strftime problem
    reported by Robert Elz).

    Check more carefully for unlikely integer overflows, preferring
    C23 <stdckdint.h> to overflow checking by hand, as the latter has
    had obscure bugs.
2022-12-11 17:57:23 +00:00
uwe 710059bb9f editrc(5): Markup fixes 2022-12-06 00:59:20 +00:00
uwe 1c9bc64659 getbsize(3): Use .Ev for BLOCKSIZE 2022-12-06 00:13:17 +00:00
blymn 5a712dcba0 Revert previous change, it is not correct. 2022-12-05 21:14:25 +00:00
uwe e8b127922c getnetpath(3): Sprinkle some markup 2022-12-04 23:02:57 +00:00
uwe cfe198168b login_cap(3): Markup fixes 2022-12-04 22:51:43 +00:00
jakllsch 78eb21a033 On VAX, compile gdtoa/misc.c at -O0 to avoid incorrect machine code
resulting in some doubles printing as garbage.
2022-12-04 22:35:15 +00:00
uwe 7440a63dca fcntl(2): Fix wrong markup in a couple of places 2022-12-04 19:01:19 +00:00
skrll 1beb9ce90d Consistently use the 'mv' instrucation (which is itself an alias) instead
of the (old) alternative alias 'move'.
2022-12-04 17:04:06 +00:00
uwe 495edbf836 re_format(7): Add subsection headings for ERE and BRE
The first paragraph could use some rewording.  While BRE may be
obsolete, it's still the default for regcomp(3) and the default for
grep(1), sed(1), etc.
2022-12-04 16:52:48 +00:00
uwe eff611cf1c Bump date for the fixed RETURN VALUES in previous 2022-12-04 16:21:54 +00:00
uwe 15c5c5f472 Tweak markup in _lwp_*(2) manual pages
Use .Rv where possible.  Some manual pages claimed that the error "is
returned", but RTFS and some quick testing indicate that this is wrong.

The commit message from 2003 says that:

  Note our current implementation mis-matches [man pages] slightly
  (error codes are stuffed into errno, where they should simply be
  returned by these calls).  This will be addressed shortly.

That hasn't happened in the 20 years, so we might as well make the man
pages reflect the reality.
2022-12-04 16:17:50 +00:00
uwe 49e10846a6 lib: Mark up error names in man pages with .Er 2022-12-04 11:25:08 +00:00
uwe 27e8188424 flock(2): s/Eq/Er/ typo in the ERRORS section 2022-12-04 11:18:58 +00:00
uwe 4562d402f9 pw_init(3): Use .Ev for EDITOR 2022-12-04 11:16:39 +00:00
uwe e6fc3c59c2 Sections 2 and 3 have RETURN VALUES, not DIAGNOSTICS 2022-12-04 01:29:31 +00:00
uwe 254727163e getservent(3): Section 3 has RETURN VALUES, not DIAGNOSTICS
While here, don't claim that null pointer is zero.

We should probably just pick the wording from POSIX, but that yak is a
bit too big for me to shave at the moment.
2022-12-04 00:13:11 +00:00
jschauma 4556c7b6e8 reference /var/db/services.cdb / services_mkdb(8) 2022-12-03 23:55:52 +00:00
skrll ea00852af2 Trailing whitespace 2022-12-03 14:04:39 +00:00
skrll 7893424154 Trailing whitespace 2022-12-03 09:38:53 +00:00
christos 86e4c4a8e3 PR/57095: Yilei Yang: Change readline's replace_history_entry to not make a copy
of the string to replace since H_REPLACE already makes a copy (fixes memory leak)
2022-12-02 19:23:15 +00:00
blymn dabdb153f2 When performing a scroll, check the last line of the region is the same
on virtscr and curscr because the indexes past are supposed to be
one *past* the last matching line (they may actually match if the line is
at the bottom of the screen).  Iff they don't match reduce the scroll
region size by one so we don't scroll non-matching lines, also check
if the region is then 0 after the decrement and just return if it was.
2022-11-30 06:19:15 +00:00
skrll d2296b0783 Trailing whitespace 2022-11-30 04:35:53 +00:00
uwe f90210105d socketpair(2): Formatting nits 2022-11-29 20:50:37 +00:00
jschauma 12d9662bb2 document the only supported type protocol, document type flags
This uses language taken from OpenBSD's manual page.
2022-11-29 20:26:39 +00:00
gutteridge d671eab624 reallocarray.3: minor grammar and style tweaks 2022-11-27 20:17:20 +00:00
christos ecbe1e9db9 fix vax build 2022-11-23 18:15:43 +00:00
rin 35e09a8af5 Correct path for libm. 2022-11-22 15:41:04 +00:00
christos ae082add65 lua libm API from Phil Rulon 2022-11-21 22:01:32 +00:00
jakllsch cd0fbe0b1b Simply set HAVE_GETRANDOM to false on __APPLE__.
Addresses PR 57083.
2022-11-17 17:35:25 +00:00
christos cd2e09c9fd PR/57083: Jiaxun Yang: Fix build on MacOS/X which has <sys/random.h> but no
getrandom(3).
2022-11-16 19:38:08 +00:00
gutteridge 7eadd4d371 posix_openpt.3: add a history section 2022-11-15 22:17:53 +00:00
gutteridge 03e840b8d3 closefrom.3: add a history section 2022-11-10 00:47:01 +00:00
blymn b34dd075af Count character widths not number of bytes when calculating number
of characters to add.  Fixes an error detected by slk tests where
a label containing wide characters was not correctly printed.
2022-11-07 21:18:49 +00:00
riastradh 3ead30d6ad regerror(3): Allow null errbuf if errbuf_size is zero.
The man page says:

   If errbuf_size is 0, errbuf is ignored but the return value is still
   correct.

POSIX says:

   If errbuf_size is 0, regerror() shall ignore the errbuf argument,
   and return the size of the buffer needed to hold the generated
   string.

   https://pubs.opengroup.org/onlinepubs/9699919799/functions/regerror.html

from enh@google.com
2022-11-05 11:33:55 +00:00
blymn 2cc268f92c PR bin/57072
This fixes observed behviour in the PR.  Allow the cursor to be
moved one past the EOL, if postitioned here then set ISPASTEOL.
also protect out of range access if win->cury is past maxy.
2022-11-04 06:12:22 +00:00
andvar daa7d68ea3 fix various typos in comments and messages. 2022-11-02 20:38:21 +00:00
christos 9acefc396c Cleaner to use if/then/else rather than a ton of casts in the ternary operator. 2022-11-02 12:49:10 +00:00
christos 21a4b1ccc3 improvements in malloc/free handling. 2022-10-30 19:11:31 +00:00
christos 1e7378f887 Update to tzcode2022f
Changes to code

    zic now supports links to links regardless of input line order.
    For example, if Australia/Sydney is a Zone, the lines
      Link Australia/Canberra Australia/ACT
      Link Australia/Sydney Australia/Canberra
    now work correctly, even though the shell commands
      ln Australia/Canberra Australia/ACT
      ln Australia/Sydney Australia/Canberra
    would fail because the first command attempts to use a link
    Australia/Canberra that does not exist until after the second
    command is executed.  Previously, zic had unspecified behavior if
    a Link line's target was another link, and zic often misbehaved if
    a Link line's target was a later Link line.

    Fix line number in zic's diagnostic for a link to a link.

    Fix a bug that caused localtime to mishandle timestamps starting
    in the year 2438 when reading data generated by 'zic -b fat' when
    distant-future DST transitions occur at times given in standard
    time or in UT, not the usual case of local time.  This occurs when
    the corresponding .zi Rule lines specify DST transitions with TO
    columns of 'max' and AT columns that end in 's' or 'u'.  The
    number 2438 comes from the 32-bit limit in the year 2038, plus the
    400-year Gregorian cycle.  (Problem reported by Bradley White.)

    On glibc 2.34 and later, which optionally supports 64-bit time_t
    on platforms like x86 where time_t was traditionally 32 bits,
    default time_t to 64 instead of 32 bits.  This lets functions like
    localtime support timestamps after the year 2038, and fixes
    year-2038 problems in zic when accessing files dated after 2038.
    To continue to limit time_t to 32 bits on these platforms, use
    "make CFLAGS='-D_TIME_BITS=32'".

    In C code, do not enable large-file support on platforms like AIX
    and macOS that no longer need it now that tzcode does not use
    off_t or related functions like 'stat'.  Large-file support is
    still enabled by default on GNU/Linux, as it is needed for 64-bit
    time_t support.

    In C code, prefer C23 keywords to pre-C23 macros for alignof,
    bool, false, and true.  Also, use the following C23 features if
    available: __has_include, unreachable.

    zic no longer works around Qt bug 53071, as the relevant Qt
    releases have been out of support since 2019.  This change affects
    only fat TZif files, as thin files never had the workaround.

    zdump no longer modifies the environ vector when compiled on
    platforms lacking tm_zone or when compiled with -DUSE_LTZ=0.
    This avoid undefined behavior on POSIX platforms.
2022-10-29 13:55:50 +00:00
wiz dd8db24513 put reallocarray() in the public namespace
reallocarray() will be part of the next POSIX release, see
https://austingroupbugs.net/view.php?id=1218

adapt an errno value to match POSIX expectations

As discussed on tech-userlevel
2022-10-28 09:43:58 +00:00
jschauma 14ecc37828 rephrase / clarify explanation of struct tm member normalization 2022-10-26 23:22:54 +00:00
andvar a5139dfcb4 fix RCSID. 2022-10-26 22:13:09 +00:00
andvar 730fdfa601 nix double n, i or g in "ing", in comments and documentation. 2022-10-26 22:09:37 +00:00
kre c24fd5a773 Fix a merge or conversion problem (probably) - a .SH BUGS
(meaningless macro in mdoc) followed by the first line of the
real BUGS section somehow ended up inserted after the first
word of the STANDARDS section.   Delete the noise.
2022-10-25 08:07:07 +00:00
blymn 4b1b7fd71d Fix for lib/57050
Perform a sanity check on the window parameter being passed and return
ERR if it is null.  This prevents buggy code crashing.
2022-10-25 06:20:01 +00:00
uwe d6f32aceab strptime(3): make the fact that %z is an extension more prominent
Mention it near the format itself, not on the next screen (with an
awkward indentation too).
2022-10-24 23:18:31 +00:00
uwe 69afa679ca ctime(3): fix unbalanced paren introduced in 1.40 2022-10-21 12:28:43 +00:00
uwe 2d856f24b1 ctime(3): add missing leading slash in a pathname 2022-10-21 12:11:29 +00:00
jschauma 1f27523029 escape mathematical minus so it doesn't get rendered as a dash 2022-10-21 03:08:29 +00:00
jschauma 61d8e1efc0 Note normalizing behavior of mktime(3) using language from FreeBSD. 2022-10-21 03:05:15 +00:00
blymn ee6c5161ec Fixes for lib/56926 amongst other things:
- plod now correctly accounts for wide characters when plodding
 - use erase line when in color mode if the terminal has the capability
 - ensure that the CA_CONTINUATION flag is applied consistently to the
   subsequent characters in a wide character.
 - fix a bunch of refresh bugs that caused inconsistent placement of
   wide characters.
2022-10-19 06:09:27 +00:00
wiz 134c7dc5fa avoid unnecessary Ns macro 2022-10-18 07:33:15 +00:00
jschauma 76a83e03a4 Note that the exit status may be truncated to the least significant 8 bits. 2022-10-18 02:31:39 +00:00
jschauma 746cfcb9c7 add missing 'the' 2022-10-17 18:41:06 +00:00
christos ec56256fb3 Add EINVAL doc from Jan Schaumann 2022-10-16 20:37:03 +00:00
christos 48575108a6 update to 2022e; no real changes 2022-10-15 18:57:37 +00:00
nia 934ddb935f libc: Use a functional example when warning about incorrect alloca usage 2022-10-08 12:56:51 +00:00
ryo 9da1e81cea fix fixPR/57046. inet_network(3) returns INADDR_NONE when network names such as /x[0-9a-f][0-9a-f]/. 2022-10-06 06:03:06 +00:00
nia c47c40fb8b libc: switch aarch64 to use softfloat functions from compiler_rt
The old definitions in qp.c being all grouped together in one file
causes problems when static linking with libgcc (i.e. cc --static-libgcc)
due to functions like __trunctfdf2 conflicting with libgcc, as seen in
PR 57021

We can also add some missing functions like __fixdfti for converting
a double to an int128_t, the lack of which is currently preventing webkit
from linking on aarch64, as seen in PR 57022

Unclear to me if libc is the right place for these functions, but
we can avoid breaking compatibility right now and maintain the status
quo while avoiding some obvious immediate problems.
nm output for libc shows no functions being removed by this change.
2022-10-05 10:28:19 +00:00
gutteridge 5568d804e3 posix_openpt.3: reflect changes from r. 1.45 of tty_ptm.c 2022-10-04 01:46:18 +00:00
gutteridge e3b627187d posix_openpt.3: reflect flag changes from r. 1.44 of tty_ptm.c
Some flags are now accepted, others are still ignored. (E.g., other
BSDs would return EINVAL if O_RDWR wasn't passed, and we now accept
O_NONBLOCK but not O_CLOEXEC.)
2022-09-28 00:35:47 +00:00
christos 22153c41fd PR/57016: Ricky Zhou: declare lastidx 2022-09-21 01:33:53 +00:00
christos 8aa8c3f154 PR/57016: Ricky Zhou: Revert to trimming the last newline instead of the
first one so that multi-line commands work again.
2022-09-20 23:41:14 +00:00
riastradh 7a407fffcd pthread_atfork(3): Block signals during the call to pthread_atfork.
This doesn't affect the calls to the atfork handlers -- it only
protects access to the lists of handlers from interruption by a
signal, in case the signal handler calls fork(2).
2022-09-13 10:18:47 +00:00
rillig 6c259f3957 fix misspellings of 'available' and nearby typos 2022-09-10 12:14:17 +00:00
gutteridge 9b526a4356 posix_openpt.3: add caveats about oflags
The NetBSD implementation differs from other BSDs in that it does not
return EINVAL if invalid oflags are submitted, since it completely
ignores them. This is surprising to upstream projects that may expect
otherwise.
2022-09-06 22:54:41 +00:00
riastradh cf221fb572 reallocarr(3): Touch up xrefs. 2022-08-31 12:18:41 +00:00
riastradh a2fb076e11 reallocarr(3): Bump date. Note overflow is handled internally. 2022-08-31 12:17:14 +00:00
riastradh 249e1d8c11 reallocarr(3): Clarify semantics. 2022-08-31 12:10:05 +00:00
riastradh b9cd134278 libm: Fix some whitespace issues in recent sincos additions. 2022-08-29 01:48:34 +00:00
he 5eeabc1a3f s_rint.c: weak-alias rintl -> rint for ports without __HAVE_LONG_DOUBLE. 2022-08-28 21:24:09 +00:00
he 41f1db2c7a s_sincos.c: use correct order of __weak_alias() arguments... 2022-08-28 16:07:58 +00:00
he 9be9bcc17d s_sincos.c: use __weak_alias and not __weak_reference.
Fixes build on NetBSD/macppc, thanks to hint from riastradh@
2022-08-28 14:30:41 +00:00
uwe 195a321f00 re_format(7): Use dagger, not double dagger. Make it superscript. 2022-08-28 12:59:50 +00:00
hgutch ec184f3bfb Change back various occurrences of \*[Le], \*[Ge] (less/greater equal)
and \*(ua (upwards arrow) to literal "<=", ">=" and "^" whenever
appropriate (e.g., in code examples).
2022-08-28 10:48:15 +00:00
christos cef006857c only alias sincos to sincosl when we don't have long doubles 2022-08-28 07:29:04 +00:00
christos 861ec30ff2 tuck in k_sincosl.h include inside __HAVE_LONG_DOUBLE 2022-08-27 17:15:52 +00:00
christos ae197994b3 Fix vax build. 2022-08-27 09:56:21 +00:00
christos 5dd94c5e95 Add sincos{,f,l} from FreeBSD 2022-08-27 08:31:58 +00:00
christos 892b77447f sync with FreeBSD; bring some more inline functions. 2022-08-24 13:51:19 +00:00
christos 4fce0f6899 add missing text. 2022-08-24 06:39:14 +00:00
christos cd9dfb0505 Fix argument name 2022-08-23 14:54:50 +00:00
christos d4169749f0 fix whitespace prefix behavior 2022-08-18 11:05:02 +00:00
christos 5346bd151a PR/56967: John Zaitseff: Reduce diff with FreeBSD, fixes various bugs. 2022-08-17 09:32:56 +00:00
christos 8c24072a8b Welcome to tzcode-2022c
Work around a bug in onetrueawk that broke commands like
'make traditional_tarballs' on FreeBSD, macOS, etc.
(Problem reported by Deborah Goldsmith.)

Add code to tzselect that uses experimental structured comments in
zone1970.tab to clarify whether Zones like Africa/Abidjan and
Europe/Istanbul cross continent or ocean boundaries.
(Inspired by a problem reported by Peter Krefting.)

Fix bug with 'zic -d /a/b/c' when /a is unwritable but the
directory /a/b already exists.

Remove zoneinfo2tdf.pl, as it was unused and triggered false
malware alarms on some email servers.
2022-08-16 11:07:40 +00:00
christos 0129e5c6c8 Welcome to 2022b:
zic has a new option '-R @N' to output explicit transitions < N.
(Need suggested by Almaz Mingaleev.)

'zic -r @N' no longer outputs bad data when N < first transition.
(Problem introduced in 2021d and reported by Peter Krefting.)

zic now checks its input for NUL bytes and unterminated lines, and
now supports input line lengths up to 2048 (not 512) bytes.

gmtime and related code now use the abbreviation "UTC" not "GMT".
POSIX is being revised to require this.

When tzset and related functions set vestigial static variables
like tzname, they now prefer specified timestamps to unspecified ones.
(Problem reported by Almaz Mingaleev.)

zic no longer complains "can't determine time zone abbreviation to
use just after until time" when a transition to a new standard
time occurs simultanously with the first DST fallback transition.
2022-08-16 10:56:21 +00:00
wiz 2d37c7f39b clone(2): document that _GNU_SOURCE must be defined for the prototypes 2022-08-01 14:22:32 +00:00
mlelstv d2698c432d Move libisns to /lib to allow /sbin/iscsid to work without /usr being
mounted.
2022-07-31 12:40:35 +00:00
dholland 2301d6e2c4 __quotactl(2): typo. 2022-07-31 06:21:41 +00:00
uwe 56cc39f2d1 mincore(2) - use .Rv -std 2022-07-26 00:25:45 +00:00
riastradh 134b15b0f4 mincore(2): Clarify units of len argument: bytes, not pages.
Minor tidying while here:

- Use .Fa, not .Ar, for function arguments.
- Reduce verbiage of opening sentence.
2022-07-25 22:50:42 +00:00
andvar 6c5bf42769 p2k(3): drop reference to rump_smbfs(8). 2022-07-11 19:24:56 +00:00
andvar a299e6608d fix various typos in comments. 2022-07-06 12:33:41 +00:00
rillig ed7c6fff47 bind.2: add references to specific protocol families
Referring the reader to "the manual entries in section 4" was too
unspecific to be useful, as that section contains device drivers as
well.
2022-06-28 20:24:08 +00:00
rillig f1e042b8d2 fix references in manual pages to the reference documentation 2022-06-28 20:12:52 +00:00
skrll 1120ea0d7a Decorate the HPPA signal trampoline with the appropriate .cfi
directives to allow exception unwind / backtrace across a signal
handler.
2022-06-26 14:37:12 +00:00
skrll 44889fb922 Decode function descriptors (aka plabels) on hppa to fix backtrace.
PR/56881: hppa: backtrace_symbols() delivers bogus results for some dynloaded functions
2022-06-25 06:51:37 +00:00
martin 35a4c156a5 Use "fmadd" to implement fma(3) on ppc. 2022-06-23 16:42:50 +00:00
skrll db40f7209a Oops... fix SYMTAB_DEBUG build 2022-06-23 09:58:25 +00:00
skrll 28227ae2d9 Define and use a DPRINTF macro 2022-06-23 09:53:49 +00:00
skrll d5f19fad45 Trailing whitespace 2022-06-23 09:48:00 +00:00
he 56c7bffc6c libm: build fma(3), fmaf(3), fmal(3) on powerpc.
For now this builds the C version, for completeness, so
that e.g. lang/ocaml can be configured & built.  However,
googling reveals that powerpc does have a "fused multiply add"
instruction, ref.
https://www.ibm.com/docs/en/aix/7.1?topic=set-fmadd-fma-floating-multiply-add-instruction
so this could probably be taken advantage of for a more
optimized version.
2022-06-23 07:50:14 +00:00
skrll f927c76aaf Support ifunc on aarch64. The tests pass at least. 2022-06-21 06:52:17 +00:00