Commit Graph

297296 Commits

Author SHA1 Message Date
skrll 288cf70d48 Provide and use (when appropriate) a bge_free_jumbo_mem. 2022-08-07 08:37:48 +00:00
skrll f51d91299f Misc tidyup. NFC. 2022-08-07 08:26:18 +00:00
skrll bd61629612 Unwrap a long line and remove unecessary brackets. NFC. 2022-08-07 08:24:23 +00:00
skrll 17b9e4cecd Fix the KNF. oops. 2022-08-07 08:19:38 +00:00
skrll 21fc0c5d3a whitespace 2022-08-07 08:12:47 +00:00
skrll f7d71627fb KNF 2022-08-07 07:48:19 +00:00
rin eec9572cb1 Consistently use ntohs() instead of htons() when converting from
network to host byte order.

No binary changes both for big and little endian.
2022-08-07 05:51:55 +00:00
rin f9b4da04a6 Enable UFS_DIRHASH; this machine has 256MB RAM :) 2022-08-07 03:08:40 +00:00
simonb f59d02141e Regen. 2022-08-07 02:53:42 +00:00
simonb c7ae7f02a8 UFS/LFS dirhash:
- Enable UFS_DIRHASH if the architecture or kernel model specific config
  file can use 128MB of RAM or more.
- Remove experimental tag from UFS_DIRHASH; it's been with RUMP kernel
  and by a number of NetBSD developers for years.
- Add LFS_DIRHASH if LFS was enabled.
- Be somewhat consistent with FS options order.
2022-08-07 02:52:23 +00:00
simonb 03d50941f1 If UFS or LFS dirhash is enabled in the kernel, set the dirhash cache
size dependant on memory size.  If less than 128MB of memory, default
to no cache.  With 128MB of memory or more, use a maximum cache size of
1/64th of memory; cap maximum default cache size to 32MB (for systems
with 2GB of memory or more).

The dirhash cache sizes are still explicityly setable by sysctl(8) or
by adding relevant entry(s) to sysctl.conf(5).
2022-08-07 02:33:47 +00:00
riastradh 3a9ac44b8b aarch64: Implement __aarch64_casN_sync.
gcc generates calls to this symbol in programs that use
__sync_*_compare_and_swap, which require full sequential consistency
barriers, including store-before-load ordering on both sides of the
atomic; none of the release/acquire operations guarantee that, so we
have to insert explicit DMB instructions.

Note: gcc's own definition omits some of the DMB instructions, but I
can't prove that it's correct that way -- stores preceding the CAS
must complete before the load part of the CAS, and the store part of
the CAS must complete before loads following the CAS.  Maybe there's
some way to prove that one of these orderings is guaranteed some
other way than a DMB but I'm not seeing it, and store-before-load
ordering is hard to understand.

Patch by skrll@ based on a patch by mrg@, soliloquy in commit message
by me.
2022-08-06 21:31:33 +00:00
rillig d2df874ff6 tests/make: demonstrate bug in parsing of modifier parts
In the modifier ':S,from,to,', parsing the two parts 'from' and 'to' of
the modifier differs depending on whether the expression is actually
evaluated or merely parsed.  This not only applies to the ':S' modifier,
but also to ':C', ':@var@body@', ':!cmd!', ':[...]', ':?:', '::=' and
':from=to'.
2022-08-06 21:26:05 +00:00
riastradh 2473fd3d55 vnodeops(9): Take exclusive lock in read/seek for f_offset update.
Otherwise concurrent readers/seekers might clobber it.
2022-08-06 21:21:10 +00:00
ryo 4526d8b331 In my previous change, it was necessary to consider the case where the first block size is zero. 2022-08-06 20:16:42 +00:00
andvar 6478b40555 s/blity/bility/ in various words, mainly in comments. 2022-08-06 18:26:41 +00:00
martin 7322109ce6 PR 56948: fix multicast hash filter setup 2022-08-06 17:53:49 +00:00
riastradh 5f988d0b94 sip(4): Tidy up DMA syncs.
- No membar_producer in sip_init_rxdesc -- use bus_dmamap_sync with
  BUS_DMASYNC_PREWRITE to order updates to the DMA descriptors.

