Commit Graph

259935 Commits

Author SHA1 Message Date
kamil 928b338b19 Avoid undefined behavior in pciiide macros
Cast the 'bytes' argument in PIIX_IDETIM_SET() and PIIX_IDETIM_CLEAR()
to unsigned int. This prevents UB because of shifting the bits and changing
the bit of signedness.

sys/dev/pci/piixide.c:714:11, left shift of 65535 by 16 places cannot be represented in type 'int'
sys/dev/pci/piixide.c:720:11, left shift of 32768 by 16 places cannot be represented in type 'int'

Detected with Kernel Undefined Behavior Sanitizer.

Reported by <Harry Pantazis>
2018-07-04 03:00:46 +00:00
kamil 235e36ecf7 Avoid undefined behavior in pr_item_notouch_put()
Do not left shift a signed integer changing its signedness bit.

sys/kern/subr_pool.c:251:30, left shift of 1 by 31 places cannot be represented in type 'int'

Detected with Kernel Undefined Behavior Sanitizer.

Reported by <Harry Pantazis>
2018-07-04 02:19:02 +00:00
kamil 646ced3028 Avoid Undefined Behavior in ffs_clusteracct()
Change the type of 'bit' variable from int to unsigned int and use unsigned
values consistently.

sys/ufs/ffs/ffs_subr.c:336:10, shift exponent -1 is negative

Detected with Kernel Undefined Behavior Sanitizer.

Reported by <Harry Pantazis>
2018-07-04 02:02:15 +00:00
kamil 501bcee4da Avoid Undefined Behavior in pr_item_notouch_get()
Change the type of left shifted integer from signed to unsigned.

sys/kern/subr_pool.c:274:13, left shift of 1 by 31 places cannot be represented in type 'int'

Detected with Kernel Undefined Behavior Sanitizer.

Reported by <Harry Pantazis>
2018-07-04 01:42:37 +00:00
kamil 7d17e9990f Avoid undefined operation in signed integer shift in MAP_ALIGNED()
Cast the shifted byte to unsigned int.

sys/uvm/uvm_mmap.c:914:19, left shift of 255 by 24 places cannot be represented in type 'int'

Detected with Kernel Undefined Behavior Sanitizer.

Reported by <Harry Pantazis>
2018-07-04 01:17:32 +00:00
kamil fb614f3716 Paper over Undefined Behavior in in6_control1()
Replace calculation of maxexpire (TIME_MAX) with a construct that triggers
UB with a one that uses implementation defined semantics.

No functional change intended.

An attempt to appease KUBSAn.

Detected with Kernel Undefined Behavior Sanitizer.

Reported by <Harry Pantazis>
2018-07-04 00:35:33 +00:00
kamil bf95c9b8f0 Avoid unportable signed integer left shift in fd_unused()
Detected with Kernel Undefined Behavior Sanitizer.

There were at least a single place reported, for consistency fix all the
left bit shift operations.
sys/kern/kern_descrip.c:345:2, left shift of 1 by 31 places cannot be represented in type 'int'
sys/kern/kern_descrip.c:346:28, left shift of 1 by 31 places cannot be represented in type 'int'

Reported by <Harry Pantazis>
2018-07-03 23:14:57 +00:00
kamil 11d85a2701 Avoid unportable signed integer left shift in fd_copy()
Detected with Kernel Undefined Behavior Sanitizer.

There were at least a single place reported, for consistency fix all the
left bit shift operations.
sys/kern/kern_descrip.c:1492:3, left shift of 1 by 31 places cannot be represented in type 'int'
sys/kern/kern_descrip.c:1493:28, left shift of 1 by 31 places cannot be represented in type 'int'

Reported by <Harry Pantazis>
2018-07-03 23:11:06 +00:00
kamil 4c40a51b4d Avoid unportable signed integer left shift in fd_isused()
Detected with Kernel Undefined Behavior Sanitizer.

sys/kern/kern_descrip.c:188:34, left shift of 1 by 31 places cannot be represented in type 'int'

