CVS: cvs.openbsd.org: src

2024-05-17 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/05/17 23:21:38

Modified files:
bin/pax: ar_subs.c 

Log message:
When comparing mtimes for the -u and -Z options and the target is
'too old', use pathconfat(_PC_TIMESTAMP_RESOLUTION, AT_SYMLINK_NOFOLLOW)
to get the timestamp resolution to which the _source_ timestamp
should be truncated for a stable comparison.

Problem reported by Walter Alejandro Iglesias (wai(at)roquesor.com)
ok millert@



CVS: cvs.openbsd.org: src

2024-05-17 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/05/17 23:21:02

Modified files:
sys/kern   : init_sysent.c syscalls.c 
sys/sys: syscall.h syscallargs.h 

Log message:
Regen



CVS: cvs.openbsd.org: src

2024-05-17 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/05/17 23:20:22

Modified files:
include: unistd.h 
sys/kern   : syscalls.master vfs_syscalls.c kern_pledge.c 
lib/libc/sys   : Makefile.inc pathconf.2 
lib/libc/hidden: unistd.h 
lib/libc   : Symbols.list shlib_version 
usr.bin/kdump  : kdump.c 

Log message:
Add pathconfat(2): pathconf(2) but with at-fd and flags arguments,
the latter supporting the ability to get timestamp resolution of
symlinks.

ok deraadt@ millert@



CVS: cvs.openbsd.org: src

2024-05-13 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/05/13 19:46:24

Modified files:
sys/arch/amd64/include: cpufunc.h 

Log message:
Delete the declaration of cpu_feature which has been unused since
rev 1.17 (2017-5-27) when tlbflushg() stopped using it



CVS: cvs.openbsd.org: src

2024-05-13 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/05/13 19:42:08

Modified files:
sys/arch/amd64/amd64: autoconf.c cpu.c identcpu.c 

Log message:
Instead of enabling use of PCLMUL and AESNI iff cpu0 supports them
via two global variables, make cpu_ecxfeature the intersection of
cpuid(1).ecx on all CPUs and switch cpu_configure() to directly
check that for the requisite flags.

ok kettenis@



CVS: cvs.openbsd.org: src

2024-05-12 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/05/12 10:49:38

Modified files:
sys/arch/amd64/amd64: locore0.S identcpu.c cpu.c 
sys/arch/amd64/include: cpu.h 

Log message:
Delete the cpu_perf_e[abd]x and cpu_apmi_edx globals and move the
cpuid uses into identifycpu(), as they aren't needed anywhere else.

ok kettenis@



CVS: cvs.openbsd.org: src

2024-05-11 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/05/11 13:21:47

Modified files:
sys/arch/amd64/amd64: identcpu.c 
sys/arch/amd64/include: specialreg.h 

Log message:
Use %b to format cpu flag info in dmesg, so we have the raw values
too.  This is also much more space efficient.
Reduce the cpu flag noise in dmesg by suppressing lines and registers
that are identical with the previous CPU and show -/+ info if there
are any differences.

particular feedback from deraadt@, kettenis@, jsg@, and dv@
ok deraadt@



CVS: cvs.openbsd.org: src

2024-05-08 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/05/08 12:00:55

Modified files:
sys/arch/amd64/amd64: cacheinfo.c 

Log message:
Suppress cache-info dmesg lines when they are identical to the
previous cpu.

testing on hybrid box by jmatthew@
suggestions from kettenis@
ok deraadt@



CVS: cvs.openbsd.org: src

2024-05-03 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/05/03 18:27:42

Modified files:
sys/dev/pci/drm/include/asm: cpufeature.h 

Log message:
amd64 is guaranteed to have PAT and CLFLUSH; stop testing cpu flags
for them on that arch.

ok jsg@



CVS: cvs.openbsd.org: src

2024-04-14 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/04/14 12:11:54

Modified files:
usr.bin/less   : ch.c command.c edit.c filename.c funcs.h less.1 
 less.h less.hlp main.c opttbl.c 

Log message:
Delete support for the LESSOPEN and LESSCLOSE environment variables
aka the "Input Preprocessor": it's been a source for multiple
security bugs in the past as everything has to deal with handling
arbitrary filenames and generally resulted in multiple TOCTOU issues.
The base system never included a default LESSOPEN setting like some
Linux distributions did, but it's a suds-filled sink full of knives
to try to use safely.

ok tb@ deraadt@ millert@



CVS: cvs.openbsd.org: src

2024-04-02 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/04/02 20:01:21

Modified files:
sys/arch/amd64/amd64: cacheinfo.c cpu.c identcpu.c lapic.c 
  machdep.c mtrr.c pctr.c tsc.c ucode.c 
sys/arch/amd64/include: cpu.h 

Log message:
Add ci_cpuid_level and ci_vendor holding the per-CPU basic cpuid
level and a numeric mapping of the cpu vendor, both from CPUID(0).
Convert the general use of strcmp(cpu_vendor) to simple numeric
tests of ci_vendor.  Track the minimum of all ci_cpuid_level in the
cpuid_level global and continue to use that for what we vmm exposes.

AMD testing help matthieu@ krw@
ok miod@ deraadt@ cheloha@



CVS: cvs.openbsd.org: src

2024-03-31 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/03/31 23:11:49

Modified files:
sys/arch/amd64/amd64: vmm_machdep.c vmm_support.S 
sys/arch/amd64/include: vmmvar.h 

Log message:
Delete 108 lines of ASM from vmx_enter_guest() that predated lots
of later enhancements, removing the save/restore of flags, selectors,
and MSRs: flags are caller-saved and don't need restoring while
selectors and MSRs are auto-restored.  The FSBASE, GSBASE, and
KERNELGSBASE MSRs just need the correct values set with vmwrite()
in the "on new CPU?" block of vcpu_run_vmx().

Also, only rdmsr(MSR_MISC_ENABLE) once in vcpu_reset_regs_vmx(),
give symbolic names to the exit-load MSR slots, eliminate
VMX_NUM_MSR_STORE, and #if 0 the vc_vmx_msr_entry_load_{va,pa} code
and definitions as unused.

ok dv@



CVS: cvs.openbsd.org: src

2024-03-25 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/03/25 11:57:07