- Omit needless membar_producer in sip_init_txdesc -- the hardware
  will not look at any of these descriptors until we set CMDSTS_OWN
  on the first one in the sequence, which is done later in the
  caller, sipcom_start.

- In gsip_rxintr, make sure to read cmdsts _before_ extsts, by
  separating them with BUS_DMASYNC_PREREAD.  Otherwise, the CPU might
  reorder the loads and read a stale extsts first before witnessing
  an updated cmdsts with the CMDSTS_OWN bit that transfers ownership
  of the rx packet to us.
2022-08-06 15:38:42 +00:00
rin 422de7d163 Assert postts only if we really obtained a timestamp. 2022-08-06 10:22:22 +00:00
rin eb7145dc97 Do not declare unused tstamp for SMALL. NFC. 2022-08-06 10:19:44 +00:00
rin 82dbd18ccf Get back to the statically-allocated tbuf.
If a string is longer than tbuf, it cannot be a timestamp.
Therefore, no need for buffering anymore in this case.
2022-08-06 10:16:18 +00:00
rin df7debb42d Oops, fix thinko in the previous. 2022-08-06 09:42:33 +00:00
wiz 724324d7c9 binutils-2.39 out 2022-08-06 09:39:50 +00:00
rin 2a3cf2bf71 Do not discard \[.*\] which is not identified as a timestamp. 2022-08-06 09:39:32 +00:00
rin d67befb65b KNF. Do not unnecessarily define ADDC() for SMALL. No binary changes. 2022-08-06 09:33:56 +00:00
rillig 7808fd752b tests/make: document parsing behavior of modifiers
The table was created by manually inspecting the code of the various
ApplyModifier functions in var.c.

The modifiers are listed in alphabetical order, except for the SysV
modifier, which is listed at the end since it is used as a fallback
modifier for many other modifiers and because it does not have a fixed
prefix.
2022-08-06 07:06:58 +00:00
chs 1369379d41 allow KMSAN to work again by restoring the limiting of kva even with
NKMEMPAGES_MAX_UNLIMITED.  we used to limit kva to 1/8 of physmem
but limiting to 1/4 should be enough, and 1/4 still gives the kernel
enough kva to map all of the RAM that KMSAN has not stolen.

Reported-by: syzbot+ca3710b4c40cdd61aa72@syzkaller.appspotmail.com
2022-08-06 05:55:37 +00:00
riastradh 21ea4580f9 entropy: Don't disclose stack garbage in kern.entropy sysctls.
kern.entropy.consolidate and kern.entropy.gather are supposed to be
write-only -- it doesn't make any sense to read from them, but I
suppose it's better to read-as-zero than read-as-stack-secrets!
2022-08-05 23:43:46 +00:00
sekiya d980bb9fcc Do not unilaterally set M_HASFCS; this breaks protocols that lack CRC bytes
(such as AppleTalk).

Instead, remove/preserve the final four bytes in the packet ourselves on a per-
protocol basis, as we do in arch/arm/xscale/ixp425_if_npe.c (and dev/ic/gem.c,
and so forth).
2022-08-05 21:03:43 +00:00
rillig 279cb3bcf8 make: when parsing ':D' or ':U', only copy text if necessary
When parsing the expression ${:D any ${uninterpreted} text}, parsing of
the ':D' modifier only needs to skip to the next delimiter, there is no
need to keep record of the text that has been skipped.  In this
particular example, there had been an unnecessary memory allocation
since the nested expression was not copied to the result buffer.  Due to
that, the resulting buffer contained " any  text", which was not a
substring of the text passed to the parser, thereby forcing the memory
allocation.

