Roy Marples [Wed, 13 Nov 2019 17:05:41 +0000 (17:05 +0000)]
Merge branch 'vendor/DHCPCD'
Tomohiro Kusumi [Thu, 14 Nov 2019 19:09:07 +0000 (04:09 +0900)]
sys/vfs/msdosfs: Assume up to 8192 bytes sector for BPB
from freebsd/freebsd@
dba17f21d375effcf89349e1d86b34b2f408ad0b
Tomohiro Kusumi [Thu, 14 Nov 2019 17:04:13 +0000 (02:04 +0900)]
sys/vfs/msdosfs: Return EBUSY on lookup on delete/rename of MSDOSFSROOT_OFS
from freebsd/freebsd@
e672feb26e335afc5801c618b8d3e24ee7d29414
Tomohiro Kusumi [Thu, 14 Nov 2019 16:10:04 +0000 (01:10 +0900)]
sys/vfs/msdosfs: Sync minor styles with FreeBSD
Tomohiro Kusumi [Wed, 13 Nov 2019 17:19:16 +0000 (02:19 +0900)]
sys/vfs/msdosfs: Allow B_CLUSTEROK in deupdat()
Since now that VFS clustering is supported, apply remaining bits
from freebsd/freebsd@
3bbdcb77fd843ff34a0054bea92392cee78dd0ec
that was dropped in
8480e7bcdf9ffa9f44f80f9362c6f62424ada748.
Tomohiro Kusumi [Wed, 13 Nov 2019 16:51:52 +0000 (01:51 +0900)]
sys/vfs/msdosfs: Don't use MSDOSFSMNT_WAITONFAT
from freebsd/freebsd@
5e07d49c626dea51d672ea9d9bd1499e0ae8eb29
Tomohiro Kusumi [Wed, 13 Nov 2019 15:33:13 +0000 (00:33 +0900)]
sys/vfs/msdosfs: Include FAT headers via <vfs/msdosfs/...>
Sync order with FreeBSD.
Roy Marples [Wed, 13 Nov 2019 17:01:06 +0000 (17:01 +0000)]
Import dhcpcd-8.1.2
* hooks: STOPPED is now run on timeout and exit
* BSD: Use IP_REVCIF rather than IN_PKTINFO
* DHCP: When rebinding, ensure we have a DHCP ARP state
* RA: Sort routers when reachability changes
* RA: Apply hoplimit, reachable and retrans timer values to kernel
* RA: Warn if advertised MTU > interface MTU
* dhcpcd: Report SSID connection to when we gain carrier
* DHCP: Fix corruption of address flags when renewing
Matthew Dillon [Tue, 12 Nov 2019 22:49:30 +0000 (14:49 -0800)]
kernel - Fix first-lwp access race vs process creation
* It is possible for a process to be looked up before its primary
lwp is installed. Make sure this doesn't crash the kernel.
Matthew Dillon [Tue, 12 Nov 2019 22:45:09 +0000 (14:45 -0800)]
pthreads - Fix incorrect fork assumption
* libthread_xu assumed that the forked child process's TID would be 1,
but that is no longer the case.
* Fix the assumption and correct some comments while we are here.
Reported-by: zrj
Matthew Dillon [Tue, 12 Nov 2019 19:54:57 +0000 (11:54 -0800)]
docs - Add manual page for sigblockall() and sigunblockall()
* Add a nice manual page for sigblockall() and sigunblockall()
Matthew Dillon [Tue, 12 Nov 2019 19:00:42 +0000 (11:00 -0800)]
kernel and libc - Reimplement lwp_setname*() using /dev/lpmap
* Generally speaking we are implementing the features necessary
to allow per-thread titling set via pthread_set_name_np() to
show up in 'ps' output, and to use lpmap to make it fast.
* The lwp_setname() system call now stores the title in
lpmap->thread_title[].
* Implement a libc fast-path for lwp_setname() using lpmap.
If called more than 10 times, libc will use lpmap for any
further calls, which omits the need to make any system calls.
* setproctitle() now stores the title in upmap->proc_title[]
instead of replacing proc->p_args. proc->p_args is now no
longer modified from its original contents.
* The kernel now includes lpmap->thread_title[] in the following
priority order when retrieving the process command line:
lpmap->thread_title[] User-supplied thread title, if not empty
upmap->proc_title[] User-supplied process title, if not empty
proc->p_args Original process arguments (no longer modified)
* Put the TID in /dev/lpmap for convenient access
* Enhance the KERN_PROC_ARGS sysctl to allow the TID to be specified.
The sysctl now accepts { KERN_PROC, KERN_PROC_ARGS, pid, tid }
in addition to the existing { KERN_PROC, KERN_PROC_ARGS, pid }
mechanism.
Enhance libkvm to use the new feature. libkvm will fall-back to
the old version if necessary.
Matthew Dillon [Tue, 12 Nov 2019 18:56:37 +0000 (10:56 -0800)]
libc - Implement sigblockall() and sigunblockall() (3)
* I half expected my reordering of lwp_fork*() to cause problems,
and it did. Fix a panic window due to the new lwp getting added
to the process before its underlying lwkt thread is assigned.
* Document the subtle issues, including the fact that in the
[v]fork() case we must assign the correct TID in lwp_fork1() for
vm_fork() to consume when dealing with /dev/lpmap
Tomohiro Kusumi [Tue, 12 Nov 2019 18:34:55 +0000 (03:34 +0900)]
sys/gnu/vfs/ext2fs: Use IO_SEQSHIFT
0d540a44319db497468b7c5b37893f5328ce7d5e was missing ext2.
Tomohiro Kusumi [Tue, 12 Nov 2019 18:02:39 +0000 (03:02 +0900)]
sys/vfs: Use IO_SEQSHIFT
Tomohiro Kusumi [Tue, 12 Nov 2019 16:05:59 +0000 (01:05 +0900)]
sys/vfs/msdosfs: Fix va_fileid casts
bits from freebsd/freebsd@
ab16560f3305829961b71dbe71233abcd50f0aba
Tomohiro Kusumi [Tue, 12 Nov 2019 15:09:05 +0000 (00:09 +0900)]
sys/vfs/msdosfs: Save/restore fatchain cache in VOP_BMAP()
from freebsd/freebsd@
651827134bd3a0e50aa76f83e6b83d6976b010a6
Prevent VOP_BMAP() from updating FC_LASTMAP fatchain cache
with irrelevant location.
Tomohiro Kusumi [Mon, 11 Nov 2019 20:57:40 +0000 (05:57 +0900)]
sys/vfs/msdosfs: Support vfs clustering
from freebsd/freebsd@
8fdd1a79d0f77863b38e6de503ef08f19bef2e89
fio shows random read/write throughput improvement by 10% or so.
Sascha Wildner [Tue, 12 Nov 2019 10:12:58 +0000 (11:12 +0100)]
Use our standard bool type in a few places.
Sascha Wildner [Tue, 12 Nov 2019 08:37:53 +0000 (09:37 +0100)]
libc: Fix up two Symbol.map's a bit.
* Keep _nmalloc_thr_init, it didn't go away.
* Put _libc_thr_init into DF508.0.
* Reindent like everywhere else.
Matthew Dillon [Tue, 12 Nov 2019 05:38:33 +0000 (21:38 -0800)]
libc - Implement sigblockall() and sigunblockall() (2)
* Cleanup the logic a bit. Store the lwp or proc pointer
in the vm_map_backing structure and make vm_map_fork()
and friends more aware of it.
* Rearrange lwp allocation in [v]fork() to make the pointer(s)
available to vm_fork().
* Put the thread mappings on the lwp's list immediately rather
than waiting for the first fault, which means that per-thread
mappings will be deterministically removed on thread exit
whether any faults happened or not.
* Adjust vmspace_fork*() functions to not propagate 'dead' lwp
mappings for threads that won't exist in the forked process.
Only the lwp mappings for the thread doing the [v]fork() is
retained.
Matthew Dillon [Tue, 12 Nov 2019 03:24:48 +0000 (19:24 -0800)]
kernele - lpmap work - split lwp_fork() into lwp_fork1() and lwp_fork2()
* Split lwp_fork() so we can have the lwp in-hand when issuing the
vm_fork().
Matthew Dillon [Tue, 12 Nov 2019 02:14:07 +0000 (18:14 -0800)]
acpi - Catch infinite parser recursions
* Instrument AcpiPsParseLoop() and limited recursion depth to 5.
Generally speaking this loop can call a very deep stack of
routines and eat up the kernel stack. A depth limit of 5 might
be a bit too low, but it doesn't take much more to blow up
our current 16KB kernel stack.
This prevents the kernel from double-faulting on excessively bad
AML.
* Works around reported boot-time double-faults on some laptops.
Matthew Dillon [Tue, 12 Nov 2019 02:12:57 +0000 (18:12 -0800)]
kernel - Repurpose td_tracker
* Remove td_tracker use from hammer2
* The field is now a general purpose call recursion tracker, base
value 0.
Matthew Dillon [Tue, 12 Nov 2019 02:03:00 +0000 (18:03 -0800)]
vmstat - Increase buffer for vmstat -m
* Increase the buffer from 1024 entries to 16384 entries.
Matthew Dillon [Tue, 12 Nov 2019 01:51:35 +0000 (17:51 -0800)]
libc - make strtok() thread-safe
* Make strtok() thread-safe. Applications are getting too complex
to trust that they will do the right thing.
Matthew Dillon [Tue, 12 Nov 2019 01:35:42 +0000 (17:35 -0800)]
libc - Implement sigblockall() and sigunblockall()
* Signal safety is becoming a defacto requirement for most of libc and
pthreads. In particular, the memory allocator. Given the chances of
teaching tens of thousands of programmers about signal safety, and
just making it work in libc and pthreads, only one of these two
possibilities is actually realizable.
In particular, high-level languages have become so complex, and some
applications (chrome, firefox, etc) have become so complex, that the
code is regularly tripping over signal safety issues.
However, implementing signal safety with current mechanisms is extremely
expensive due to the need for multiple system calls. To whit,
DragonFlyBSD now has a mechanism that does not require system calls
in the critical path.
* Implement sigblockall() and sigunblockall(). These functions
leverage the new /dev/lpmap per-thread shared page mechanism
to provide a way to temporary block the dispatch of all maskable
signals without having to make any system calls.
These are extremely fast routines.
- Reentrant / Recursable
- Temporarily blocks any dispatch of a maskable asynchronous signal
to the calling thread. Other threads are not affected... this is
a per-thread mechanism.
- The last sigunblockall() will immediately dispatch any blocked
signals.
- The normal signal mask is not affected by these routines.
- Does not block signals caused by synchronous traps.
- The current recursion count is retained on [v]fork() to ease
coding and to also allow signals to be temporarily blocked across a
fork until the child process is ready to deal with them, if desired.
* Implement signal safety for most of pthreads. All temporary internal
mutexes are now wrapped with sigblockall() and sigunblockall().
* Implement signal safety for the malloc subsystem. All functions
are wrawpped with sigblockall() and sigunblockall().
These implementations make lang/mono and lang/rust far more reliable
than they were before. Where 9 out of 10 builds used to fail, now
they succeed.
Matthew Dillon [Tue, 12 Nov 2019 01:06:55 +0000 (17:06 -0800)]
kernel - sigblockall()/sigunblockall() support (per thread shared page)
* Implement /dev/lpmap, a per-thread RW shared page between userland
and the kernel. Each thread in the process will receive a unique
shared page for communication with the kernel when memory-mapping
/dev/lpmap and can access varous variables via this map.
* The current thread's TID is retained for both fork() and vfork().
Previously it was only retained for vfork(). This avoids userland
code confusion for any bits and pieces that are indexed based on the
TID.
* Implement support for a per-thread block-all-signals feature that
does not require any system calls (see next commit to libc). The
functions will be called sigblockall() and sigunblockall().
The lpmap->blockallsigs variable prevents normal signals from being
dispatched. They will still be queued to the LWP as per normal.
The behavior is not quite that of a signal mask when dealing with
global signals.
The low 31 bits represents a recursion counter, allowing recursive
use of the functions. The high bit (bit 31) is set by the kernel
if a signal was prevented from being dispatched. When userland decrements
the counter to 0 (the low 31 bits), it can check and clear bit 31 and
if found to be set userland can then make a dummy 'real' system call
to cause pending signals to be delivered.
Synchronous TRAPs (e.g. kernel-generated SIGFPE, SIGSEGV, etc) are not
affected by this feature and will still be dispatched synchronously.
* PThreads is expected to unmap the mapped page upon thread exit.
The kernel will force-unmap the page upon thread exit if pthreads
does not.
XXX needs work - currently if the page has not been faulted in
the kernel has no visbility into the mapping and will not unmap it,
but neither will it get confused if the address is accessed. To
be fixed soon. Because if we don't, programs using LWP primitives
instead of pthreads might not realize that libc has mapped the page.
* The TID is reset to 1 on a successful exec*()
* On [v]fork(), if lpmap exists for the current thread, the kernel will
copy the lpmap->blockallsigs value to the lpmap for the new thread
in the new process. This way sigblock*() state is retained across
the [v]fork().
This feature not only reduces code confusion in userland, it also
allows [v]fork() to be implemented by the userland program in a way
that ensures no signal races in either the parent or the new child
process until it is ready for them.
* The implementation leverages our vm_map_backing extents by having
the per-thread memory mappings indexed within the lwp. This allows
the lwp to remove the mappings when it exits (since not doing so
would result in a wild pmap entry and kernel memory disclosure).
* The implementation currently delays instantiation of the mapped
page(s) and some side structures until the first fault.
XXX this will have to be changed.
Sascha Wildner [Mon, 11 Nov 2019 09:13:46 +0000 (10:13 +0100)]
useful_macros.cocci: Improve a bit.
Submitted-by: Markus Elfring
https://github.com/DragonFlyBSD/DragonFlyBSD/commit/
194bb2afcef86db2c8a0a56b7d8527aa3eb01fb0#commitcomment-
35885096
Sascha Wildner [Mon, 11 Nov 2019 08:15:56 +0000 (09:15 +0100)]
Makefile_upgrade.inc: Sort a bit.
Sascha Wildner [Mon, 11 Nov 2019 08:15:39 +0000 (09:15 +0100)]
Remove OPIE remains.
Tomohiro Kusumi [Sun, 10 Nov 2019 16:27:06 +0000 (01:27 +0900)]
sys/vfs/msdosfs: Need to explicitly set bp to NULL
for several vnops.
Matthew Dillon [Sun, 10 Nov 2019 16:53:09 +0000 (08:53 -0800)]
dsynth - Improve 'debug' target, fix "x\n" in logs
* Improve the 'debug' target. Remove the target packages first,
just like the 'test' target, and include a description for the
'debug' target in dsynth help.
* Change the pty handshake to just a newline, it still shows up in the
logs due to (probably) master-pty echo mode, but it isn't really
noticeable verses the previous "x\n".
Roy Marples [Sun, 10 Nov 2019 15:17:54 +0000 (15:17 +0000)]
inet6: Support the ioctl SIOCSIFINFO_IN6
This allows setting hop limit, reachable and retransmit times,
as well as link mtu for the interface.
It's analogous to the SIOCGIFINFO_IN6 ioctl.
Taken from NetBSD.
Aaron LI [Sun, 10 Nov 2019 09:28:52 +0000 (17:28 +0800)]
if_tap: Handle 'SIOCSIFMTU' ioctl directly to support MTU > 1500
Add the SIOCSIFMTU ioctl handling directly to tap(4) permitting it to
have its MTU set higher than 1500 (ETHERMTU). Its new limit is now
65535 as enforced by 'ifhwioctl()' in 'if.c'.
This allows a tap(4) device to be added to a bridge, which requires all
interface members to have the same MTU, with an interface configured for
jumbo frames. QEMU may now connect to a network via tap(4) without
requiring the real interface to have its MTU set to 1500 or lower.
Also bump __DragonFly_version.
Obtained-from: FreeBSD (revision 189866)
Aaron LI [Thu, 30 Aug 2018 13:09:54 +0000 (21:09 +0800)]
tools/wesside: Update to use /dev/tap directly
Use the autocloner /dev/tap instead of relying upon pre-created (and
hard-coded) /dev/tap3.
Aaron LI [Thu, 30 Aug 2018 13:05:50 +0000 (21:05 +0800)]
nos-tun(8): Directly use /dev/tun and remove option '-t'
Update nos-tun(8) to directly use /dev/tun instead of the pre-created
/dev/tunX devices. Therefore, the option '-t' is no longer used and
removed.
Sascha Wildner [Sun, 10 Nov 2019 10:12:32 +0000 (11:12 +0100)]
#include <sys/cdefs.h> in a number of headers that use macros from it.
All these are public headers and check some kind of __*_VISIBLE macro
with #if but were not making sure that these macros are available and
set correctly.
Sascha Wildner [Sun, 10 Nov 2019 10:26:12 +0000 (11:26 +0100)]
<sys/msgport.h>: Add <sys/types.h> for boolean_t (kernel only).
Aaron LI [Sun, 10 Nov 2019 04:43:14 +0000 (12:43 +0800)]
calendar(1): Define "LANG" for national calendars
Similar to the other national calendars in 'calendars/*.UTF-8'
directories.
Aaron LI [Sun, 10 Nov 2019 04:40:45 +0000 (12:40 +0800)]
calendar(1): Reset locale after parsing each calendar file
This avoids that one calendar file that changed the locale by defining
the "LANG") does not interfere the following calendar files without the
"LANG" definition.
Aaron LI [Sun, 10 Nov 2019 03:54:44 +0000 (11:54 +0800)]
calendar(1): Search calendar file in current directory first
This fixes the regression introduced in commit
f8b849d1082177cbfa11f941feeeced54815dc56.
Aaron LI [Sun, 10 Nov 2019 02:27:24 +0000 (10:27 +0800)]
calendar(1): Refactor mail header composition and sending
* Use 'struct iovec header[]' to hold all mail headers, and then use
writev(2) to write them into the pipe.
* Explicitly set 'LC_TIME=C' when formating the date string for the mail
header.
Obtained-from: OpenBSD
Aaron LI [Sat, 9 Nov 2019 14:56:57 +0000 (22:56 +0800)]
calendar(1): Merge 'pathnames.h' into 'io.c'
The '_PATH_INCLUDE' is no longer an appropriate name for the system
calendars at '/usr/share/calendar', because we no longer use 'cpp' to
parse the user's calendar file.
Aaron LI [Sat, 9 Nov 2019 13:49:18 +0000 (21:49 +0800)]
calendar(1): Use login caps for 'calendar -a'
* Use 'fork()' and 'setusercontext(LOGIN_SETALL)' for every user. With
this change, the complex function 'cal()' that parses user-owned
calendars is now executed with appropriate user privileges.
Previously it was run with privileges dropped only temporary for
execution of 'cal()', and fully dropped only before invoking 'sendmail'.
* In 'calendar -a' mode, the 'getenv("HOME")' in 'cal_fopen()' function
always returns the root's home directory instead of the current user's
home (after fork() and setusercontext()), which makes 'chdir(home)'
fail.
Fix this issue by moving the 'chdir(home)' to the 'main()' function in
'calendar.c'. In the meantime, back to home directory in
'cal_fopen()' function after opening the calendar file.
Partially based on FreeBSD's commit:
https://github.com/freebsd/freebsd/commit/
7ff75f4a5a3d9ada5bd68384fdded357fa4c1105
Aaron LI [Wed, 6 Nov 2019 14:53:38 +0000 (22:53 +0800)]
calendar(1): Remove pointless playing with LC_TIME
Obtained-from: FreeBSD (revision 352115)
https://github.com/freebsd/freebsd/commit/
259fac94399127186906acf0e975dffdb6e48bc7
Aaron LI [Wed, 6 Nov 2019 14:48:11 +0000 (22:48 +0800)]
calendar(1): Merge two fixes to calendars from FreeBSD
* Change the date of 'Canberra Day'
https://github.com/freebsd/freebsd/commit/
8b17fbc25c73dce357de0a309ade8bfa4b7674b0
* Correct spelling for 'King Chulalongkorn Day in Thailand'
https://github.com/freebsd/freebsd/commit/
6bc988a89b2d13e66a4b80e0f8503ea9175c72b0
Aaron LI [Wed, 6 Nov 2019 14:19:59 +0000 (22:19 +0800)]
calendar(1): Add '-h' and '-?' to show usage help
Aaron LI [Sun, 3 Nov 2019 03:30:27 +0000 (11:30 +0800)]
calendar(1): Do not ignore errors of setuid/setgid in '-a' mode
Also clear the supplementary groups list up front when becoming another
user, to avoid leaking any extra group privileges that we might have.
In addition, introduce the 'changeuser()' function to make the
'closecal()' function a bit cleaner.
Obtained-from: NetBSD
(https://github.com/NetBSD/src/commit/
d23503416735cd0ca069bbd4e59c9c5b93278d8b)
Aaron LI [Thu, 31 Oct 2019 15:44:04 +0000 (23:44 +0800)]
calendar(1): Significant update to calendars from OpenBSD
* The calendars were obtained from OpenBSD as of 2019-02-19
* Generally, OpenBSD has more entries and more accurate, but FreeBSD has
also updated some entries and fixed some mistakes.
* I cross-checked most mismatching entries by searching the Internet and
also fixed several mistakes.
* NOTE: there can certainly exist quite some mistakes because I cannot
thoroughly check all of them.
Aaron LI [Tue, 5 Nov 2019 15:24:10 +0000 (23:24 +0800)]
calendar(1): Improve UTC offset and longitude handling
Refactor the code that deals with the UTC offset into a separate
function 'get_utcoffset()'.
Meanwhile, allow the '-l' option to accept a float number instead of
an integer only. This makes more sense.
Aaron LI [Tue, 5 Nov 2019 15:23:06 +0000 (23:23 +0800)]
calendar(1): Various cleanups
* Mostly style cleanups.
* Use 'bool' when more appropriate.
* Staticize several functions and variables to clean up 'calendar.h'.
Aaron LI [Mon, 18 Feb 2019 05:30:35 +0000 (13:30 +0800)]
calendar(1): Remove redundant fr_FR.UTF-8/calendar.french
Aaron LI [Mon, 18 Feb 2019 05:12:52 +0000 (13:12 +0800)]
calendar(1): Use UTF-8 for all calendars
Remove 'pt_BR.ISO8859-1' and 'ru_RU.KOI8-R' since their UTF-8 version
already exist.
Convert the following calendars to UTF-8:
* de_AT.ISO8859-15
* de_DE.ISO8859-1
* fr_FR.ISO8859-1
* hr_HR.ISO8859-2
* hu_HU.ISO8859-2
* uk_UA.KOI8-U
Update Makefile, Makefile_upgrade.inc and mtree(8) entries accordingly.
Aaron LI [Mon, 18 Feb 2019 01:17:31 +0000 (09:17 +0800)]
calendar(1): Rework calendar files installation
Switch the installation of calendar files to use FILES and SYMLINKS
instead of bare install(1). Also explicitly list each file to install
so we don't silently add or miss some.
Obtained-from: FreeBSD (revision 334102)
Aaron LI [Sun, 17 Feb 2019 15:44:21 +0000 (23:44 +0800)]
calendar(1): Sync with FreeBSD
New features:
* Support events that span multiple years, because of '-A', '-B' or just
the three days before the end of the year.
* Support for lunar events (full moon, new moon), solar events (equinox,
solstice), and Chinese new year. Because of this, the options '-U'
(UTC offset) and '-l' (longitude) are available to compensate if
reality doesn't match the calculated values.
* Implement an internal 'cpp'-like parser to parse the calendars, so no
longer require the external cpp(1).
Changed behavior:
DragonFly's calendar(1) switched to use the 'calendar.all' file by
default in
9abdd9620822cc1232dc702a76d95ebf133733b5. This calendar file
always exists. However, it makes calendar(1) print too much entries,
which I think most users would not need. So switch to the original
default calendar file, i.e., 'calendar', the same as other BSDs.
The following minor changes were made:
1. In 'calendar.c' and 'io.c', delete the unused 'copyright' variable
to suppress the compilation warnings.
2. In 'sunpos.c', rename the macro 'MIN(h)' to 'MINUTE(h)' to avoid the
conflict; meanwhile rename the macro 'SMIN(h)' to 'SMINUTE(h)' for
better consistency.
More cleanups and improvements to follow.
Aaron LI [Sun, 17 Feb 2019 11:20:25 +0000 (19:20 +0800)]
calendar(1): Sync calendars from FreeBSD
Update the mtree(8) entries and the man page accordingly.
Tomohiro Kusumi [Sat, 9 Nov 2019 15:17:20 +0000 (00:17 +0900)]
sys/vfs/msdosfs: Cleanup before implementing vfs clustering
from freebsd/freebsd@
b2bdcce9e10d5055a3afbfebf98e0e05fcd67113
Sync with a cleanup commit before FreeBSD added clustering support.
Tomohiro Kusumi [Sat, 9 Nov 2019 15:17:06 +0000 (00:17 +0900)]
sys/vfs/msdosfs: Fix regression from cleanup commit
20241ea208
rablock needs to be a cluster#.
Tomohiro Kusumi [Fri, 8 Nov 2019 20:44:52 +0000 (05:44 +0900)]
sys/vfs/msdosfs: Remove BPB_TotSec16 test for FAT32 on mount(2)
from freebsd/freebsd@
ad92b9afc4f7ec122f9438ac64b58c2926a6a6a4
Looks like BSD implementation of FAT wants to not test
BPB_TotSec16 == 0 even for FAT32. Read above for details.
Tomohiro Kusumi [Fri, 8 Nov 2019 19:41:29 +0000 (04:41 +0900)]
sys/vfs/msdosfs: Fix comments on corrupted fs
from freebsd/freebsd@
54e5c67329366d24de694633c94a8d2640534095
Tomohiro Kusumi [Fri, 8 Nov 2019 19:01:18 +0000 (04:01 +0900)]
sys/vfs/msdosfs: Fix typo
Matthew Dillon [Fri, 8 Nov 2019 16:38:21 +0000 (08:38 -0800)]
virtio - SI_ORDER_FIRST -> SI_ORDER_EARLIER
* Virtio should not assume that it can initialize first in the
attach order, but we do want it to initialize earlier rather
than later.
Matthew Dillon [Fri, 8 Nov 2019 16:36:50 +0000 (08:36 -0800)]
kernel - Use SI_ORDER_THIRD for CAM peripheral modules.
* Use SI_ORDER_THIRD for CAM peripheral modules so we get a
more deterministic placement for the attach order.
Matthew Dillon [Fri, 8 Nov 2019 16:35:09 +0000 (08:35 -0800)]
kernel - Add additional SI_ORDER_* flags
* Add SI_ORDER_FORTH
* Add SI_ORDER_EARLIER (before MIDDLE) and SI_ORDER_LATER
(after MIDDLE). This is to allow certain devices to
attach earlier rather than later, without having to make
assumptions about being able to use FIRST, SECOND, etc.
Matthew Dillon [Fri, 8 Nov 2019 16:31:51 +0000 (08:31 -0800)]
virtio - Fix LUN scan issue w/ Google Cloud
* Use CAM_DEV_NOT_THERE instead of CAM_SEL_TIMEOUT when
translating VIRTIO_SCSI_S_BAD_TARGET.
* Fixes a LUN scan issue on google cloud VMs that
causes the entire device to be dropped.
CAM_SEL_TIMEOUT on specific LUN -> cam_periph_error() ->
AC_LOST_DEVICE on wildcard (whole device).
Matthew Dillon [Fri, 8 Nov 2019 16:30:43 +0000 (08:30 -0800)]
kernel - Deal with obsolete/misused SID_Sync flag in CAM
* The SID_Sync flag is obsolete or misused in some situations
(some virtio block devices), ignore it.
Reported-by: tuxillo
Testing-by: tuxillo
Tomohiro Kusumi [Fri, 8 Nov 2019 12:24:05 +0000 (21:24 +0900)]
sys/vfs/msdosfs: Add/use DOINGASYNC()
from freebsd/freebsd@
311bc737d859452ad0514fe48c005bcefcbc3eda
Note that in FreeBSD DOINGASYNC() macro isn't specific to FAT.
Tomohiro Kusumi [Fri, 8 Nov 2019 12:03:05 +0000 (21:03 +0900)]
sys/vfs/msdosfs: Support async mount (delayed write)
from freebsd/freebsd@
c590272b42e93312c35e2c65311528e435564f7c
Basically don't use this.
Tomohiro Kusumi [Fri, 8 Nov 2019 15:12:05 +0000 (00:12 +0900)]
sys/vfs/msdosfs: Avoid "." corruption on rename(2)
from freebsd/freebsd@
42829c17958177a094b3b521ea5870e19928263f
Tomohiro Kusumi [Thu, 7 Nov 2019 15:21:06 +0000 (00:21 +0900)]
sys/vfs/msdosfs: Improve fsync(2) behavior
from freebsd/freebsd@
3bbdcb77fd843ff34a0054bea92392cee78dd0ec
Do sloppy sync of metadata by syncing the entire FAT on fsync(2).
Also improve deupdat(). Read above for details.
Matthew Dillon [Wed, 6 Nov 2019 17:31:26 +0000 (09:31 -0800)]
dsynth - Change default compression from .tgz to .txz
* Change default compression from .tgz to .txz, just so the
results are space-efficient, even though this will slow down
bulk builds.
* Anyone can change the compression algo via Package_suffix,
see 'man dsynth'. .tgz is recommended if reducing bulk build
time is critical for you.
Requested-by: zrj
Tomohiro Kusumi [Wed, 6 Nov 2019 16:35:02 +0000 (01:35 +0900)]
sys/vfs/msdosfs: Remove seemingly unneeded unlock/relock of dvp
from freebsd/freebsd@
21f579c3fb6b782ee610255d7f5bbb22e326b66c
Tomohiro Kusumi [Wed, 6 Nov 2019 13:34:04 +0000 (22:34 +0900)]
sys/vfs/msdosfs: Remove unrelated comment on rmdir
FreeBSD explicitly calls cache_purge() here.
Matthew Dillon [Tue, 5 Nov 2019 21:47:48 +0000 (13:47 -0800)]
dsynth - Add ARCH make var to bulk scan
* Add the ARCH make variable and env variable to bulk scan operations.
Reported-by: tuxillo
Tomohiro Kusumi [Tue, 5 Nov 2019 13:18:35 +0000 (22:18 +0900)]
sys/vfs/msdosfs: Sync debug prints with FreeBSD
from freebsd/freebsd@
2531d8deb3ae1fe51c43a46f528fda3fdf1806e2
Matthew Dillon [Mon, 4 Nov 2019 19:48:21 +0000 (11:48 -0800)]
dsynth - Conditionalize use of check-plist stage
* Only run the check-plist stage for:
dsynth -P <anything>
dsynth -D everything
dsynth test ...
François Tigeot [Sun, 3 Nov 2019 21:00:19 +0000 (22:00 +0100)]
devfs: Add a vnode pointer argument to dev_dopen()
* Initialize fp->f_data with it when possible
* drm drivers expect to be able to access vnode information in
their open() function
Reviewed-by: dillon
François Tigeot [Sun, 3 Nov 2019 20:31:43 +0000 (21:31 +0100)]
drm/linux: Rework wait_event_xxx() macros
The wait queue lock must not be held permanently.
This commit should fix issue #3200, reported-by Peeter.
Matthew Dillon [Sun, 3 Nov 2019 20:06:54 +0000 (12:06 -0800)]
dsynth - Enhance FAILURE log message
* Enhance the 02_failure_list.log messages to also print the number of
other packages being skipped due to the failure.
Requested-by: zrj
Sascha Wildner [Sun, 3 Nov 2019 12:31:12 +0000 (13:31 +0100)]
file(1): Fix CVE-2019-18218.
For further details see:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-18218
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16780
Reported-by: zrj
Tomohiro Kusumi [Sun, 3 Nov 2019 09:12:05 +0000 (18:12 +0900)]
sbin/hammer2: Add /dev/ad* and /dev/vn* to "info"/"mountall" targets
François Tigeot [Sun, 3 Nov 2019 09:50:21 +0000 (10:50 +0100)]
drm/linux: Only define GFP_KERNEL once
François Tigeot [Sun, 3 Nov 2019 09:35:50 +0000 (10:35 +0100)]
drm: Remove most system headers from linux/list.h
They do not serve any useful purpose there.
Suggested-by: zrj
zrj [Sat, 2 Nov 2019 20:16:51 +0000 (22:16 +0200)]
<wchar.h>: Remove limits pollution.
The <wchar.h> now should properly only define WCHAR_MIN/WCHAR_MAX as per
opengroups. Fix fallout in col(1) that makes use of INT_MIN/INT_MAX.
No binary differences for buildworld.
While there, add comment why <ctype.h> is in <wchar.h>.
zrj [Sat, 2 Nov 2019 18:39:19 +0000 (20:39 +0200)]
<stdint.h>: Remove C99 constant/limits guards for c++.
It seems that in C11 problematic clauses where removed. This removes
the inconsistency for -std=c++98 between base and DPorts c++ compilers
(that have #include_next <stdint.h> wrapper for this particular issue).
For now keep guard defines in <sys/cdefs.h> because of those wrappers.
No functional change in buildworld.
zrj [Sat, 2 Nov 2019 17:02:41 +0000 (19:02 +0200)]
<wchar.h>: Implement correct limits for different wchar_t flavors.
Try best to select correct limits while always using handpicked standard
C wchar_t bounds that match internal rune_t and standard wint_t types.
It might be worth to switch to using compiler provided limits for all.
The <stdint.h> header should provide limits for all types in standard
headers, so provide wint_t (<wchar.h>, <wctype.h>) limits too.
The <machine/wchar_limits.h> idea taken from NetBSD.
zrj [Sat, 2 Nov 2019 14:47:58 +0000 (16:47 +0200)]
<ctype.h>: Internalize __ct_rune_t type.
Kernel does not use rune_t types, this change essentially removes rune_t
types from kernel namespace (rune_t types were intended to be used only
internally in libc/locale/ scope).
ANSI requires that ctype types should be of type 'int' so it is
debatable if such custom type is needed at all. Provide declaration in
<runetype.h> as well to allow header be self sufficient.
zrj [Sat, 2 Nov 2019 11:26:14 +0000 (13:26 +0200)]
<wchar.h>: Refactor wchar_t/wint_t/mb_state setup.
Kernel has no wchar support functions (except for VKERNEL64).
* Extract wide-character types setup to common <machine/wchar.h>.
* Avoid using __wchar_t for clang -fms-extensions issue.
* Add more handling for c++ and -fshort-wchar (not supported in libc).
This essentially removes these types from kernel namespace and paves
the way for further both userland/kernelland visibility cleanup by
making <sys/stdint.h> clean.
The WCHAR_MAX/WCHAR_MIN limits will be addressed in separate commit.
zrj [Sat, 2 Nov 2019 10:39:06 +0000 (12:39 +0200)]
pthread: Fix simple hello world c++ statically linked use cases.
Can happen if locale setup is called before pthread_create() and c++
program is linked with -static -pthread. Check initialization status
in mutex and once related calls.
zrj [Sat, 2 Nov 2019 09:35:26 +0000 (11:35 +0200)]
vkernel64: Reduce <pthread.h> exposure to generic kernel sources.
Implement vkernel_yield() wrapper and use it where needed.
zrj [Sat, 2 Nov 2019 06:41:56 +0000 (08:41 +0200)]
kernel/drm: Yeet drm_free() inline.
Last consumers removed in
6af927c246477a611cb86e64d0fc460000a39284
zrj [Fri, 25 Oct 2019 18:05:10 +0000 (21:05 +0300)]
<sys/malloc.h>: Avoid self referencing macros.
It was reported that previous kmalloc() implementation at header level
is breaking tools like Coccinelle and likely others. Since this header
now has implicit requirement on other headers only for using the
MALLOC_DEFINE() macro (<sys/kernel.h> must be included before), it is
possible to safely use inline functions. Inline function does not have
flexibility limitations like preprocessor macro and expands to much
nicer line in compiler intermediates while allowing to easily make
future adjustments when needed. Also we should be able to no longer
avoid using kmalloc*() calls directly in other kernel headers.
The LINT64 builds with SLAB_DEBUG option enabled are not affected by
this change, but for consistency add alias for _kmalloc() too.
Move in the "#if 1" into the _kmalloc() body, this allows compiler to
perform additional optimizations for non __builtin_constant_p() cases.
As a benefit if during compilation the -O0 is used, compiler disables
optimized paths in inline functions.
Compared with -save-temps on GENERIC without debug enabled.
Sascha Wildner [Sat, 2 Nov 2019 19:07:49 +0000 (20:07 +0100)]
libthread_xu: Remove local versions of 3 parameter timespec{add,sub}().
Adjust the parameter order. Comparison of preprocessed code before and
after this commit looks good.
Tomohiro Kusumi [Fri, 1 Nov 2019 16:36:34 +0000 (01:36 +0900)]
sbin/hammer2: Test /dev/mampper for "info"/"mountall" targets
Try dirents under /dev/mapper in addition to /dev/serno.
Also ignore ".", ".." for both serno/dm, and "control" for dm.
Sascha Wildner [Fri, 1 Nov 2019 22:35:29 +0000 (23:35 +0100)]
termios.4: Add a bit more info about TABDLY, TAB0, and TAB3.
Also add a SEE ALSO section.
Taken-from: FreeBSD
zrj [Fri, 25 Oct 2019 10:54:32 +0000 (13:54 +0300)]
<sys/malloc.h>: Reduce kmalloc() implicit requirements on <sys/systm.h>.
Use __builtin_memset() directly. Use of __DEQUALIFY() not needed here.
The "#if 1" case already makes use of __builtin_constant_p() compiler
extension that we do not have feature check in <sys/cdefs.h> (using
"#if __GNUC_PREREQ__(2, 0)" should be good enough).
This finally decouples <sys/malloc.h> from <sys/systm.h> bzero() macro
visibility (also in "#if 1" block).
zrj [Fri, 25 Oct 2019 09:57:33 +0000 (12:57 +0300)]
<sys/malloc.h>: Reduce kmalloc() implicit requirements for NULL.
Make sure it is available for ease of use. This potentially allows to
not to add <sys/param.h> in kernel sources just for NULL when kmalloc()
is used in source code.
zrj [Fri, 25 Oct 2019 09:56:00 +0000 (12:56 +0300)]
kernel/hammer2: Make C_HASHTABLE static.
Only used in lz4.c locally. Include hammer2.h first to include common
headers first.
zrj [Fri, 25 Oct 2019 09:54:48 +0000 (12:54 +0300)]
kernel/dm: Include <sys/param.h> first.
Allow the <dev/disk/dm/dm.h> to include common headers first.