Modified files:
lib/libc/sys   : link.2 
sys/kern   : vfs_syscalls.c 
sys/nfs: nfs_serv.c nfs_vnops.c 
sys/miscfs/fuse: fuse_vnops.c 
sys/tmpfs  : tmpfs_vnops.c 
sys/ufs/ext2fs : ext2fs_vnops.c 
sys/ufs/ufs: ufs_vnops.c 

Log message:
Move the "no (hard) linking directories" and "no cross-mount links"
checks from all the filesystems that support hardlinks at all into
the VFS layer.  Simplify, EPERM description in link(2).

ok miod@ mpi@



CVS: cvs.openbsd.org: src

2024-03-23 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/03/23 10:30:01

Modified files:
lib/libc/gen   : opendir.3 
lib/libskey: skeylogin.c 

Log message:
readdir_r(3) was never necessary and has been deprecated by POSIX.
Document that in the manpage and stop using it internally.

ok deraadt@ millert@ jmc@



CVS: cvs.openbsd.org: src

2024-03-16 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/03/16 23:49:41

Modified files:
sys/arch/amd64/amd64: cpu.c identcpu.c locore.S vmm_support.S 
sys/arch/amd64/include: specialreg.h 

Log message:
Use VERW to mitigate the RFDS (Register File Data Sampling) vulnerability
present in Intel Atom CPUs, reordering some ASM in return-to-userspace and
start/resume-vmx-guest to reduce the number of kernel values still live in
registers when VERW is used.  This mitigation requires updated firmware which
has affected CPUs report RFDS_CLEAR in dmesg.

Firmware packaging by jsg@ and sthen@
Logic for interpreting intel's flags by jsg@ after lots of discussion
between him, deraadt@, and I
ok deraadt@



CVS: cvs.openbsd.org: src

2024-03-11 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/03/11 20:31:15

Modified files:
sys/arch/amd64/amd64: vmm_machdep.c 

Log message:
Correct handling of cpuid(0xd) subleaves, carefully hiding bits and
sizes that the host does not intend to expose, but do expose xsaveopt
and xgetbv(1).

ok dv@



CVS: cvs.openbsd.org: src

2024-02-29 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/02/29 09:10:52

Modified files:
sys/arch/amd64/amd64: vmm_machdep.c 

Log message:
Intel vmm restores just the base of the GDTR and IDTR ith fixed,
high limits, beyond what we actually expect.  We already restored
the IDTR from scratch, but the restore of the GDTR (limit) was
removed in r1.10.  Put that back in a simpler way, simplify the
IDTR restore and delete the save/restore of the LDTR because that
one really is handled as we want by vmm.

ok dv@ mlarkin@



CVS: cvs.openbsd.org: src

2024-02-25 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/02/25 15:33:09

Modified files:
sys/arch/amd64/amd64: acpi_wakecode.S cpu.c locore.S machdep.c 
  vmm_machdep.c vmm_support.S 
sys/arch/amd64/include: segments.h 

Log message:
We don't do compat32 so MSR_CSTAR shouldn't be set up: delete the
Xsyscall32 stub and UCODE32 selector, set MSR_CSTAR to zero at CPU
startup, and rezero on ACPI resume and VM exit.

requested a while ago by deraadt@
AMD VM testing chris@
testing and ok krw@



CVS: cvs.openbsd.org: src

2024-02-17 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/02/17 22:42:50

Modified files:
sys/arch/amd64/amd64: cpu.c 

Log message:
Don't call cpu_ucode_apply() and cpu_tsx_disable() from cpu_attach()'s
CPU_ROLE_SP case: for cpu0 they are called earlier, from cpu_startup().
(APs call them from cpu_hatch())

ok deraadt@



CVS: cvs.openbsd.org: src

2024-02-11 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/02/11 18:18:18

Modified files:
sys/arch/amd64/amd64: cpu.c genassym.cf locore.S vector.S 
  vmm_machdep.c 
sys/arch/amd64/include: codepatch.h cpu.h 

Log message:
Retpolines are an anti-pattern for IBT, so we need to shift protecting
userspace from cross-process BTI to the kernel.  Have each CPU track
the last pmap run on in userspace and the last vmm VCPU in guest-mode
and use the IBPB msr to flush predictors right before running in
userspace on a different pmap or entering guest-mode on a different
VCPU.  Codepatch-nop the userspace bits and conditionalize the vmm
bits to keep working if IBPB isn't supported.

ok deraadt@ kettenis@



CVS: cvs.openbsd.org: src

2024-02-04 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/02/04 13:18:48

Modified files:
sys/arch/amd64/amd64: codepatch.c 

Log message:
Tweak codepatch_control_flow():
* it should be in .cptext so it gets unmapped when codepatching is done
* when doing a JMP, fill the area after it with INT3s instead of NOPs

ok deraadt@



CVS: cvs.openbsd.org: src

2024-01-30 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/01/30 23:06:28

Modified files:
sys/arch/amd64/amd64: trap.c 
sys/arch/amd64/include: frame.h 
gnu/usr.bin/binutils/gdb: amd64obsd-tdep.c 

Log message:
Swap the r10 and rcx registers in the amd64 trapframe so that the
first six entries are in the same order as syscall arguments, such
that syscall() can just use the trapframe as the argument vector
for mi_syscall() and not need to reorder into another buffer on the
stack.  This doesn't affect coredump layout or ptrace(2), but does
affect kernel crash dumps.

Possibility noted during miod@'s cleanup of the MD syscall()
implementations

ok mlarkin@ kurt@



CVS: cvs.openbsd.org: src

2024-01-30 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/01/30 22:49:33

Modified files:
sys/arch/amd64/amd64: vmm_machdep.c 
sys/arch/amd64/include: cpufunc.h 

Log message:
Make wrpkru() consistent with rdpkru() by passing ecx as an argument.

ok mlarkin@



CVS: cvs.openbsd.org: src

2024-01-14 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/01/14 23:57:07

Modified files:
gnu/usr.bin/binutils-2.17/include/opcode: i386.h 

Log message:
>From "Lorenz (xha)" (me(at)xha.li): teach binutils how to assemble
endbr{64,32}

"sure" dv@ deraadt@



CVS: cvs.openbsd.org: src

2024-01-08 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2024/01/08 20:16:00