Reported by <Harry Pantazis>
2018-07-03 22:49:51 +00:00
kamil df4b2775d0 Try to appease KUBSan in sys/sys/wait.h in W_EXITCODE()
Cast return value that is stored as int to unsigned int in order to
appease the << 8 operation. In case of a ret=-1, this cast is papering
things over or replacing UB with an implementation specific behavior.

There is a reverse operation with the same papering things over:
WEXITSTATUS(x)	((int)(((unsigned int)_W_INT(x)) >> 8) & 0xff)

No functional change intended.

Detected with Kernel Undefined Behavior Sanitizer.

Reported by <Harry Pantazis>
2018-07-03 22:38:33 +00:00
christos 4b2f952390 Use the fonts from our installed directory not the system when we are a tool!
Martin found it.
XXX pullup-8
2018-07-03 21:12:10 +00:00
jdolecek 60eaa14343 fix detach code and do it on shutdown 2018-07-03 19:56:01 +00:00
jdolecek d11231318a add DIAGNOSTIC check for rnd_attach_source() being called twice for same
rnd source; it's driver error, and it breaks rnd source list pointers
2018-07-03 18:09:28 +00:00
jdolecek 5d59288945 attach the rnd source only once even with dual-port adapters 2018-07-03 18:07:36 +00:00
jmcneill a51f151e64 Dump clock tree with aprint_debug instead of printf 2018-07-03 16:30:13 +00:00
jmcneill 5d85bfa17a Fix value of PHY_CLK_RST_FSEL_24M, USB2 on XHCI works now. 2018-07-03 16:22:48 +00:00
jmcneill f77d05edb4 Enable Exynos USB support 2018-07-03 16:09:40 +00:00
jmcneill 1095f2f48a Add support for Samsung Exynos USB. 2018-07-03 16:09:04 +00:00
jmcneill aee69b8ae2 Add more USB3 clocks 2018-07-03 16:06:41 +00:00
jmcneill 7bc212888c Add support for Samsung Exynos USB3 DRD. 2018-07-03 16:05:31 +00:00
kamil af399e1ecf Avoid unportable signed integer left shift in fd_used()
Detected with Kernel Undefined Behavior Sanitizer.

There were at least a single place reported, for consistency fix all the
left bit shift operations.
sys/kern/kern_descrip.c:302:26, left shift of 1 by 31 places cannot be represented in type 'int'

Reported by <Harry Pantazis>
2018-07-03 12:17:54 +00:00
jmcneill 7392c3ed01 Make IRQ sharing work again 2018-07-03 12:12:03 +00:00
kamil 3b0a1a02cf Avoid unportable signed integer left shift in intr_calculatemasks()
Detected with Kernel Undefined Behavior Sanitizer.

There were at least two places reported, for consistency fix all the
left shift bit shift.

src/sys/arch/x86/x86/intr.c:339:22, left shift of 1 by 31 places cannot be represented in type 'int'
src/sys/arch/x86/x86/intr.c:347:15, left shift of 1 by 31 places cannot be represented in type 'int'

Reported by <Harry Pantazis>
2018-07-03 11:45:54 +00:00
jmcneill 2ac6a15b7c Add USB clocks and missing MMC biu clocks 2018-07-03 09:39:32 +00:00
jmcneill e3e4ea3b84 Fix name of snps,dis_u2_susphy_quirk property 2018-07-03 08:52:36 +00:00
msaitoh 21a84f0bc1 - Print Power Management Control/status register in 32bit.
- Simplify.
2018-07-03 04:56:59 +00:00
msaitoh 26de24b6ea Remove nmbclusters check. We don't use the mbuf cluster. The old code also had
a bug that ixgbe_total_ports adds two every port and never decrement in
the detach path. Found by hikaru@.

 The code was removed in FreeBSD when it switched to use iflib and OpenBSD
