command, so that the command cannot appear to be more options
(which always then fails, as there would be no arg for "-c" to
treat as the command string in that case).
For the full (LONG) explanation, see:
http://mail-index.netbsd.org/current-users/2021/10/29/msg041629.html
- lock all relevant mutexes just before fork
- unlock all mutexes just after fork in the parent
- full reinit non-spinlocks in the child
This is not using the normal pthread_atfork interface to ensure order of
operation, malloc is used as implementation detail too often.
Instead of implicid promotion to signed int,
explicitly cast the arguments to unsigned int.
_rand48.c:53:27, signed integer overflow:
58989 * 58970 cannot be represented in type 'int'
_rand48.c:53:38, signed integer overflow:
-2093025904 + -1496809120 cannot be represented in type 'int'
_rand48.c:53:57, signed integer overflow:
57068 * 42787 cannot be represented in type 'int'
New and old code produce the same code as tested with:
#include <stdio.h>
#include <stdlib.h>
#define COUNT 1000 * 1000
int
main(void)
{
FILE *fp;
int i;
fp = fopen("numbers.txt", "w+");
if (!fp)
abort();
for(i = 0; i < COUNT; i++) {
fprintf(fp, "%f\n", drand48());
fprintf(fp, "%ld\n", lrand48());
fprintf(fp, "%ld\n", mrand48());
}
fclose(fp);
return 0;
}
The original implementation in OpenBSD returns "invalid" and avoids reading
the input string. The replaced behavior was interpreting the input string
ignoring the invalid arguments.
Change the type of shifted value to unsigned to prevent altering the
signedness bit.
jemalloc.c:1707:14, left shift of 1 by 31 places cannot be represented in type 'int'
jemalloc.c:1724:15, left shift of 1 by 31 places cannot be represented in type 'int'
jemalloc.c:1840:28, left shift of 1 by 31 places cannot be represented in type 'int'
Detected with micro-UBSan in the user mode.
Sanitizers can handle recursive interceptions in some / most cases, if they
will cause damage the problem will be not workaroundable without libc
changes - I will be back to it.
Keep namespace of asctime() as this can be a cancellation point according
to POSIX. Right now it's not implemented on NetBSD. Defer it for later.
Keep weak symbols and namespace for wait6(2) as this could be a
cancellation point as well. Defer this for later.
Sanitizers's [recursive] interceptors are a hack and moving one way or
another can cause new sets of problems. Recursive ones can be useful and
cause problems (on Linux there are known with with signal handlers).
Sponsored by <The NetBSD Foundation>
The NetBSD Standard C Library uses internally some of its functions with
a mangled symbol name, usually "_symbol". The internal functions shall not
use the global (public) symbols.
Add atoi to namespace.h.
Register a new __weak_alias() entry for atoi() in atoi.c.
atoi() is used internally in getrpcent(), rresvport_af(), ftok(), err(),
__llvm_profile_write_file(), llvm_gcda_start_file(), citrus_iconv_open(),
getprotoent_r(), __rpc_uaddr2taddr_af(), __res_nopt_rdata() and
servent_parseline().
This revision switches the internal usage to the internal symbol.
Sponsored by <The NetBSD Foundation>
The NetBSD Standard C Library uses internally some of its functions with
a mangled symbol name, usually "_symbol". The internal functions shall not
use the global (public) symbols.
This change eliminates usage of the global changes of the following symbols:
- strlcat -> _strlcat
- sysconf -> __sysconf
- closedir -> _closedir
- fparseln -> _fparseln
- kill -> _kill
- mkstemp -> _mkstemp
- reallocarr -> _reallocarr
- strcasecmp -> _strcasecmp
- strncasecmp -> _strncasecmp
- strptime -> _strptime
- strtok_r -> _strtok_r
- sysctl -> _sysctl
- dlopen -> __dlopen
- dlclose -> __dlclose
- dlsym -> __dlsym
Sponsored by <The NetBSD Foundation>
specifies the number of digits after the decimal point (oh, sorry, the
"radix character") the other specifies the number before...
While here, add a little more info on the effects of using the #n value.
- Avoid out of bounds access for the currency_symbol[3] when the symbol
is shorter (as it happens with the C locale where it is empty)
- Don't compare pointers to NUL, it is not helpful.
- Make the default sep_by_space 1 as suggested in:
https://ftp.gnu.org/old-gnu/Manuals/glibc-2.2.3/html_node/libc_111.html
- Use the correct number of bytes for memmove(3)
XXX: pullup-8