Modified files:
sys/ufs/ufs: dir.h ufs_dirhash.c ufs_lookup.c ufs_vnops.c 
sys/ufs/ffs: ffs_inode.c ffs_vfsops.c ffs_vnops.c 
sys/ufs/ext2fs : ext2fs_dir.h 
sbin/dump  : main.c traverse.c 
sbin/fsck_ffs  : dir.c inode.c pass1.c pass2.c 
sbin/fsdb  : fsdb.c 
sbin/newfs : mkfs.c newfs.8 newfs.c 
sbin/restore   : dirs.c 
usr.sbin/makefs: ffs.c 

Log message:
Delete support for FFS filesystems before the in-inode symlink
optimization.  As observed by ali_farzanrad(at)riseup.net, support
for these was broken in the 5.5 release in early 2014 by the time_t
changes.  No one noticed before now, so clearly this isn't something
we need to continue to support; rejecting in ffs_validate() is an
improvement.

Also: simplify DIRSIZ(), drop OLDDIRFMT and NEWDIRFMT, tests of
fs_maxsymlinklen against zero, #ifdef tests of FS_44INODEFMT, and
remove support for newfs -O0, last used in 2016.

ok miod@



CVS: cvs.openbsd.org: src

2023-09-04 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/09/04 23:08:27

Modified files:
sys/uvm: uvm_fault.c 

Log message:
Address the case 2b version of inconsistent view across threads of
a page undergoing copy-on-write faulting.  We fixed the case 1b
version in rev 1.125 (2022-02-01), but missed this other path.

jsg@ noted that in NetBSD Chuck Silvers had a relevant commit, their
rev 1.234 (2023-08-13), which looks like it fixed both cases due
to their refactoring of common code into a uvmfault_promote()
function.

ok mpi@ jca@



CVS: cvs.openbsd.org: src

2023-08-20 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/08/20 19:35:43

Modified files:
sys/arch/powerpc64/include: cpu.h 
sys/arch/powerpc64/powerpc64: locore.S 

Log message:
cpu_idle_{enter,leave}() are no-ops in ASM; replace them
with no-op macros.

ok gkoehler@



CVS: cvs.openbsd.org: src

2023-08-18 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/08/18 22:21:06

Modified files:
bin/pax: tar.c 
usr.bin/make   : timestamp.h 
usr.sbin/makefs: walk.c 

Log message:
Copy entire st_*tim structs at once, rather than copying
the st_*time and (obsolete) st_*timensec members separately.

ok millert@



CVS: cvs.openbsd.org: src

2023-08-15 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/08/15 00:26:34

Modified files:
libexec/ld.so  : dlfcn.c loader.c resolve.h util.h 

Log message:
Improve handling of dlopen(RTLD_TRACE) aka ldd, of a library that
is already loaded:
* add a 'trace' argument to _dl_show_objects() and exit the
walk-the-objects loop if you hit that traced object
* in dlopen(), pass the trace object to _dl_show_objects()
* also, invoke _dl_show_objects() + exit if the object was
already opened
* pass NULL to _dl_show_objects() for all the other calls
* oh hey, _dl_tracelib is now superfluous: _dl_show_objects()
should do the walk-the-objects loop only if trace is not NULL.

Problem noted by gnezdo@
ok millert@



CVS: cvs.openbsd.org: src

2023-08-15 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/08/15 00:23:31

Modified files:
libexec/ld.so  : library.c library_mquery.c 

Log message:
Skip the _dl_msyscall() invocation if tracing library loading.

Problem noted by gnezdo@
ok millert@



CVS: cvs.openbsd.org: src

2023-08-10 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/08/10 23:07:28

Modified files:
usr.sbin/mtree : compare.c create.c mtree.h spec.c 

Log message:
Stop down-converting to a timeval when comparing and setting times.
Replace use of the old BSD st_*timespec members in struct stat with
the POSIX-standard st_*tim members.

ok millert@



CVS: cvs.openbsd.org: src

2023-08-10 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/08/10 23:02:21

Modified files:
usr.bin/rcs: co.c rcsclean.c rcsprog.c rcsutil.c rcsutil.h 

Log message:
Switch rcs_{get,set}_mtime() from returning and taking a time_t to
doing so with a struct timespec and then use tv_nsec = UTIME_OMIT
instead of a (time_t)-1 as a "do nothing" value.  They can then
fully preserve the timestamp

ok millert@



CVS: cvs.openbsd.org: src

2023-08-10 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/08/10 22:51:36

Modified files:
usr.sbin/makefs/msdos: direntry.h msdosfs_conv.c msdosfs_vnops.c 

Log message:
msdosfs_times() doesn't need to copy timespecs onto the stack: just
mark unix2dostime()'s first argument as a pointer to const and skip
the copies.

ok millert@



CVS: cvs.openbsd.org: src

2023-08-10 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/08/10 22:48:14

Modified files:
usr.bin/cvs: file.c 

Log message:
cvs_file_copy() used futimes(), but only set the tv_sec fields,
which presumably meant passing stack garbage in the tv_usec and
failing with EINVAL, whee.  Switch to futimens() and set the full
timespecs from the incoming struct stat

ok millert@



CVS: cvs.openbsd.org: src

2023-08-10 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/08/10 22:45:06

Modified files:
usr.bin/chpass : edit.c 
usr.bin/compress: main.c 
usr.bin/find   : function.c 
usr.bin/mg : fileio.c 
usr.sbin/vipw  : vipw.c 
usr.sbin/syslogd: privsep.c 

Log message:
Replace use of the old BSD st_*timespec members in struct stat with
the POSIX-standard st_*tim members.

ok millert@



CVS: cvs.openbsd.org: src

2023-08-10 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/08/10 22:44:28

Modified files:
usr.bin/rcs: ci.c 

Log message:
When used by itself, replace use of the old BSD st_mtimespec.tv_sec
member in struct stat with for-all-time st_mtime member.

ok millert@



CVS: cvs.openbsd.org: src

2023-08-07 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/08/07 22:45:44

Modified files:
bin/ls : cmp.c 
usr.sbin/makefs: ffs.c 

Log message:
Replace use of the old BSD st_*timensec members in struct stat with
the POSIX-standard st_*tim.tv_nsec members.

ok millert@



CVS: cvs.openbsd.org: src

2023-08-07 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/08/07 00:21:53

Modified files:
usr.sbin/pppd/chat: chat.8 

Log message:
In 2016, chat changed its syslog output for hidden strings.
Sync the manpage to match.

markup advice jmc@



