Commit Graph

1008 Commits

Author SHA1 Message Date
christos a340b0e513 Formalize that the printf formats should be uintmax_t so we can
uniformly use 'j' in the user-provided formatting strings instead
of depending on _LP64 to use 'll' or 'l' (and the PRI macros). The
alternative is to parse the printf format manually to determine
which modifier to apply which would make this transparent to the
user (they could still always use '%u' or '%x'), but that's too
painful.
2019-12-06 19:36:21 +00:00
ad b8255b9f0e Fix warning that appears when compiling in kernel. 2019-12-05 19:03:39 +00:00
ad 9afd1ce310 Delete the counter from "struct radix_tree_node", and in the one place we
need a non-zero check, substitute with a deterministic bitwise OR of all
values in the node.  The structure then becomes cache line aligned.

For each node we now need only touch 2 cache lines instead of 3, which makes
all the operations faster (measured), amortises the cost of not having a
counter, and will avoid intra-pool-page false sharing on MP.
2019-12-05 18:50:41 +00:00
ad 0558f52127 Merge radixtree changes from yamt-pagecache. 2019-12-05 18:32:25 +00:00
roy 8569e6d26f Make it easier to use strtoi and strtou in downsteam applications
without the need to define HAVE_NBTOOL_CONFIG_H and yet allow -Wundef
not to log any warnings.
2019-11-28 12:33:23 +00:00
kamil 0b65214dd3 uubsan: Implement function_type_mismatch_v1
RTTI is not supported by micro-UBSan (by design) and this is now a stub
handler.
2019-11-01 14:54:07 +00:00
kamil aeb81341f9 uubsan: Handle implicit_conversion 2019-10-30 00:13:46 +00:00
maya a11c5ab81a Remove htonll and ntohll as symbols from aarch64 libc.
Other architectures do not define them, and so we don't provide a
function declaration in any header.

This means a package may detect it with a link-test and then fail
due to the missing declaration, like sysutils/collectd currently does.

Done this way as aarch64 has not had a release yet. Discussed with releng.
2019-10-12 09:22:36 +00:00
mrg 8c38a0de66 workaround a GCC 8 warning:
- code that will be unreachable on platforms with
  sizeof(double) != sizeof(unsigned long) triggered an valid out
  of bounds warning.  avoid the error by using sizeof ul.
- also assert that the sizes are the same if entering here.

both from kamil@.
2019-10-04 12:12:47 +00:00
skrll a58be5d164 Traiing whitespace. 2019-09-16 12:40:40 +00:00
skrll 2ce102b5b1 __sync_{,x}or_and_fetch_8 should return new value... make it so. 2019-09-15 14:55:04 +00:00
skrll 8453e2f7da __sync_or_and_fetch_8 should return new value... make it do that. 2019-09-15 11:14:15 +00:00
kamil 1a5f018b01 Enhance the support of LLVM sanitizers
Define _REENTRANT for MKSANITIZER build. This is needed for at least stdio
code. This caused new build issued with duplicated symbols in few places
and rump kernel code picking different code paths borrowed from libc.
Handle all this in one go.

Add bsd.sanitizer.mk to share common code used by programs and libraries.

Switch from realall to beforeinstall target in .syms files. This is more
reliable in MKSANITIZER.
2019-08-27 22:48:53 +00:00
para 50fe1a8b2a add now required includes for memcpy prototypes analogue to other hash functions
(fix the build)
2019-08-20 15:17:02 +00:00
riastradh 23d950dc47 Fix byte order bug in murmurhash and pacify sanitizers. 2019-08-20 12:33:26 +00:00
joerg 3dbc6e4c72 ARMv6KZ has been misspelled by GCC since forever, but clang only
provides the correct name. Support both.
2019-08-02 12:07:24 +00:00
kamil f8310280bd Introduce UBSAN_ALWAYS_FATAL in micro-UBSan
UBSAN_ALWAYS_FATAL is a CPP option to mark all reports fatal always.
2019-06-17 18:55:37 +00:00
christos 7b60fbecff PR/54300: Andreas Gustafsson: Remove useless case. should fix
lib/libutil/t_snprintb test regression on sparc
2019-06-17 17:03:58 +00:00
christos bf1be5afae get rid of caddr_t 2019-06-16 16:01:44 +00:00
hannken c7814b62be Make XDR usable from kernel or module.
No user visible changes intended.
2019-06-05 16:25:43 +00:00
hannken 6f60c4f99e Move the basic part of XDR to common/include/rpc and common/lib/libc/rpc.
No functional change intended.
2019-06-04 15:07:55 +00:00
maxv 5bd7eba201 Misc changes in RISC-V. Start changing the memory layout, too. 2019-06-01 12:42:27 +00:00
maxv dedb2f3a2d Fix bug, the computation of cpuset_nentries was incorrect, we must do +1
to be able to address the last 32 bits.

On a machine with 80 CPUs, this caused "cpuctl identify >64" to return
garbage.
2019-05-11 11:53:55 +00:00
skrll 6e867a675a toolify
PR/54182: Cross-building on Linux fails in rb.c
2019-05-09 10:56:24 +00:00
thorpej 88c316691b Use posix_madvise() rather than the legacy madvise() call, and
wrapp the calls in #ifdef for the advice we're giving.  Should
address reports of host tool build issues.
2019-05-08 04:34:33 +00:00
thorpej 8319f966d5 Fix building libprop as a host tool library on platforms that don't have
the Matt Thomas rbtree:

- Include rb.c in libnbcompat, and provide a nbcompat sys/rbtree.h
  header.
- Make sure libprop's source file include prop_object_impl.h before
  anything else, and pull in nbtool_config.h from there.

