Commit Graph

253297 Commits

Author SHA1 Message Date
martin 27a677be32 Pull up following revision(s) (requested by uwe in ticket #1574):
lib/libcurses/newwin.c: revision 1.58

newwin - fix crash with negative ncols.

When support for negative nrows/ncols was added, one s/ncols/maxx/ was
missed so we ended up passing negative (i.e. huge unsigned) length
when hashing the line contents.

Reported by Naman Jain in PR lib/55484
2020-07-14 13:39:09 +00:00
martin b7a23bb3e0 Tickets #1570 - #1573 2020-07-13 14:37:41 +00:00
martin 724aba8efc Pull up following revision(s) (requested by simonb in ticket #1573):
sys/dev/usb/ualea.c: revision 1.12

Set up the USB xfer for every transfer, not just once in the attach
function.  Caught by DIAGNOSTIC on a similar driver.  Thanks to mrg@
for USB xfer clue and martin@ for testing.
2020-07-13 14:35:29 +00:00
martin 2df52f4449 Pull up following revision(s) (requested by kim in ticket #1572):
sys/dev/pci/vioscsi.c: revision 1.22

Fix off-by-one SCSI target reporting

Use max_target as the controller ID instead of zero, so that the device
located at SCSI ID zero (e.g. a disk) is not obscured through not being
probed by scsi_probe_bus() (which skips the controller ID).

Copy the target requested onto the wire without decrementing it by one.

ok christos@
2020-07-13 14:13:12 +00:00
martin a7027022c4 Pull up following revision(s) (requested by kim in ticket #1571):
sys/dev/scsipi/scsiconf.c: revision 1.288

Continue scanning a SCSI bus when a LUN is reported not present

This fixes disk attachment under Qemu when there is no disk on LUN 0 on
a SCSI bus but there is a disk on LUN 1. The inquiry for LUN 0 returns
SID_QUAL_LU_NOTPRESENT & T_NODEVICE.  Quirks are only checked if neither
one of those are set, so cannot use a quirk entry.

Use case 1: Proxmox 6 configures each disk on its own bus when using
the "Virtio SCSI single" SCSI controller. However, while the "scsi0"
disk is on LUN 0, the "scsi1" disk is on LUN 1.

Use case 2: A Linode boot profile with multiple disks results in
the first disk ("sda") on LUN 1, while the second disk ("sdb") is
on LUN 0, each on their own bus.
2020-07-13 14:10:25 +00:00
martin 698a5430e5 Apply patch, requested by roy in ticket #1570:
external/bsd/dhcpcd/dist/hooks/01-test		(apply patch)

Fix dhcpcd test not to require /usr by syncing with the 01-test hook with
-current (which uses a newer dhcpcd version).
2020-07-13 13:58:31 +00:00
martin e4928a812c Apply patch, requested by christos in ticket #1566:
Deduplicate more code and avoid use of uninitialized variables.
2020-07-08 13:48:36 +00:00
martin 24fcf95fed Tickets #1565, #1566, #1567, and #1569 2020-07-07 19:58:25 +00:00
martin 3490808764 Pull up following revision(s) (requested by rin in ticket #1569):
external/bsd/nvi/dist/vi/v_txt.c: revision 1.7

PR bin/55468

Fix crash due to out-of-bounds access with Ctrl-W.
PR is only for nottywerase, but also fix ttywerase case, taken from

OpenBSD via nvi2:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/vi/vi/v_txt.c#rev1.23
5d5365d358

Also, comment there is no worry for altwerase specific code, which
seems suspicious at a glance.

Reported by Azuma OKAMOTO.

Thanks for detailed explanation how to reproduce the problem!
2020-07-07 19:55:23 +00:00
martin 925f742660 Pull up following revision(s) (requested by uwe in ticket #1567):
lib/libcurses/insch.c: revision 1.26
	lib/libcurses/ins_wch.c: revision 1.15
	lib/libcurses/ins_wstr.c: revision 1.15
	lib/libcurses/insstr.c: revision 1.8

mvwins*(WINDOW *win, ...) functions - call wins* on win, not stdscr.
From Naman Jain in PR lib/55460.
2020-07-07 12:48:42 +00:00
martin 52745083a2 Pull up following revision(s) (requested by christos in ticket #1566):
sys/netinet/tcp_input.c: revision 1.418 (via patch)

- always set both ip and ip6, otherwise a kernel assertion can be triggered
- move alignment early so that we do less work
2020-07-07 11:56:57 +00:00
martin ec566f9995 Pull up following revision(s) (requested by kim in ticket #1565):
usr.bin/w/w.c: revision 1.87

Don't overwrite host_buf as x might be pointing to wanted data in it
2020-07-07 10:44:11 +00:00
martin e20979efe6 Ticket #1564 2020-06-30 18:50:55 +00:00
martin 2f923b7dd4 Pull up following revision(s) (requested by kim in ticket #1564):
usr.bin/w/w.c: revision 1.86
	usr.bin/w/w.c: revision 1.85

Compute a value for domain before comparing against it
Remove local domain always, not just when looking up addresses
2020-06-30 18:50:05 +00:00
martin 1b0ac36eba Tickets #1562 and #1563 2020-06-30 17:42:57 +00:00
martin ab96e754ca Pull up following revision(s) (requested by sborrill in ticket #1563):
sys/dev/acpi/acpi_display.c: revision 1.18

Only need to set brightness if reading the initial state fails
to sync firmware and the driver. Avoids black screen at boot time.

Thanks to jmcneill@
2020-06-30 17:41:01 +00:00
martin 7017710915 Pull up following revision(s) (requested by kim in ticket #1562):
etc/mtree/special: revision 1.170

Fix /private/tmp mode to match etc/rc.d/perusertmp
2020-06-30 15:15:12 +00:00
martin bd04f1886c Tickets #1560 and #1561 2020-06-20 16:14:15 +00:00
martin e659fd44ce Pull up following revision(s) (requested by sborrill in ticket #1561):
usr.sbin/hdaudioctl/hdaudioctl.8: revision 1.7
	usr.sbin/hdaudioctl/graph.c: revision 1.5
	usr.sbin/hdaudioctl/hdaudioctl.c: revision 1.3
	usr.sbin/hdaudioctl/hdaudioctl.c: revision 1.4
	usr.sbin/hdaudioctl/hdaudioctl.h: revision 1.3

Add show subcommand that displays the codec configuration in
human-readable tabulated form

Nix trailing whitespace.
2020-06-20 16:11:58 +00:00
martin 97d6620721 Pull up following revision(s) (requested by riastradh in ticket #1560):
sys/arch/x86/x86/cpu_rng.c: revision 1.16

Use x86_read_psl/x86_disable_intr/x86_read_psl to defer interrupts.

Using x86_disable_intr/x86_enable_intr causes a bit of a snag when we
try it early at boot before we're ready to handle interrupts, because
it has the effect of enabling interrupts!

Fixes instant reset at boot on VIA CPUs.  The instant reset on boot
is new since the entropy rework, which initialized the x86 CPU RNG
earlier than before, but in principle this could also cause other
problems while not early at boot too.

XXX pullup
2020-06-20 16:05:06 +00:00
bouyer 43026bd899 tickets 1557-1559 2020-06-16 10:29:16 +00:00
bouyer b56964734a Pull up following revision(s) (requested by martin in ticket #1559):
sys/dev/usb/if_run.c: revision 1.41
Better bounds checking for oversized packets, to avoid kernel memory
corruption. Pointed out by Ilja Van Sprundel.
2020-06-16 10:28:29 +00:00
bouyer c0d7fb8ff2 Pull up following revision(s) (requested by martin in ticket #1558):
sys/dev/usb/if_otus.c: revision 1.45 via patch
Stricter bounds check for some packet length we get from the usb chip,
to make sure we do not corrupt kernel memory.
Pointed out by Ilja Van Sprundel.
2020-06-16 10:27:03 +00:00
bouyer 70725f7775 Pull up following revision(s) (requested by tsutsui in ticket #1557):
sys/arch/mac68k/dev/ams.c: revision 1.23
Fix inverted Y-axis value passed to wsmouse_input(9).
Note this is what src/sys/arch/macppc/dev/ams.c does as
"upward (moving the mouse forward) is positive" as noted in wsmouse(9):
 http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/macppc/dev/ams.c#rev1.4
Reported and tested by @NonameInsect on his SE/30 and Xorg server.
Should be pulled up to netbsd-8 and netbsd-9.
2020-06-16 10:23:04 +00:00
martin 14b51e78f7 Tickets #1554 - #1556 2020-06-07 17:09:33 +00:00
martin 877ef6666b Pull up following revision(s) (requested by thorpej in ticket #949):
sys/kern/subr_pcu.c: revision 1.22

Relax the KASSERT() in pcu_discard_all() to allow non-curlwp if it is
in LSIDL state, which can happen if the new LWP is exiting before it's
ever run, e.g. if an error occurs in _lwp_create(2).
2020-06-07 17:08:12 +00:00
martin 424ced70f3 Pull up following revision(s) (requested by riastradh in ticket #1555):
sys/dev/sysmon/sysmon_envsys.c: revision 1.145

Don't queue sysmon refresh until the rndsource is attached.

Using the rndsource, as refreshing the sensors will do, is not
allowed until _after_ rnd_source_attach.

XXX pullup-7
XXX pullup-8
XXX pullup-9
2020-06-07 16:41:24 +00:00
martin 7acebb2b85 Pull up following revision(s) (requested by rin in ticket #1554):
sys/arch/powerpc/oea/pmap.c: revision 1.96

Stop returning while PMAP_LOCK() (= KERNEL_LOCK(1, NULL)) is held.
Kernel freeze with heavy load is significantly mitigated (fixed?),
in which I could not even enter DDB from console.

XXX
There is still inconsistency in usage of two PVO pools.
I will send-pr later.

XXX
pullup to netbsd-[987]
2020-06-07 12:23:43 +00:00
martin 733518a9ee Tickets #1551 - #1553 2020-05-31 10:48:27 +00:00
martin ff2a11a9ed Pull up following revision(s) (requested by nat in ticket #1553):
usr.sbin/bta2dpd/bta2dpd/bta2dpd.c: revision 1.7

Avoid running of the end of the array if a file cannot be opened.
Found by plunky@.
2020-05-31 10:47:02 +00:00
martin 2b45b77ad0 Pull up following revision(s) (requested by roy in ticket #1552):
lib/libterminfo/curterm.c: revision 1.14

terminfo: test strlcpy result against space free, not string length

riastradh@ yep, looks good.
2020-05-31 10:43:05 +00:00
martin 00adaef521 Pull up following revision(s) (requested by skrll in ticket #1551):
sys/dev/usb/usb.c: revision 1.187

Don't allow open of /dev/usb if there are no attached busses.
PR kern/55303 mutex_vector_enter,512: uninitialized lock
2020-05-31 10:27:26 +00:00
martin 10155452fa Ticket #1549 2020-05-25 17:49:03 +00:00
martin 8512941dbf Pull up following revision(s) (requested by christos in ticket #1549):
sys/netinet/igmp.c: revision 1.70
	sys/kern/kern_time.c: revision 1.204

igmp_sendpkt() expects ip_output() to set 'imo.imo_multicast_ttl' into
'ip->ip_ttl'; but ip_output() won't if the target is not a multicast
address, meaning that the uninitialized 'ip->ip_ttl' byte gets sent to
the network. This leaks one byte of kernel heap.

Fix this by filling 'ip->ip_ttl' with a TTL of one.
Found by KMSAN.

 -

Fix uninitialized memory access. Found by KMSAN.
2020-05-25 17:48:16 +00:00
martin a997d6a741 Ticket #1547 2020-05-13 12:40:09 +00:00
martin 20f888fe72 Pull up following revision(s) (requested by yamaguchi in ticket #1547):
sys/arch/x86/pci/if_vmx.c: revision 1.60

Fix the wrong logic about making the number of vmx(4) TX/RX queue
be power of two

reviewed by nonaka@n.o.
2020-05-13 12:39:20 +00:00
martin d9d42bfe98 Ticket #1546 2020-05-07 17:03:51 +00:00
martin a5c1faa5ce Pull up following revision(s) (requested by aymeric in ticket #1546):
bin/rcp/rcp.c: revision 1.50

In sink(), upon error, avoid multiple replies to the source as this
would lead to a desynchronization of the protocol and further files or
directories to be ignored or corrupted.

Reported by Daniel Goujot, Georges-Axel Jaloyan, Ryan Lahfa, and David Naccache.
2020-05-07 17:02:33 +00:00
martin f6348df955 Ticket #1545 2020-05-05 18:52:57 +00:00
martin 03cf5d70a5 Apply patch, requested by he in ticket #1545:
Fix bug revealing itself in sha384 checksum computation: one
important statement was overlooked when converting the code to
avoid alignment issues.
2020-05-05 18:51:08 +00:00
martin afbf621a17 Tickets #1543 and #1544 2020-04-30 16:22:10 +00:00
martin 645323f5da Pull up following revision(s) (requested by nia in ticket #1544):
games/fortune/strfile/strfile.c: revision 1.39
	games/fortune/unstr/unstr.c: revision 1.15

strfile: Check that input/output filenames don't exceed the buffer size
unstr: Check that the input filename fits in the buffer.
2020-04-30 16:21:14 +00:00
martin a03813fd0c Pull up following revision(s) (requested by riastradh in ticket #1543):
sys/kern/subr_cprng.c: revision 1.34

Disable rngtest on output of cprng_strong.

We already do a self-test for correctenss of Hash_DRBG output;
applying rngtest to it does nothing but give everyone warning fatigue
about spurious rngtest failures.
2020-04-30 15:35:57 +00:00
martin e918baff6e Ticket #1542 2020-04-25 10:55:11 +00:00
martin ec4cc527ee Pull up following revision(s) (requested by skrll in ticket #1542):
sys/arch/hppa/hppa/trap.c: revision 1.115

Fix KASSERT that has been incorrect since revision 1.85 from 10 years
ago.
2020-04-25 10:54:23 +00:00
martin d23dd721a3 Tickets #1540 and #1541 2020-04-24 16:18:06 +00:00
martin e907286a56 Pull up following revision(s) (requested by maya in ticket #1541):
sys/dev/dkwedge/dk.c: revision 1.98

Update sc->sc_parent->dk_rawvp while the lock named dk_rawlock held
to prevent a race condition

Fixes PR kern/55026

OKed by mlelstv@, thanks
2020-04-24 16:15:24 +00:00
martin 85607887b5 Pull up following revision(s) (requested by tsutsui in ticket #1540):
sys/arch/hp300/hp300/machdep.c: revision 1.233

Fix garbages in dmesg caused by uninitialized variables slipped in r1.228.

Noticed in HP9000/362 dmesg:
 https://dmesgd.nycbug.org/index.cgi?do=view&id=5459

Should be pulled up to netbsd-8 and netbsd-9.
2020-04-24 16:07:04 +00:00
martin f7131479aa Tickets #1537 - #1539 2020-04-23 14:13:05 +00:00
martin 7f79cb3853 Apply patch, requested by he in ticket #1539:
external/bsd/bind/include/config.h (apply patch)

Fix BIND configuration for big-endian hosts.
This should make DNSSEC work on such hosts as well.
2020-04-23 14:10:50 +00:00