CVS: cvs.openbsd.org: src

2023-08-06 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/08/06 13:36:13

Modified files:
usr.bin/stat   : stat.c 

Log message:
Prefer the POSIX standard st_*tim struct timespec members over the
older BSD st_*timespec names.

ok millert@



CVS: cvs.openbsd.org: src

2023-08-06 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/08/06 13:33:54

Modified files:
usr.bin/stat   : stat.c 

Log message:
Apply rev 1.29 from NetBSD:
-
Don't printf time_t with %d; fixes PR 44128 from yamt. With this change it
successfully prints mtimes after 2038.
-

ok millert@



CVS: cvs.openbsd.org: src

2023-08-04 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/08/04 23:46:36

Modified files:
sys/arch/mips64/include: cpu.h 
sys/arch/mips64/mips64: context.S 

Log message:
cpu_idle_{enter,leave} are no-ops on mips64, so just #define
away the calls

ok jca@



CVS: cvs.openbsd.org: src

2023-08-04 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/08/04 23:45:52

Modified files:
sys/arch/riscv64/include: cpu.h 
sys/arch/riscv64/riscv64: machdep.c 

Log message:
cpu_idle_{enter,leave} are no-ops on riscv64, so just #define
away the calls

ok jca@



CVS: cvs.openbsd.org: src

2023-07-30 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/07/30 22:01:07

Modified files:
sys/arch/amd64/amd64: cpu.c locore.S vector.S 
sys/arch/amd64/conf: Makefile.amd64 
sys/arch/amd64/include: codepatch.h 

Log message:
On CPUs with eIBRS ("enhanced Indirect Branch Restricted Speculation")
or IBT enabled the kernel, the hardware should the attacks which
retpolines were created to prevent.  In those cases, retpolines
should be a net negative for security as they are an indirect branch
gadget.  They're also slower.
* use -mretpoline-external-thunk to give us control of the code
used for indirect branches
* default to using a retpoline as before, but marks it and the
other ASM kernel retpolines for code patching
* if the CPU has eIBRS, then enable it
* if the CPU has eIBRS *or* IBT, then codepatch the three different
retpolines to just indirect jumps

make clean && make config required after this

ok kettenis@



CVS: cvs.openbsd.org: src

2023-07-30 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/07/30 19:33:57

Modified files:
sys/arch/amd64/amd64: codepatch.c 
sys/arch/amd64/include: codepatch.h 

Log message:
The replacement code passed to codepatch_replace() can usefully be
const.

suggested by bluhm@



CVS: cvs.openbsd.org: src

2023-07-28 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/07/28 00:36:16

Modified files:
sys/arch/amd64/amd64: cpu.c 

Log message:
Include a newline in a DPRINTF()



CVS: cvs.openbsd.org: src

2023-07-28 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/07/28 00:18:36

Modified files:
sys/arch/amd64/include: codepatch.h 
sys/arch/amd64/amd64: locore.S copy.S 

Log message:
Add CODEPATCH_CODE() macro to simplify defining a symbol for a chunk
of code to use in codepatching.  Use that for all the existing
codepatching snippets.

Similarly, add CODEPATCH_CODE_LEN() which is CODEPATCH_CODE() but also
provides a short variable holding the length of the codepatch snippet.
Use that for some snippets that will be used for retpoline replacement.

ok kettenis@ deraadt@



CVS: cvs.openbsd.org: src

2023-07-27 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/07/27 10:33:56

Modified files:
sys/arch/amd64/include: specialreg.h 

Log message:
Fix off-by-one: SEFF0ECX_WAITPKG is bit 5, not bit 4.

ok mlarkin@ kettenis@ deraadt@



CVS: cvs.openbsd.org: src

2023-07-26 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/07/26 19:51:35

Modified files:
sys/arch/amd64/include: specialreg.h 
sys/arch/amd64/amd64: identcpu.c 

Log message:
Report speculation control bits in dmesg cpu lines.

ok mlarkin@



CVS: cvs.openbsd.org: src

2023-07-26 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/07/26 18:30:07

Modified files:
sys/arch/amd64/include: frameasm.h 
sys/arch/amd64/amd64: spl.S vector.S 

Log message:
The interrupt resume (Xdoreti) and recurse (Xspllower) paths are
invoked using indirect branches and should have endbr64's.

ok deraadt@



CVS: cvs.openbsd.org: src

2023-07-26 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/07/26 18:28:25

Modified files:
sys/arch/amd64/include: cpu.h 
sys/arch/amd64/amd64: locore.S machdep.c 

Log message:
Follow the lead of mips64 and make cpu_idle_cycle() just call the
indirect pointer itself and provide an initializer for that going
to the default "just enable interrupts and halt" path.

ok kettenis@



CVS: cvs.openbsd.org: src

2023-07-25 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/07/25 00:48:37

Modified files:
sys/arch/amd64/include: cpu.h 
sys/arch/amd64/amd64: locore.S 

Log message:
cpu_idle_{enter,leave} are no-ops on amd64 now, so just #define
away the calls

ok deraadt@ mpi@ miod@



CVS: cvs.openbsd.org: src

2023-07-20 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/07/20 22:04:52

Modified files:
sys/arch/amd64/amd64: cpu.c identcpu.c locore0.S 
sys/arch/amd64/include: specialreg.h 
sys/arch/i386/i386: cpu.c locore0.S 
sys/arch/i386/include: specialreg.h 

Log message:
Rename ARCH_CAPABILITIES_* #defined to ARCH_CAP_*
Provide more ARCH_CAP_* defines per June 2023 SDM

ok jsg@ deraadt@



CVS: cvs.openbsd.org: src

2023-07-09 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/07/09 21:32:10

Modified files:
sys/arch/amd64/amd64: cpu.c locore.S machdep.c vmm_machdep.c 
sys/arch/amd64/include: codepatch.h fpu.h specialreg.h 

Log message:
Enable Indirect Branch Tracking for amd64 userland, using XSAVES/XRSTORS
to save/restore the state and enabling it at exec-time (and for
signal handling) if the PS_NOBTCFI flag isn't set.

Note: this changes the format of the sc_fpstate data in the signal
context to possibly be in compressed format: starting now we just
guarantee that that state is in a format understood by the XRSTOR
instruction of the system that is being executed on.

At this time, passing sigreturn a corrupt sc_fpstate now results
in the process exiting with no attempt to fix it up or send a
T_PROTFLT trap.  That may change.