removed the code 8 years ago.
2018-07-03 04:02:06 +00:00
jnemeth aa3b5bb2ee Not all things that write to the disk do something that dk(4) will
be interested in.  Let individual commands decide if ioctl(DIOCMWEDGES)
should be done.  I was conservative and set the flag on any command
that might create/modify/delete partitions in any way.
2018-07-03 03:41:23 +00:00
ozaki-r 1350b04367 Fix net.inet6.ip6.ifq node doesn't exist
The node (and child nodes) is initialized in sysctl_net_pktq_setup, but the call
of sysctl_net_pktq_setup is skipped unexpectedly.

sysctl_net_pktq_setup is skipped if in6_present is false that indicates the
netinet6 component isn't loaded on rump kernels.  However the flag is
accidentally always false because the flag is turned on in in6_dom_init that is
called after if_sysctl_setup on both normal and rump kernels.

Fix the issue by moving if_sysctl_setup after in6_dom_init (domaininit on normal
kernels).  This fix is ad-hoc but good enough for netbsd-8.  We should refine
the initialization order of network components in the future.

Pointed out by hikaru@
2018-07-03 03:37:03 +00:00
kre 4bcba09122 Avoid printing error messages twice when an invalid
escape sequence (\ sequence) is present in an arg to a %b
conversion.
2018-07-03 01:56:39 +00:00
kre a78ff1f90a From leot@ on tech-userlevel:
Avoid running off into oblivion when a format string,
or arg to a %b conversion ends in an unescaped backslash.

Patch from Leo slightly modified by me.
2018-07-03 01:54:42 +00:00
jmcneill 6f008dd0f5 Make the pinctrl driver actually work. 2018-07-02 23:54:52 +00:00
jmcneill 206d4f6ece No need to use hold reg when updating clocks, and auto-discover some values. 2018-07-02 23:52:53 +00:00
jmcneill 708ae0b8f8 Set module clock on rate changes 2018-07-02 20:28:24 +00:00
jmcneill f53602fb93 Fix a stupid bug in exynos*_clock_set_rate_div 2018-07-02 20:24:55 +00:00
jmcneill 36bbde029b When searching for interrupt parent, stop as soon as we see an
interrupt-controller property on a node other than the starting node.
2018-07-02 17:50:02 +00:00
jakllsch 207419e084 catch up to upstream dts changes/additions 2018-07-02 17:13:15 +00:00
jmcneill 91a13c78db Attach cpufreq scaling provider to ourself, as cpus doesn't do this anymore 2018-07-02 16:36:49 +00:00
jmcneill c0539982d4 Fix a regression with interrupt-map handling in previous. 2018-07-02 16:06:50 +00:00
roy 40ea673919 Remove dhclient references. 2018-07-02 15:10:43 +00:00
jmcneill bdc2495a4a sc_clock_freq is in Hz, not kHz 2018-07-02 13:45:23 +00:00
jmcneill b95315fc9f Attach mct early. Do not attach gtmr to mct.
XXX gtmr still needed for setstatclock symbol
2018-07-02 12:53:51 +00:00
jmcneill 36b89e3ca6 Add a proper MCT driver rather than relying on ARM Generic Timer (which
may not be functional or even present).
2018-07-02 12:49:37 +00:00
jmcneill 7cc6919eb6 Reduce 10 second timeouts to 2 seconds. 2018-07-02 12:47:19 +00:00
jmcneill 460a3aa4ad Cleanup of combiner driver and make it work (at least for MCT). 2018-07-02 12:18:32 +00:00
jmcneill 1b7f74d662 interrupt-map bug fixes 2018-07-02 12:17:05 +00:00
msaitoh 93fd3a95e5 Regen. 2018-07-02 09:27:18 +00:00
msaitoh 5da2c862dc - Add ASIX Ax88x9x
- Add description for DP83846A.
2018-07-02 09:26:48 +00:00
msaitoh d06b1e5a5d Regen. 2018-07-02 09:02:18 +00:00
msaitoh 4fdff3223c Sort OUI by number. No functional change. 2018-07-02 09:01:59 +00:00