Tested by simulating such a host system by renaming the host's
<sys/rbtree.h> out of the way (which reproduced the build failure)
and verifying that the host-tool installboot contained the rb_*
functions in its own .text segment.
2019-05-08 02:25:50 +00:00
kre 63e182f423 snprintb(3) says that, in the new(?) Torek format, all fields specs end with \0
The F spec is one of those, it should be terminated with \0 just like all
the others (irrelevant that it has no extra data to delimit).

Fix <sys/mman.h> to define the snprintb() format string correctly (include
the missing \0's).   Fix the copy of that definition included into
snprintb(3) to match the updated mman.h version (ride the date bump
from the day before yesterday .. this is the same change, just corrected).

Undo the previous snprintb.c change ("off by one" fix) which was an
attempt to make the broken mman.h usage work (and did, but not the way
it should be done).   Also, after using the new * format (instead of only
when something has already matched) skip the associated data so we don't
attempt to interpret it as more field specifiers.  This func needs lots of TLC!

Fix the ATF tests for snprintb() to not assume that F format is really
exactly like f format, and has data after the field specifier.  It doesn't.
Add several more tests (including testing the '*' field operator
recently added).
2019-04-29 07:55:38 +00:00
christos c650b5f27f Fix an off-by-one in the F modifier that ended up skipping the first : or =
entry, and add a * specifier for a "default case".
2019-04-27 17:45:28 +00:00
mrg cee1dacaf3 add missing atomic_and_16_nv_cas.c atomic_and_8_nv_cas.c. 2019-04-17 07:40:34 +00:00
mrg 5a9be18c46 add missing aliases for _atomic_cas_32_ni and atomic_cas_uint_ni. 2019-04-17 07:35:38 +00:00
jmcneill 0d57af0fd1 Fix typo: __aebi_memset -> __aeabi_memset 2019-03-30 10:18:03 +00:00
roy 18d2bd2e00 rbtree: Add a define to mark function arguments as unused for non debug
This allows rbtree to be used outside of NetBSD without any compile
warnings and removes the need for the lint comment.
2019-03-08 09:14:54 +00:00
isaki ae06bb460e Fix return value. or_and_fetch should return new value. 2019-03-01 09:57:32 +00:00
isaki 3bbf8c07ee Add missing alias for __atomic_fetch_nand_N.
XXX I'm not sure why does llvm/sparc call __atomic instead of
    __sync though.
XXX atomic_*_cas.c should be more symmetric...
2019-03-01 06:14:52 +00:00
isaki acd53d24e1 Add missing atomic_and_{8,16}_nv_cas.c for __sync_and_and_fetch_{1,2}.
XXX why is not only atomic_and_* symmetric unlike the others?
    (in common/lib/libc/atomic/)
2019-02-28 02:35:37 +00:00
rin 8cef165a13 Export atomic_cas_32_ni in a similar manner to its 64-bit counterpart.
Compile test only, but seems trivial enough for me.

Fix build error due to test/lib/libc/atomic/t_atomic_cas.

Note that mips32 does not use atomic_cas.S.
2019-02-20 05:25:12 +00:00
martin 6899bcaca3 Add atomic_cas_64_ni alias 2019-02-19 18:17:45 +00:00
rin e73f820d2b Sort STRONG_ALIAS's in the same manner as ATOMIC_OP_ALIAS's.
No functional changes.
2019-02-19 12:51:44 +00:00
rin 9121ca69a2 Export _atomic_cas_64 as atomic_cas_64_ni.
Note that _atomic_cas_64 is already exported as atomic_cas_{ulong,prt}_ni.

Fix build error of test/lib/atomic/t_atomic_cas, which is successfully
passed on RPI3B+ now.
2019-02-19 12:47:36 +00:00
martin b79193cac1 Add some atomic_cas_64_ni aliases 2019-02-18 11:22:56 +00:00
isaki ec9c813c13 Add missing export of atomic_or_64 (since rev1.1). 2019-02-17 07:34:44 +00:00
kamil 075cfd7e0e Fix kUBSan build with GCC7
Add missing __unreachable() and FALLTHROUGH keywords.

Reported by <Akul Pillai>
2019-02-13 17:17:02 +00:00
ryo 3f09074d57 - atomic_*_{8,16}_nv() must return a new value, not an old value.
- use "dmb sy" for atomic_*{8,16}_nv() in the same way as atomic_*{32,64}_nv().
2019-02-08 06:56:56 +00:00
ryo 706088913a fix atomic_sub_*(). it was (delta - *ptr), should be (*ptr - delta).
changing shared macro doesn't effect other atomic_ops because
(*ptr [+|^] delta) and (delta [+|^] *ptr) have same result.

atomic_sub_*() haven't used because non standard API?
2019-02-06 05:33:14 +00:00
mrg da4bf28d55 - use __unreachable() and move 'break's around to increase consistency
and correctness

ok kamil@
2019-02-04 22:07:41 +00:00
mrg f5f53dd6ab add support to detect the 3 vmware GPT partition types:
- VMKcore (dump partition)
- VMFS
- VMware reserved

this enables vmkcore partitions for netbsd swap or dump, as well
as naming all of them.
2018-11-06 04:04:33 +00:00
christos 1689d3d9a9 use postincrement, like the patch
XXX: pullup-8
2018-10-15 19:32:48 +00:00
christos 124c823126 Avoid out-of-bounds reads
https://www.openwall.com/lists/musl/2017/06/29/6
XXX: pullup-8
2018-10-15 18:37:19 +00:00
jdolecek bcc384fdef remove M_CANFAIL flag for malloc(9) - it was completely ignored, so had
actually no effect
2018-10-14 17:37:40 +00:00
christos 4496cdcb87 toolify. 2018-08-16 12:03:10 +00:00