prodding by deraadt@
issues with my original signal handling design identified by kettenis@

lots of base and ports preparation for this by deraadt@ and the
libressl and ports teams

ok deraadt@ kettenis@



CVS: cvs.openbsd.org: src

2023-07-09 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/07/09 21:31:58

Modified files:
sys/kern   : kern_exec.c 
sys/sys: proc.h 

Log message:
Add PS_NOBTCFI, a per-process flag indicating that Branch Target
Control Flow Integrity has been disabled for the process.  At
exec-time, set that flag iff EXEC_NOBTCFI is passed from the ELF
exec bits (which set it based on presence of a PT_OPENBSD_NOBTCFI
segment).  This will be used by the amd64 code.

kern_exec.c part by kettenis@
ok guenther@ deraadt@



CVS: cvs.openbsd.org: src

2023-07-05 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/07/05 12:45:14

Modified files:
bin/pax: pax.c 
usr.sbin/amd/amd: amd.c xutil.c 

Log message:
It isn't portable to use stderr (or std{in,out}) in file-scope
initializers as they are not required to be compile-time constants.
So, intialize these global variables at the top of main().

ok miod@ deraadt@ yasuoka@ millert@



CVS: cvs.openbsd.org: src

2023-07-03 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/07/03 00:45:44

Modified files:
share/man/man9 : malloc.9 
sys/sys: malloc.h 

Log message:
Bring malloc(9) and  into sync for M_* entries, such
that the former's text comes from the latter's comments.  Rationalize
capitalization, whitespace, and plural-vs-singular.  Mark things for
for automation in the future.

Prompted by loss of sync from the addition of M_IFGROUP and M_PF
Previously worked up in discussion with schwarze@ and jmc@

ok deraadt@, miod@, jmc@



CVS: cvs.openbsd.org: src

2023-06-26 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/06/26 13:03:03

Modified files:
regress/sys/kern/xonly: xonly.c 

Log message:
On amd64, test whether PKU has been enabled and set our expectation
of the results based on that.  Also, the system now enforces
unreadability in copyin() of ld.so, libc, and application text,
even when PKU isn't enabled, so adjust those results to match.

ok deraadt@ anton@



CVS: cvs.openbsd.org: src

2023-05-29 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/05/29 20:02:00

Modified files:
gnu/llvm/lld/ELF/Arch: X86_64.cpp 

Log message:
Add IBT support to the retpoline+znow PLTs

ok kettenis@



CVS: cvs.openbsd.org: src

2023-05-21 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/05/21 18:39:57

Modified files:
sys/arch/amd64/amd64: fpu.c 
sys/arch/amd64/include: fpu.h 

Log message:
The fp_ex_[st]w struct savefpu members were inherited from NetBSD where
they're used in the 32bit-compat support, which we dropped years ago.
Bye bye!

ok deraadt@



CVS: cvs.openbsd.org: src

2023-05-21 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/05/21 18:37:19

Modified files:
sys/lib/libkern/arch/amd64: memmove.S 

Log message:
NENTRY() doesn't provide an endbr64, so give memmove one in
case it ever gets called through a function pointer (with retpoline
disabled)

ok deraadt@



CVS: cvs.openbsd.org: src

2023-05-19 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/05/19 12:43:16

Modified files:
share/man/man9 : uvm_init.9 

Log message:
uvm_coredump(9) was removed in 2015 (commitid dNPv28CJI5BxtRGW) as
real processes have been dumped using uvm_coredump_walkmap(9) since
2009-03-05Z19:52:24.  Document the current API.



CVS: cvs.openbsd.org: src

2023-05-18 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/05/18 19:12:23

Modified files:
lib/libc/sys   : pledge.2 
sys/kern   : kern_pledge.c 

Log message:
Since waitid(2) shares code with wait4(2) and doesn't expose any
non-trivial new information or code-paths over wait4(), include
it in pledge("stdio")

discussed with deraadt@



CVS: cvs.openbsd.org: src

2023-05-18 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/05/18 19:04:39

Modified files:
sys/netinet: tcp.h 

Log message:
Move tcp_info structure to be under '#if __BSD_VISIBLE' to repair
compliance with POSIX/SUS restrictions on 

ok bluhm@
ports testing and ok sthen@



CVS: cvs.openbsd.org: src

2023-05-18 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/05/18 10:33:39

Modified files:
libexec/ld.so/amd64: ldasm.S 

Log message:
If you disable retpolineplt then _dl_bind_start is called with an
indirect branch, so include an endbr64 Just In Case.

ok deraadt@



CVS: cvs.openbsd.org: src

2023-05-18 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/05/18 10:14:05

Modified files:
lib/libc/arch/amd64/string: memmove.S 

Log message:
memmove() entry point is declared with NENTRY() and isn't consecutive
with an ENTRY(), so it needs its own endbr64 for IBT

ok deraadt@



CVS: cvs.openbsd.org: src

2023-05-18 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/05/18 10:11:10

Modified files:
lib/libc/compat-43: getwd.c 
lib/libc/gen   : getcwd.c 
lib/libc/hidden: stdlib.h unistd.h 
lib/libc/hidden/sys: stat.h 
lib/libc/stdlib: realpath.c 
Added files:
lib/libc/hidden/sys: event.h shm.h 

Log message:
Add PROTO_NORMAL() declarations for the remaining syscalls, to avoid
future, inadvertant PLT entries.  Move the __getcwd and __realpath
declarations to hidden/{stdlib,unistd}.h to consolidate and remove
duplication.

ok tb@ otto@ deraadt@



CVS: cvs.openbsd.org: src

2023-05-18 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/05/18 10:07:12

Added files:
lib/libc/hidden/sys: ktrace.h 

Log message:
Add PROTO_NORMAL() declarations for utrace (and ktrace) syscalls
so that the internal call can't be interposed over by the app.

ok tb@ otto@ deraadt@



CVS: cvs.openbsd.org: src

2023-05-17 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/05/17 22:26:06

Modified files:
lib/libc/arch/amd64/sys: Ovfork.S 

Log message:
Make two corrections to the vfork(2) stub:
* with IBT, it can't return via an indirect jump as that would
require the *caller* to have an endbr64
* to support a potential vmspace-sharing implementation, keep the
retguard value in an arg register across the underlying syscall