No functional change.
2022-08-05 20:59:54 +00:00
rillig 4487a8e94d make: extract parsing of ':D' and ':U' modifiers into separate function
No functional change.
2022-08-05 20:35:55 +00:00
riastradh bd3b975119 ptyfs: Don't copy out cookies past end of buffer.
Reported-by: syzbot+2aae7c4eddc796f917e6@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=5fe24c1da952ac2ea498d745d6479bc6be91a751
2022-08-05 10:36:02 +00:00
riastradh 5c23615bdf i915: Restore non-obsolete set list entries. 2022-08-05 08:48:36 +00:00
skrll 29c8263b9d Sprinkle const on splfoo call results. 2022-08-05 05:50:54 +00:00
thorpej b116f7a825 In vcache_reclaim(), post NOTE_REVOKE immediately after changing the
vnode state to VS_RECLAIMING, before we actually call VOP_RECLAIM(),
which will release the reference on the lower node of a stacked FS
vnode, which is likely to free the upper node's v_klist backing store.

Acquire the vnode interlock when checking for kevent interest now,
because the vp->v_klist pointer is now volatile.

PR kern/56950
2022-08-05 05:20:39 +00:00
andvar 8e4f953b33 s/bufferred/buffered/ in memory description.L: 2022-08-04 21:11:52 +00:00
ryo c7071a7006 Don't pass a block of size 0 to fdt_memory_add_range().
There are some environments where size 0 blocks are passed from the loader.
2022-08-04 11:58:55 +00:00
riastradh e603605e86 proplib: Fix mistake in previous -- use strncmp for prefix matching. 2022-08-04 09:02:29 +00:00
riastradh efe5c7855e proplib: Don't run off end of buffer with memcmp.
The input is required to be NUL-terminated anyway, so just use strcmp
here.

Reported-by: syzbot+69838802c8ec55909ba3@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=927d66e8aa079ba2be43497425a6d9878025ad09
2022-08-03 21:20:21 +00:00
riastradh 3f7675e077 proplib: Nix trailing whitespace. 2022-08-03 21:13:46 +00:00
ryo de5ab53686 fix build with options PMAPBOOT_DEBUG and options DDB 2022-08-03 17:55:05 +00:00
riastradh c176bd8b34 kern/vfs_lockf.c: Fix overflow in overflow detection.
Reported-by: syzbot+cda9440741a1516747c8@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=030eb71324790093d467799263cd0789e5097229
2022-08-03 11:09:13 +00:00
riastradh ab293a4a77 rasctl(2): Avoid overflow in address range arithmetic.
Remove various contortions to suppress warnings.  Rely on
-Wno-type-limits instead.

Reported-by: syzbot+8b0f1ced3fce82031535@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=e9055200701cffd653d5b13491d85c34e07f06a3
2022-08-03 09:40:25 +00:00
riastradh 610f9263f0 sys: Build kernel with -Wno-type-limits.
The type-limits warning is actively harmful because it discourages
writing safe portable overflow detection logic which happens, on some
architectures, to be dead code.
2022-08-03 09:37:36 +00:00
skrll a84103a22f Add a KASSERT for the locking protocol in wm_ioctl.
Read the interface up/down status from sc_if_flags (under WM_CORE_LOCK)
when deciding if the multicast filter needs to be updated.

Discussed with msaitoh@, knakahara@ and riastradh@
2022-08-03 05:29:04 +00:00
skrll 5163322bd0 Add some KASSERTs around the locking protocol.
Discussed with msaitoh@, knakahara@ and riastradh@
2022-08-03 05:23:30 +00:00
chs 02f91ef077 change the ARC reclaim code to use the pagedaemon's free page target
rather than having a separate target.
2022-08-03 01:53:06 +00:00
chs f39adc8860 for platforms which define NKMEMPAGES_MAX_UNLIMITED, set nkmempages
high enough to allow the kernel to map all of RAM into kmem,
so that free physical pages rather than kernel virtual space is
the limiting factor in allocating kernel memory.  this gives ZFS
more flexibility in tuning how much memory to use for its ARC cache.
2022-08-03 01:52:11 +00:00
riastradh c45c044c8d sys/compat/common/if_media_80.c: Add kernel rcsid. 2022-08-03 01:38:51 +00:00
riastradh 0d57c6f297 genfb: Handle uninitialized softc in genfb_enable/disable_polling.
This can happen due to janky MD kludgerosity like x86
x86_genfb_ddb_trap_callback, which should really be cleaned up, but
at least this might help with the recursive traps we've been seeing
in syzbot.
2022-08-01 23:30:10 +00:00