Commit Graph

253843 Commits

Author SHA1 Message Date
martin b5e98a79d9 Pull up following revision(s) (requested by riastradh in ticket #1923):
lib/libc/gen/vis.c: revision 1.75-1.86
	tests/lib/libc/gen/t_vis.c: revision 1.10-1.14

PR 56260: fix out-of-bounds stack read.

vis(3): Avoid nonportable MIN in portable code.

vis(3) tests: Add xfail test for encoding overflow.

From Kyle Evans <kevans%FreeBSD.org@localhost>.
PR lib/57573

vis(3) tests: Expand tests and diagnostic outputs on failure.
PR lib/57573

vis(3) tests: Test another overflow edge case.
Related to PR lib/57573.

vis(3): Make maxolen unsigned size_t, not ssize_t.
It is initialized once either to *dlen, which is unsigned size_t, or
to wcslen(start) * MB_MAX_LEN + 1, and wcslen returns unsigned size_t
too.  So there appears to have never been any reason for this to be
signed.
Part of PR lib/57573.

vis(3): Make mbslength unsigned.
Sprinkle assertions and comments justifying the proposition that it
would never go negative if signed.
Obviates need to worry about mblength > SSIZE_MAX.
Prompted by PR lib/57573.

vis(3): Avoid arithmetic overflow before calloc(3).
Prompted by PR lib/57573.

vis(3): Call wcslen(start) only once.
It had better not change between these two times!
Prompted by PR lib/57573.

vis(3): Avoid potential arithmetic overflow in maxolen.
Can't easily prove that this overflow is impossible, so let's add a
check.
Prompted by PR lib/57573.

vis(3): Fix main part of PR lib/57573.
From Kyle Evans <kevans%FreeBSD.org@localhost>.

vis(3): Fix one more buffer overrun in an edge case.
PR lib/57573

vis(3): Sort includes.  No functional change intended.
Prompted by PR lib/57573.

vis(3): Need <stdint.h> for SIZE_MAX, per C standard.
From Kyle Evans <kevans%FreeBSD.org@localhost>.
Followup to PR lib/57573.

vis(3): Per KNF, sys/param.h comes before sys/types.h.
Which is nice because that's also lexicographic.
2023-12-09 13:10:16 +00:00
martin ab514538ad Additionally pull up following revision(s) (requested by riastradh in ticket #1920):
tests/lib/libc/sys/Makefile: revision 1.75 (via patch)

t_setrlimit uses alloca now
2023-12-09 12:46:06 +00:00
martin f9e0d6c859 Ticket #1922 2023-11-29 18:54:37 +00:00
martin 8ff2b075f6 Pull up following revision(s) (requested by taca in ticket #1922):
etc/namedb/root.cache: revision 1.24
	etc/namedb/root.cache: revision 1.25
	etc/namedb/root.cache: revision 1.26

sync with most recent (no changes)

Update to 2019093001

Update to 2023112702 (November 27, 2023).
2023-11-29 18:53:44 +00:00
martin 315166b35b Ammend ticket #1920 for additional pullups 2023-11-29 12:29:45 +00:00
martin b3697d9f54 Additionally pull up the following for ticket #1920:
sys/kern/exec_subr.c		1.87

Fix build for kernels w/o PAX_MPROTECT.
2023-11-29 12:29:05 +00:00
martin e3c7682c86 Tickets #1920 and #1921 2023-11-28 13:14:41 +00:00
martin e67f168bbc Pull up following revision(s) (requested by riastradh in ticket #1921):
sys/ufs/ffs/ffs_vfsops.c: revision 1.382

ffs_sync: Avoid unlocked access to v_numoutput/v_dirtyblkhd.

Found by lockdoc.

PR kern/57606
2023-11-28 13:13:29 +00:00
martin a2469ca7a0 Pull up following revision(s) (requested by riastradh in ticket #1920):
tests/lib/libc/sys/t_setrlimit.c: revision 1.8
	tests/lib/libc/sys/t_setrlimit.c: revision 1.9
	sys/kern/exec_subr.c: revision 1.86

t_setrlimit: Verify changing RLIMIT_STACK affects access to stack.
PR kern/57711

exec: Map noaccess part of stack with prot=NONE, maxprot=READ|WRITE.
This way, setrlimit(RLIMT_STACK) can grant READ|WRITE access when
increasing the stack size.
PR kern/57711
2023-11-28 13:00:52 +00:00
martin 981abbb066 Ticket #1919 2023-11-27 19:58:18 +00:00
martin b2f8c0cea7 Pull up following revision(s) (requested by tsutsui in ticket #1919):
external/gpl3/binutils/dist/gas/config/tc-mips.c: revision 1.25

binutils: fix gas that doesn't handle MIPS1 FPR load hazard correctly.
Fixes PR/57680.
2023-11-27 19:57:29 +00:00
martin 4c01858a96 Tickets #1917 and #1918 2023-10-29 16:49:07 +00:00
martin 992ee197fc Ticket #1916 2023-10-26 15:14:28 +00:00
martin d16ec04f8a Pull up following revision(s) (requested by buhrow in ticket #1916):
sys/dev/pci/mpii.c: revision 1.30

Fixes for PR kern/57133:

I can now explain why this assert is firing and have a fix for it.  It is a  regression introduced in R1.22 of mpii.c.

        If a request comes in and the IOC returns a MPII_SCSIIO_STATUS_CHECK_COND condition, after
 a successful transfer, or one that is a recovered error,
 mpii(4) correctly sets the xs->error to XS_SENSE, but incorrectly sets xs->resid to 0 before
 returning the xfer to the upper scsi layers.  Once the upper layers get it, they notice the
 XS_SENSE check condition and because it's a retryable error, they increment xs_requeuecnt, set
 ERESTART and send the xfer request down to the mpii(4) layer again for a retry. What they do
 not do is reset xs->resid equal to xs->datalen.  When the xfer comes down to mpii(4) again, the
 assert happens.  The fix is for the mpii(4) driver to leave xs->resid alone when it encounters
 a MPII_SCSIIO_STATUS_CHECK_COND condition.

This bug affects NetBSD-10, netbsd-9 and netbsd-8.
2023-10-26 15:13:38 +00:00
martin 18d3054374 Tickets #1914 and #1915 2023-10-18 14:46:35 +00:00
martin d82b29ffa0 regen (for ticket #1915) 2023-10-18 14:42:54 +00:00
martin de3774b99a Pull up the following, requested by msaitoh in ticket #1915:
sys/dev/pci/pcidevs			1.1497
	sys/dev/pci/if_wm.c			1.689,1.790-1.791 via patch
	sys/dev/pci/if_wmreg.h			1.120 via patch
	sys/dev/pci/if_wmvar.h			1.51

- Use 12K for packet buffer for jumbo frame on PCH2 and newer.
- Add new workaround for Tiger Lake and newer to avoid packet loss.
- Add I219{V,LM}({22,23}) devices (Raptor Lake).
2023-10-18 14:41:54 +00:00
martin b133c273d8 Pull up the following, requested by msaitoh in ticket #1914:
sys/dev/pci/ixgbe/ix_txrx.c			1.103-1.104
	sys/dev/pci/ixgbe/ixgbe.c			1.334-1.338,
							1.341-1.344 via patch
	sys/dev/pci/ixgbe/ixgbe.h			1.90-1.93
	sys/dev/pci/ixgbe/ixgbe_82599.c			1.31-1.32
	sys/dev/pci/ixgbe/ixgbe_api.c			1.29
	sys/dev/pci/ixgbe/ixgbe_bypass.h		1.5
	sys/dev/pci/ixgbe/ixgbe_common.c		1.46-1.47
	sys/dev/pci/ixgbe/ixgbe_common.h		1.18
	sys/dev/pci/ixgbe/ixgbe_dcb.c			1.14-1.15
	sys/dev/pci/ixgbe/ixgbe_dcb_82598.c		1.13
	sys/dev/pci/ixgbe/ixgbe_type.h			1.59-1.61
	sys/dev/pci/ixgbe/ixgbe_x540.c			1.24
	sys/dev/pci/ixgbe/ixgbe_x550.c			1.28
	sys/dev/pci/ixgbe/ixv.c				1.187-1.192 via patch

- ixg(4): Add 82599 LS support once again.
- ixg(4): Filter out spurious link up indication more.
- ixg(4): Print DEVICE_CAPS register.
- ixg(4): Fix a bug that the number of queues is unintentionally
  limited to a small number or wrong error message may be printed
  when two devices' number of MSI-X vectors are different.
- Modify error message of wrong TX/RX descriptor size.
- Enable interrupt after setting IFF_RUNNING.
- Fix a bug that changing hw.ix[gv]X.qY.interrupt_rate would change
  all devices all queues default interrupt rate.
- Cleanup the code.
2023-10-18 14:23:15 +00:00
martin 1ac542ce2a Tickets #1911 - #1913 2023-10-13 18:59:15 +00:00
martin 4db01c1fbd Regen for ticket #1913 (Intel 82599 LS and Pericom(Diodes) PCIe switches added) 2023-10-13 18:46:04 +00:00
martin 8f5f91e697 Pull up following revision(s) (requested by msaitoh in ticket #1913):
sys/dev/pci/pcidevs: revision 1.1493
	sys/dev/pci/pcidevs: revision 1.1495

Add Intel 82599 LS.
Add Pericom(Diodes) PCIe switches.
2023-10-13 18:44:59 +00:00
martin b41b8fd635 Pull up following revision(s) (requested by msaitoh in ticket #1912):
sys/dev/pci/ixgbe/if_bypass.c		1.10
	sys/dev/pci/ixgbe/if_fdir.c		1.6 via patch
	sys/dev/pci/ixgbe/if_sriov.c		1.18 via patch
	sys/dev/pci/ixgbe/ix_txrx.c		1.102 via patch
	sys/dev/pci/ixgbe/ixgbe.c		1.333,1.339 via patch
	sys/dev/pci/ixgbe/ixgbe.h		1.89
	sys/dev/pci/ixgbe/ixgbe_api.h		1.17
	sys/dev/pci/ixgbe/ixgbe_common.h	1.17
	sys/dev/pci/ixgbe/ixgbe_bypass.h	1.4
	sys/dev/pci/ixgbe/ixgbe_common.c	1.45
	sys/dev/pci/ixgbe/ixgbe_fdir.h		1.5
	sys/dev/pci/ixgbe/ixgbe_netmap.h	1.3
	sys/dev/pci/ixgbe/ixgbe_netmap.c	1.6
	sys/dev/pci/ixgbe/ixgbe_osdep.c		1.9
	sys/dev/pci/ixgbe/ixgbe_sriov.h		1.6
	sys/dev/pci/ixgbe/ixgbe_type.h		1.58
	sys/dev/pci/ixgbe/ixgbe_x550.c		1.27
	sys/dev/pci/ixgbe/ixv.c			1.186 via patch

ixgbe: Rename some definitions, modify comment. No functional change.
 Apply changes from FreeBSD's ix-3.3.31 and ixv-1.5.32.
    - struct adapter *adapter -> struct ixgbe_softc *sc
    - master -> primary
    - black -> block

ixg(4): Whitespace. No functional change.
2023-10-13 18:32:38 +00:00
martin 09d0842c27 Pull up following revision(s) (requested by abs in ticket #1911):
sys/dev/pci/ahcisata_pci.c: revision 1.71

Add support for ASMEDIA 0x0624
... an AHCI SATA adaptor which identifies itself as an IDE storage device
2023-10-13 18:02:02 +00:00
martin 699d56fcca Regen for ticket #1911 (add ASMEDIA 0x0624 - ASM1062 + JMB575 Port Multiplier) 2023-10-13 17:56:23 +00:00
martin 6324e2d6f4 Pull up following revision(s) (requested by abs in ticket #1911):
sys/dev/pci/pcidevs: revision 1.1496

Add entry for ASMEDIA 0x0624 - ASM1062 + JMB575 Port Multiplier
2023-10-13 17:54:46 +00:00
martin 7c93498fdf Tickets #1909 and #1910 2023-10-08 15:33:07 +00:00
martin a6e5ba7ed9 Pull up following revision(s) (requested by msaitoh in ticket #1910):
sys/dev/pci/if_wm.c: revision 1.785
	sys/dev/pci/if_wm.c: revision 1.786
	sys/dev/pci/if_wm.c: revision 1.787
	sys/dev/pci/if_wm.c: revision 1.788
	sys/dev/pci/if_wm.c: revision 1.789

wm(4): Use SCVPC and HRMPC for 82575 and newer.
  The SCVPC(SerDes/SGMII Code Violation Packet Count) register and the HRMPC
  (Header Redirection Missed Packet Count) register were added in if_wm.c
  rev. 1.776 but the location in the code were incorrect. Fix them.

wm(4): Add some info to some event counters.
 - The difference between the RUC(Rx Undersize) and RFC(Rx Fragment) is whether
   the CRC is valid or not.
 - The difference between the ROC(Rx Oversize) and RJC(Rx Jabber) is whether
   the CRC is valid or not.
 - LENERRS(Length Errors) is for the length/type field <= 1500.

wm(4): the IAC(Interrupt Assertion Count) register is for 82571 and newer.

wm(4): Modify descriptions of flow control related event counters.

wm(4): Replace /* nothing */ to __nothing for evcnt macros
Prevent empty if bodies for !WM_EVENT_COUNTERS.
2023-10-08 15:31:17 +00:00
martin 667be18905 Pull up following revision(s) (requested by msaitoh in ticket #1745):
sys/dev/pci/ixgbe/ixgbe.c		1.327-1.332 via patch
	sys/dev/pci/ixgbe/ixgbe.h		1.87-1.88
	sys/dev/pci/ixgbe/ixv.c 		1.184-1.185
	sys/dev/pci/ixgbe/ix_txrx.c		1.101
	sys/dev/pci/ixgbe/ixgbe_82599.c 	1.30
	sys/dev/pci/ixgbe/ixgbe_vf.c		1.32-1.33
	sys/dev/pci/ixgbe/ixgbe_vf.h		1.18
	sys/dev/pci/ixgbe/ixgbe_mbx.h		1.20
	sys/dev/pci/ixgbe/ixgbe_type.h		1.57

- Reorder some event counters for readability.
- Rename some descriptions of event counters.
- Count Queue Bytes {Transmit, Receive} counter.
- Improve error check in ixgbe_check_mac_link_vf().
- Add new IXGBE_VF_GET_LINK_STATE message support.
  The VF's link state can be forced to down by PF.
- Update FCTRL after writing multicast filter.
- Update comments.
2023-10-08 15:19:31 +00:00
martin 9419e274ec Ticket #1908 2023-10-04 15:18:13 +00:00
martin c8dcfbc8e1 Tickets #1900 - #1907 2023-10-03 10:15:31 +00:00
martin a000b7b4e7 Pull up following revision(s) (requested by lukem in ticket #1907):
libexec/ftpd/version.h: revision 1.80

NetBSD-ftpd 20230930

Update version to "NetBSD-ftpd 20230930" for changes:
- fix uninitialized memory usage in count_users()
- fix pam_set_item call with proper struct passed as PAM_SOCKADDR
2023-10-03 10:14:13 +00:00
martin b598b7776a Pull up following revision(s) (requested by lukem in ticket #1906):
libexec/ftpd/ftpd.c: revision 1.208

pam_set_item PAM_SOCKADDR expects sockaddr_storage structure

Instead, internal struct sockinet was used. Because it's length is shorter
than sockaddr_storage, libpam was copying also memory outside of sockinet
struct.
2023-10-03 10:12:11 +00:00
martin ab49a4af0e Pull up following revision(s) (requested by lukem in ticket #1905):
libexec/ftpd/conf.c: revision 1.65

Fix uninitialized memory usage in count_users()

If the file was previously empty, pids table is not set, the code however used
pids[0] which is uninitialized in this case. In some scenarios it may lead to
propagate garbage value from pids[0] to the file and cause writing outside of
allocated memory.

OK lukem@
2023-10-03 10:10:42 +00:00
martin 3f01b3071b Pull up following revision(s) (requested by lukem in ticket #1904):
libexec/ftpd/ftpcmd.y: revision 1.95

Add missing check_login checks for MLST and MLSD
2023-10-03 10:09:19 +00:00
martin 12c4f25362 Pull up following revision(s) (requested by lukem in ticket #1903):
libexec/ftpd/ftpd.c: revision 1.207
	libexec/ftpd/version.h: revision 1.78

ftpd: improve seteuid error handling

Handle seteuid() failures. Per suggestion by Simon Josefsson.

Consistent logging and fatal exit if uid/gid switching fails.

Log correct errno if dataconn() fails.
2023-10-03 10:07:44 +00:00
martin 54810be7b8 Pull up following revision(s) (requested by lukem in ticket #1902):
libexec/ftpd/ftpd.c: revision 1.206

Treat failed chdir/chroot for guest and chroot accounts as fatal.

Also treat failed set{e,}(u,g}id calls as fatal.

Addresses CVE-2020-7468, via FreeBSD.
2023-10-03 10:05:06 +00:00
martin 57f3d7e432 Pull up following revision(s) (requested by lukem in ticket #1901):
libexec/ftpd/extern.h: revision 1.65
	libexec/ftpd/ftpd.c: revision 1.205

bump sizes
2023-10-03 10:03:24 +00:00
martin 88597528ed Pull up following revision(s) (requested by lukem in ticket #1900):
libexec/ftpd/ftpd.8: revision 1.87
	libexec/ftpd/ftpd.c: revision 1.204

Add -f option to ftpd to stay in foreground with -D.

From nia in PR bin/53221.
2023-10-03 09:54:24 +00:00
martin c86651f48b Tickets #1898 and #1899 2023-10-02 17:41:04 +00:00
martin 22e91ac9f8 Pull up following revision(s) (requested by gutteridge in ticket #1899):
share/examples/wpa_supplicant/wpa_supplicant.conf: revision 1.4

wpa_supplicant.conf: fix connection string for Eduroam
"MSCHAPV2" must have an uppercase "V" in the connection string.

Reported by nebbionegiuseppe at gmail.com in PR misc/57634.
2023-10-02 13:36:06 +00:00
martin 8bea580d3b Pull up following revision(s) (requested by riastradh in ticket #1898):
lib/libpam/modules/pam_krb5/pam_krb5.c: revision 1.32

pam_krb5: Fix PR lib/57631.

Loose ends in the fix for NetBSD-SA2023-006 that weren't caught by
review or, somehow, by my own testing.  Evidently we need automatic
tests for this pam business.
2023-10-02 13:09:01 +00:00
martin d75c34abb3 Ticket #1897 2023-09-15 15:45:19 +00:00
martin f12acc4481 Pull up following revision(s) (requested by rin in ticket #1897):
sys/arch/i386/stand/efiboot/Makefile.efiboot: revision 1.22
	sys/arch/i386/stand/efiboot/eficpufunc.c: revision 1.1
	sys/arch/i386/stand/efiboot/eficpufunc.h: revision 1.1
	sys/arch/i386/stand/efiboot/eficons.c: revision 1.13
	sys/arch/i386/stand/efiboot/eficons.c: revision 1.14

efiboot/x86: Add serial console support via raw I/O port access

Unfortunately, some (most?) UEFI implementations do not support
com ports by ``Serial I/O Protocol''.
``PNP0501-0'' and friends are not recognized also.

In this case, if user explicitly requires to switch to serial
console by ``consdev'' command, try to use raw I/O port access.

Ugly, but what FreeBSD does, at least.
Proposed as PR port-amd64/57523

efiboot/x86: eficons.c: Explicitly include params.h for howmany()

NFC for -current and netbsd-10, but necessary for netbsd-[89] to
pull up raw IO serial port support (PR port-amd64/57523).
2023-09-15 15:44:20 +00:00
martin 25b8052065 Ticket #1896 2023-09-08 09:10:54 +00:00
martin bb549d4dda Pull up following revision(s) (requested by riastradh in ticket #1896):
lib/libpam/modules/pam_ksu/pam_ksu.c: revision 1.11

pam_ksu(8): Allow homedir access during kuserok.

Otherwise, the default kuserok logic to look at ~targetuser/.k5login
would be blocked by the security measure to thwart NetBSD-SA2023-005.

(There are other ways, e.g. setting SYSTEM-K5LOGIN in /etc/krb5.conf
so the file is /etc/k5login.d/user instead of ~user/.k5login, but
that's not the default configuration and there are plenty of
deployments that rely on ~user/.k5login today.)

I reviewed libkrb5 for homedir access checks.  There are three:
1. krb5_config_parse_file_multi, called only by:
   - verify_krb5_conf -- not relevant
   - krb5_config_parse_file -- not used here as far as I can tell,
     only by libhdb ldap logic and test code in heimdal
   - krb5_set_config_files -- used here only via krb5_init_context,
     which is done at this point
2. plugin_get_hosts in krbhst.c, used to look up hosts for KDC I/O,
   which shouldn't be happening at this point, so this is almost
   certainly unreachable; also it only appears to control whether
   some old plugin API can be used, long after we have read the krb5
   config controlling which plugins are available, so this is
   probably harmless
3. krb5_kuserok, which is the one we want to allow

Note: This will have to be updated again in the next Heimdal update,
which eliminates the global homedir access flag in favour of making
the default per-context homedir access flag conditional on !issuid.
2023-09-08 09:09:56 +00:00
martin d4eab99e7c Ticket #1895 2023-09-06 08:04:43 +00:00
martin 8f46ba3acd Pull up following revision(s) (requested by mrg in ticket #1895):
crypto/external/bsd/openssl/dist/crypto/sparccpuid.S: revision 1.11

fix SPARC v8/v9 detection code.

this code uses a trick where the encoding on both v8 and v9 are
the same, and are not illegal instructions, but that the v9 one
has a detectable difference than v8.

the idea is that we perform a "subcc" (set condition codes) which
sets "%ccr" on v9, which is an unimplemented "%asr2" on v8, then
we read %ccr (v9) or %asr2 (v8), which will always be 0x99 on v9,
and .. is non-trapping but impleentation defined on v8.

for many implementations this returns the value of the %y reg.

as nothing actually sets %y in this path, it remains the value it
was most recently set to by something (anything), and if it just
happens to be 0x99 then the v9 paths will be taken on v8.

fix this by clearing the %y register before the potential read.

fixes PR port-sparc/57594.  tested on ss20 and in qemu.  this
version of the patch has been submitted upstream.
2023-09-06 08:03:45 +00:00
martin 317ec86252 Ticket #1894 2023-09-04 18:00:03 +00:00
martin a6fbedfa1a Pull up following revision(s) (requested by msaitoh in ticket #1894):
sys/dev/pci/if_wmvar.h: revision 1.50
	sys/dev/pci/if_wm.c: revision 1.783,1.784 via patch

Delay sending LINK_STATE_UP to prevent dropping packets on I35[04] and I21[01].

 Some (not all) systems use I35[04] or I21[01] don't send packet soon
after linkup. The MAC send a packet to the PHY and any error is not
observed. This behavior causes a problem that gratuitous ARP and/or
IPv6 DAD packet are silently dropped. To avoid this problem, don't
call mii_pollstat() here which will send LINK_STATE_UP notification
to the upper layer. Instead, mii_pollstat() will be called in
wm_gmii_mediastatus() or mii_tick() will be called in wm_tick().

Note that the similar workaround is in Linux's igb driver though it's
only for I21[01].

OK'd by hikaru@ and knakahara@.

Fix #ifdef WM_DEBUG code in wm_gmii_i82544_{read,write}reg_locked.
2023-09-04 17:57:49 +00:00
martin c9e6c99ebf Tickets #1890 - #1893 2023-08-23 18:26:40 +00:00