ok kettenis@ deraadt@



CVS: cvs.openbsd.org: src

2023-05-16 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/05/16 19:57:15

Modified files:
gnu/usr.bin/binutils-2.17/opcodes: i386-dis.c 

Log message:
Add support for disassembling CET (including endbr64), XSS, OSPKE,
clflushopt, clwb, ptwrite, rdpid, serialize, WAITPKG, and vmfunc
extensions, as well as part of TSX.  tpause and umonitor addr size
handling isn't 100% correct, but good enough to get the instruction
boundary.

Correct decoding of rex64 {fxsave,fxrstor,xsave,xrstor,xsaveopt}
to instead use a '64' suffix, ala "fxsave64".

"good enough" ok kettenis@ deraadt@ mlarkin@



CVS: cvs.openbsd.org: src

2023-05-11 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/05/11 16:28:38

Modified files:
regress/sys/arch/amd64/dump_tables: dump_tables.c 

Log message:
Teach dump_tables about PKs and display non-readable pages as such



CVS: cvs.openbsd.org: src

2023-05-11 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/05/11 13:35:50

Modified files:
lib/libc/arch/amd64/sys: syscall.S 

Log message:
Retguard addition in commit 72pYktDvmJhq7OyF was based on the understanding
that the removal of the off_t padding, amd64 syscalls no longer passed a 7th
or later argument.  We overlooked that syscall(2) bumps the arg count by one,
so six argument calls like SYS_sysctl still pass an argument on the stack.

So, repush the 7th argument so it's at the expected stack offset after the
retguard register is pushed.

problem reported and ok bluhm@



CVS: cvs.openbsd.org: src

2023-04-22 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/04/22 12:27:28

Modified files:
sys/arch/amd64/amd64: cpu.c identcpu.c mds.S vmm.c 
sys/arch/amd64/include: specialreg.h 

Log message:
Rename the XCR0_* #defines to XFEATURE_* and add the new supervisor-state
features: while all are appropriate for xsaves/xrstors, the
supervisor-state features aren't for xcr0 but rather for the new XSS_MSR,
making the current names kinda confusing.

Add #defines for masking bits for xcr0 vs XSS.

Add and report the new XSAVE_XFD xsave subfeature bit.

ok mlarkin@



CVS: cvs.openbsd.org: src

2023-04-22 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/04/22 12:26:17

Modified files:
sys/arch/amd64/amd64: db_disasm.c 

Log message:
Teach the disassembler about xrstors, xsavec, and xsaves

ok mlarkin@



CVS: cvs.openbsd.org: src

2023-04-16 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/04/16 00:38:50

Modified files:
sys/arch/amd64/amd64: trap.c 

Log message:
Handle T_CP traps from userland by generating SIGILL, with
code ILL_ILLOPC or ILL_BADSTK depending on the error from hardware

lack of handling noted by deraadt@
ok jsg@



CVS: cvs.openbsd.org: src

2023-04-15 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/04/15 23:40:26

Modified files:
sys/arch/i386/i386: locore.s 

Log message:
Trap 17 (T_ALIGNFLT) supplies an error code in hardware; use TRAP()
instead of ZTRAP().  T_ALIGNFLT fixed in NetBSD on 2003-12-12

ok deraadt@ jsg@



CVS: cvs.openbsd.org: src

2023-04-15 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/04/15 23:39:33

Modified files:
sys/arch/amd64/amd64: vector.S 

Log message:
Both trap 21 (T_CP) and trap 17 (T_ALIGNFLT) supply an error code
in hardware; use TRAP() instead of ZTRAP().  T_ALIGNFLT fixed in
NetBSD on 2012-4-21

ok deraadt@ jsg@



CVS: cvs.openbsd.org: src

2023-03-07 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/03/07 21:43:15

Modified files:
bin/csh: csh.c dir.c dol.c exec.c func.c hist.c proc.c 
 set.c time.c 
bin/echo   : echo.c 
bin/mt : mtrmt.c 
distrib/special/libstubs: mbrtowc_sb.c 
lib/libedit: common.c el.c emacs.c filecomplete.c hist.c 
 history.c prompt.c readline.c refresh.c 
 search.c terminal.c tty.c vi.c 
lib/libkvm : kvm_amd64.c kvm_powerpc.c 
lib/libpcap: pcap-bpf.c 
lib/libskey: skeysubr.c 
lib/libutil: imsg.c 
libexec/comsat : comsat.c 
libexec/ftpd   : ftpcmd.y ftpd.c monitor.c 
libexec/lockspool: lockspool.c 
libexec/login_skey: login_skey.c 
libexec/rpc.rquotad: rquotad.c 
libexec/rpc.rstatd: rstat_proc.c rstatd.c 
libexec/rpc.rusersd: rusersd.c 
libexec/snmpd/snmpd_metrics: kroute.c 
libexec/spamd  : grey.c 
regress/sbin/ifconfig: ifaddr.c 
regress/sys/kern/pledge/ioctl: unfdpass.c 
regress/sys/kern/unfdpass: unfdpass.c 
regress/sys/kern/unfdpass: unfdpass.c 
sbin/dump  : dumprmt.c optr.c tape.c 
sbin/fsck_ext2fs: main.c utilities.c 
sbin/fsck_ffs  : main.c utilities.c 
sbin/ifconfig  : ifconfig.c 
sbin/iked  : control.c 
sbin/isakmpd   : isakmpd.c 
sbin/ldattach  : ldattach.c 
sbin/nfsd  : nfsd.c 
sbin/nologin   : nologin.c 
sbin/restore   : restore.c tape.c 
sys/arch/alpha/alpha: machdep.c trap.c 
sys/arch/alpha/tc: tc_bus_mem.c 
sys/arch/hppa/spmath: dfsqrt.c fcnvff.c fcnvfx.c fcnvfxt.c 
  frnd.c sfsqrt.c 
sys/arch/hppa/stand/libsa: ct.c 
sys/arch/i386/i386: mem.c trap.c 
sys/arch/luna88k/dev: lunaws.c 
sys/arch/macppc/macppc: mainbus.c 
sys/arch/macppc/pci: pchb.c 
sys/arch/mips64/mips64: sendsig.c 
sys/arch/sh/include: pmap.h 
sys/arch/sparc64/sparc64: autoconf.c machdep.c 
sys/ddb: db_break.c db_command.c db_examine.c db_run.c 
 db_variables.c db_watch.c 
sys/dev/i2c: i2c_bitbang.c 
sys/dev/pci: cmpci.c eso.c if_ipw.c if_iwi.c 
sys/dev/pckbc  : pckbd.c 
sys/dev: rnd.c vnd.c 
sys/dev/usb: if_mtw.c if_otus.c if_rsu.c if_run.c if_urtwn.c 
sys/isofs/cd9660: cd9660_rrip.c cd9660_vfsops.c cd9660_vnops.c 
sys/lib/libsa  : dev.c 
sys/miscfs/deadfs: dead_vnops.c 
sys/miscfs/fifofs: fifo_vnops.c 
sys/msdosfs: msdosfs_denode.c 
sys/netinet: if_ether.c ip_carp.c 
sys/nfs: nfs_kq.c nfs_serv.c nfs_vfsops.c nfs_vnops.c 
sys/sys: tree.h 
sys/ufs/ext2fs : ext2fs_readwrite.c ext2fs_vfsops.c 
 ext2fs_vnops.c 
sys/ufs/ufs: ufs_vfsops.c ufs_vnops.c 
sys/uvm: uvm_mmap.c 
usr.bin/at : at.c 
usr.bin/bc : bc.y scan.l tty.c 
usr.bin/cdio   : cdio.c 
usr.bin/chpass : chpass.c field.c 
usr.bin/csplit : csplit.c 
usr.bin/cut: cut.c 
usr.bin/cvs: date.y 
usr.bin/dc : bcode.c inout.c 
usr.bin/deroff : deroff.c 
usr.bin/find   : function.c misc.c 
usr.bin/ftp: cmds.c fetch.c ftp.c small.c util.c 
usr.bin/ipcrm  : ipcrm.c 
usr.bin/ktrace : ktrace.c 
usr.bin/login  : login.c 
usr.bin/mail   : cmd3.c head.c lex.c popen.c send.c tty.c 
usr.bin/make   : job.c 
usr.bin/mg : autoexec.c basic.c bell.c buffer.c cscope.c 
 dir.c dired.c display.c extend.c file.c 
 fileio.c grep.c help.c kbd.c macro.c main.c 
 paragraph.c re_search.c region.c search.c 
 spawn.c tags.c tty.c undo.c util.c version.c 
 window.c word.c yank.c 
usr.bin/netstat: if.c 
usr.bin/newsyslog: newsyslog.c 
usr.bin/nfsstat: nfsstat.c 
usr.bin/pr : pr.c 
usr.bin/rcs: date.y rcsprog.c 
usr.bin/rpcgen : rpc_cout.c 
usr.bin/rpcinfo: rpcinfo.c 
usr.bin/ssh: auth2.c clientloop.c kex.c mux.c 
 progressmeter.c serverloop.c sftp-client.c 
 sftp.c ssh-agent.c ssh-ecdsa-sk.c ssh-ecdsa.c 
 sshconnect2.c sshd.c 
usr.bin/tftp   : main.c 
usr.bin/top: top.c 
usr.bin/usbhidaction: usbhidaction.c 
usr.bin/wall   : wall.c 
usr.bin/what   : what.c 
usr.sbin/apmd  : apmd.c 
usr.sbin/dvmrpd: control.c 
usr.sbin/eeprom: ophandlers.c 
usr.sbin/eigrpd: 

CVS: cvs.openbsd.org: src

2023-03-07 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/03/07 10:43:59

Modified files:
sbin/ipsecctl  : ipsecctl.c pfkdump.c 
usr.bin/find   : function.c 
usr.bin/usbhidctl: usbhid.c 

Log message:
Delete obsolete /* ARGSUSED1 */ lint comments.

ok claudio@ cheloha@ krw@ deraadt@ miod@ millert@



CVS: cvs.openbsd.org: src

2023-02-21 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/02/21 23:54:13

Modified files:
lib/libc/sys   : __thrsigdivert.2 

Log message:
Point to  and not : the latter is
an implementation detail for the kernel, libc, and libkvm,
and should not be a concern for others.



CVS: cvs.openbsd.org: src

2023-02-21 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/02/21 23:43:45

Modified files:
lib/libpthread/man: pthread_stackseg_np.3 

Log message:
Don't mention :  pulls in everything that's
needed.



CVS: cvs.openbsd.org: src

2023-02-21 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/02/21 23:39:39

Modified files:
lib/libc/sys   : getlogin.2 

Log message:
Prefer 'argument' over 'parameter' when refering to the value
passed in a specific call.

>From discussion with schwarze@ and jmc@
ok jmc@



CVS: cvs.openbsd.org: src

2023-02-21 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/02/21 23:31:52

Modified files:
lib/libc/gen   : getprogname.3 posix_spawnattr_getflags.3 
 posix_spawnattr_getpgroup.3 
lib/libc/sys   : __get_tcb.2 getlogin.2 getrtable.2 getsockopt.2 
 getthrname.2 
lib/libpthread/man: pthread_barrierattr_getpshared.3 

Log message:
Prefer "get or set" over "get/set" or "get and set".

>From discussion with schwarze@ and jmc@
ok jmc@



CVS: cvs.openbsd.org: src

2023-02-10 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/02/10 23:10:39

Modified files:
lib/libc/arch/arm/sys: cerror.S 
lib/libc/arch/hppa: SYS.h 
lib/libc/arch/powerpc: SYS.h 
lib/libc/arch/sh: SYS.h 

Log message:
Use a consistent comment to explain why 32bit archs set their second
return register to -1 in the syscall error path ("for lseek").

removal of the misleading __syscall() mention requested by deraadt@
ok deraadt@



CVS: cvs.openbsd.org: src

2023-02-09 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/02/09 01:00:31

Modified files:
sys/kern   : kern_ktrace.c 

Log message:
Delay setting the timestamp in the ktrace header until we've grabbed
the vnode, to eliminate misordering of ktrace records.

problem noted by jrick@
ok deraadt@



CVS: cvs.openbsd.org: src

2023-01-15 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/01/16 00:09:12

Modified files:
sys/sys: proc.h 
sys/kern   : exec_elf.c 
sys/uvm: uvm_mmap.c 
lib/libc/dlfcn : init.c 

Log message:
Currently we disable kbind(2) for static program from libc.a's
preinit hook.  Delete that and instead have the kernel disable kbind
at exec-time if the program doesn't have an ELF interpreter.  For
now, permit userland calls to disable it when already disabled so
existing static programs continue to work.

prompted by deraadt@ questioning about the call in libc.a

ok deraadt@ miod@



CVS: cvs.openbsd.org: src

2023-01-08 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/01/08 19:12:13

Modified files:
sys/kern   : kern_prot.c 

Log message:
setthrname() should return EINVAL, not ENAMETOOLONG, when the
input is too long.

ok mpi@



CVS: cvs.openbsd.org: src

2023-01-07 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/01/07 21:54:50

Modified files:
lib/libc/sys   : Makefile.inc 
Added files:
lib/libc/sys   : getthrname.2 

Log message:
Add getthrname(2) manpage

ok jmc@ schwarze@



CVS: cvs.openbsd.org: src

2023-01-06 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/01/06 22:26:40

Modified files:
usr.bin/kdump  : kdump.c 

Log message:
Add argument and return support for {get,set}thrname()



CVS: cvs.openbsd.org: src

2023-01-06 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/01/06 22:25:40

Modified files:
sys/kern   : init_sysent.c syscalls.c 
sys/sys: syscall.h syscallargs.h 

Log message:
regen



CVS: cvs.openbsd.org: src

2023-01-06 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/01/06 22:24:59

Modified files:
sys/kern   : syscalls.master kern_exec.c kern_fork.c 
 kern_pledge.c kern_prot.c 
sys/sys: proc.h sysctl.h 
include: unistd.h 
lib/libc   : Symbols.list shlib_version 
lib/libc/sys   : Makefile.inc 
lib/librthread : rthread_np.c shlib_version 
bin/ps : print.c 
usr.bin/top: machine.c 

Log message:
Add {get,set}thrname(2) for putting thread names in the kernel and
exposed in a new field returned by sysctl(KERN_PROC).  Update
pthread_{get,set}_name_np(3) to use the syscalls.  Show them, when
set, in ps -H and top -H output.

libc and libpthread minor bumps

ok mpi@, mvs@, deraadt@



CVS: cvs.openbsd.org: src

2023-01-02 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2023/01/02 16:09:48

Modified files:
sys/sys: proc.h 
sys/kern   : kern_proc.c kern_sig.c kern_time.c 
 sys_process.c 

Log message:
Add tfind_user(), for getting a proc* given a user-space TID and
the process* that it should be part of.  Use that in clock_get{time,res}(),
thrkill(), and ptrace().

ok jca@ miod@ mpi@ mvs@



CVS: cvs.openbsd.org: src

2022-12-28 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2022/12/28 23:10:54

Modified files:
share/man/man9 : fork1.9 

Log message:
FORK_SIGHAND and the handling of func==NULL disappeared in 2017 in
sys/kern/kern_fork.c rev 1.195.



CVS: cvs.openbsd.org: src

2022-12-28 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2022/12/28 18:36:36

Modified files:
sys/kern   : kern_sig.c kern_exit.c 
sys/sys: ktrace.h 
usr.bin/kdump  : kdump.c ktrstruct.c kdump.h 

Log message:
Add ktrace struct tracepoints for siginfo_t to the kernel side of
waitid(2) and __thrsigdivert(2) and teach kdump(1) to handle them.
Also report more from the siginfo_t inside PSIG tracepoints.

ok mpi@



CVS: cvs.openbsd.org: src

2022-12-20 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2022/12/20 14:44:19

Modified files:
usr.bin/kdump  : kdump.c 

Log message:
Add argument support for msyscall, pledge, unveil, __realpath,
ypconnect, and __tmpfd.  Reorder several other syscalls to match
the order in syscalls.master

ok deraadt@



Re: CVS: cvs.openbsd.org: src

2022-12-19 Thread Philip Guenther
On Mon, Dec 19, 2022 at 2:55 PM Philip Guenther 
wrote:

> CVSROOT:/cvs
> Module name:src
> Changes by: guent...@cvs.openbsd.org2022/12/19 15:55:12
>
> Modified files:
> usr.bin/kdump  : kdump.c kdump_subr.h mksubr
>
> Log message:
> Improve reporting of waitid(2)'s idtype/id and options arguments
> Add mimmutable(2) to report like munmap(2)
>

...and this is ok deraadt@ and millert@

(not my day for typing commit messages)


Re: CVS: cvs.openbsd.org: src

2022-12-19 Thread Philip Guenther
On Mon, Dec 19, 2022 at 2:45 PM Philip Guenther 
wrote:

> CVSROOT:/cvs
> Module name:src
> Changes by: guent...@cvs.openbsd.org2022/12/19 15:44:54
>
> Modified files:
> regress/lib/libc/sys: t_wait_noproc.c
>
> Log message:
> WTRAPPED is now supported by waitid(2)
> Don't test waitid(WUNTRACED) as that's not portable and only 'works' due
> to an implementation decision
>

This was ok kettenis@


CVS: cvs.openbsd.org: src

2022-12-19 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2022/12/19 15:55:12

Modified files:
usr.bin/kdump  : kdump.c kdump_subr.h mksubr 

Log message:
Improve reporting of waitid(2)'s idtype/id and options arguments
Add mimmutable(2) to report like munmap(2)



CVS: cvs.openbsd.org: src

2022-12-19 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2022/12/19 15:44:54

Modified files:
regress/lib/libc/sys: t_wait_noproc.c 

Log message:
WTRAPPED is now supported by waitid(2)
Don't test waitid(WUNTRACED) as that's not portable and only 'works' due
to an implementation decision



CVS: cvs.openbsd.org: src

2022-12-19 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2022/12/19 11:13:50

Modified files:
lib/libc/sys   : Makefile.inc intro.2 wait.2 
Added files:
lib/libc/sys   : waitid.2 

Log message:
Add waitid(2) manpage, based on a first pass by espie@ and bits
from FreeBSD and NetBSD.

ok kettenis@ jmc@ espie@



CVS: cvs.openbsd.org: src

2022-12-18 Thread Philip Guenther
CVSROOT:/cvs
Module name:src
Changes by: guent...@cvs.openbsd.org2022/12/18 20:54:17

Modified files:
lib/libc/sys   : intro.2 

Log message:
Revert previous: unintentionally included in commit



  1   2   3   4   5   6   7   8   9   10   >