CVS: cvs.openbsd.org: src

2022-08-25 Thread Klemens Nanni
CVSROOT:/cvs
Module name:src
Changes by: k...@cvs.openbsd.org2022/08/25 18:24:56

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

Log message:
Move (unused) variables under !VERIFYONLY

install media does not use any of -cns, so move their handling out under
!VERIFYONLY to silence -Wunused-but-set-variable warnings in
distrib/special/signify.

OK deraadt



CVS: cvs.openbsd.org: src

2022-08-25 Thread Klemens Nanni
CVSROOT:/cvs
Module name:src
Changes by: k...@cvs.openbsd.org2022/08/25 18:02:09

Modified files:
sbin/slaacd: engine.c 

Log message:
Move (unused) functions under !SMALL

if_state_name() and proposal_state_name() are only uesd in log_debug()
calls which are NOOPs in SMALL builds.

Seen with -Wunused-function warnings in distrib/special/slaacd.

OK deraadt



CVS: cvs.openbsd.org: src

2022-08-25 Thread Jonathan Gray
CVSROOT:/cvs
Module name:src
Changes by: j...@cvs.openbsd.org2022/08/25 17:52:56

Modified files:
sys/dev/pci/drm/amd/display/dc/dcn303: dcn303_resource.c 

Log message:
drm/amd/display: Check correct bounds for stream encoder instances for DCN303

>From Aurabindo Pillai
82a27c1855445d48aacc67b0c0640f3dadebe52f in linux 5.15.y/5.15.63
89b008222c2bf21e50219725caed31590edfd9d1 in mainline linux



CVS: cvs.openbsd.org: src

2022-08-25 Thread Jonathan Gray
CVSROOT:/cvs
Module name:src
Changes by: j...@cvs.openbsd.org2022/08/25 17:49:31

Modified files:
sys/dev/pci/drm/ttm: ttm_bo.c 

Log message:
drm/ttm: Fix dummy res NULL ptr deref bug

>From Arunpravin Paneer Selvam
76672cd326c146ded2c2712ff257b8908dcf23d8 in linux 5.15.y/5.15.63
cf4b7387c0a842d64bdd7c353e6d3298174a7740 in mainline linux



CVS: cvs.openbsd.org: src

2022-08-25 Thread Scott Soule Cheloha
CVSROOT:/cvs
Module name:src
Changes by: chel...@cvs.openbsd.org 2022/08/25 14:43:17

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

Log message:
amd64/lapic.c: remove unused extern prototype for tsc_delay()



CVS: cvs.openbsd.org: src

2022-08-25 Thread Mark Kettenis
CVSROOT:/cvs
Module name:src
Changes by: kette...@cvs.openbsd.org2022/08/25 13:16:29

Modified files:
sys/arch/arm64/dev: aplcpu.c 

Log message:
The "Avalanche" performance cores on Apple's M2 SoC have more than 16
P-states.  As a result the layout of the "state" register changed.
Make the driver handle that.

Also make sure we use the correct lowest state in case the lowest
frequency of the performance cores is different from the lowest
frequency of the efficiency cores.

ok tobhe@



CVS: cvs.openbsd.org: src

2022-08-25 Thread Job Snijders
CVSROOT:/cvs
Module name:src
Changes by: j...@cvs.openbsd.org2022/08/25 12:12:05

Modified files:
usr.sbin/rpki-client: filemode.c main.c rpki-client.8 

Log message:
Make PEM printing available through increased verbosity (-vvf)

Suggestion from claudio@

OK tb@



CVS: cvs.openbsd.org: src

2022-08-25 Thread Scott Soule Cheloha
CVSROOT:/cvs
Module name:src
Changes by: chel...@cvs.openbsd.org 2022/08/25 12:01:54

Modified files:
sys/dev/acpi   : acpihpet.c 

Log message:
acpihpet(4): don't truncate HPET frequency to 32-bit value

timecounter.tc_frequency is a 64-bit value: this cast is unnecessary.

Split off from the acpihpet_delay() commit at jsg@'s suggestion.

Link1: https://marc.info/?l=openbsd-tech=166053729104923=2
Link2: https://marc.info/?l=openbsd-tech=166132727120528=2

probably ok jsg@



CVS: cvs.openbsd.org: src

2022-08-25 Thread Scott Soule Cheloha
CVSROOT:/cvs
Module name:src
Changes by: chel...@cvs.openbsd.org 2022/08/25 11:54:33

Modified files:
sys/dev/acpi   : acpihpet.c 

Log message:
acpihpet(4): add acpihpet_delay(), another delay(9) implementation

When lapic_delay() is removed from the tree in the near future, older
machines without a constant/invariant TSC will need a delay(9)
implementation better than i8254_delay().

This patch adds acpihpet_delay(), a delay(9) implementation based on
the ACPI HPET timer.  It is preferable to i8254_delay() (0) and
acpitimer_delay() (1000), so set its quality to 2000.

On newer machines, the HPET is slower to read than the PMT on newer
machines for reasons unknown, so _technically_ this quality hierarchy
is not always accurate.  However, we expect these newer machines to
have a constant/invariant TSC available, so the inaccuracy is harmless
because tsc_delay() will be available, which is better than both the
PMT and the HPET.

In general, on real hardware that predates wide availability of the
constant/invariant TSC, the HPET is preferable to the PMT.

With input from jsg@.

Link: https://marc.info/?l=openbsd-tech=166053729104923=2

ok mlarkin@ jsg@



CVS: cvs.openbsd.org: src

2022-08-25 Thread Scott Soule Cheloha
CVSROOT:/cvs
Module name:src
Changes by: chel...@cvs.openbsd.org 2022/08/25 11:43:34

Modified files:
sys/dev/acpi   : acpitimer.c 

Log message:
acpitimer(4): add acpitimer_delay(), another delay(9) implementation

When lapic_delay() is removed from the tree in the near future, older
machines without a constant/invariant TSC will need a delay(9)
implementation better than i8254_delay().

This patch adds acpitimer_delay(), a delay(9) implementation based on
the ACPI PM timer.  It is only preferable to i8254_delay(), so set its
quality to 1000.

With input from jsg@.

Link: https://marc.info/?l=openbsd-tech=166053729104923=2

ok mlarkin@ jsg@



CVS: cvs.openbsd.org: src

2022-08-25 Thread Scott Soule Cheloha
CVSROOT:/cvs
Module name:src
Changes by: chel...@cvs.openbsd.org 2022/08/25 11:38:16

Modified files:
sys/arch/amd64/amd64: tsc.c lapic.c 
sys/arch/i386/i386: lapic.c 
sys/dev/pv : pvbus.c 

Log message:
amd64, i386: use delay_init() instead of writing delay_func by hand

Now that we have delay_init(), use it in all the places where we
currently set delay_func by hand.

lapic_delay() is great: 3000.  hv_delay() is needed before we set up
lapic_delay() on Hyper-V guests: 4000.  tsc_delay() is better than
lapic_delay() and (probably?) hv_delay(): 5000.

We may bump hv_delay's quality value up over that of tsc_delay() in a
future patch.  It's a little ambiguous whether hv_delay() causes a VM
exit.

Idea and patch from jsg@.  With tons of input, research and advice
from jsg@.

Link: https://marc.info/?l=openbsd-tech=166053729104923=2

ok mlarkin@ jsg@



CVS: cvs.openbsd.org: src

2022-08-25 Thread Job Snijders
CVSROOT:/cvs
Module name:src
Changes by: j...@cvs.openbsd.org2022/08/25 11:31:26

Modified files:
usr.sbin/rpki-client: filemode.c main.c rpki-client.8 

Log message:
In verbose filemode print details about encapsulated certificates.
Add command line flag to print the certificate in PEM format.

OK tb@



CVS: cvs.openbsd.org: src

2022-08-25 Thread Scott Soule Cheloha
CVSROOT:/cvs
Module name:src
Changes by: chel...@cvs.openbsd.org 2022/08/25 11:25:25

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

Log message:
amd64, i386: add delay_init(): basic delay(9) implementation management

Because the clock situation on x86 and amd64 is a terminal
clusterfuck, there are many different ways to delay(9).  We need a
rudimentary mechanism for gracefully switching to progressively better
delay(9) implementations as they become available during boot without
riddling the code with ifdefs and function pointer comparisons.

This patch adds delay_init() to both amd64 and i386.  If the quality
value passed to delay_init() exceeds the quality value of the current
delay_func, delay_init() changes delay_func to the given function
pointer and updates the quality value.  Both platforms start with
delay_func set to i8254_delay() and a quality value of zero: all other
delay(9) implementations are preferable.

Idea and patch provided by jsg@.  With tons of input, research, and
advice from jsg@.

Link: https://marc.info/?l=openbsd-tech=166053729104923=2

ok mlarkin@ jsg@



CVS: cvs.openbsd.org: src

2022-08-25 Thread Job Snijders
CVSROOT:/cvs
Module name:src
Changes by: j...@cvs.openbsd.org2022/08/25 11:11:35

Modified files:
usr.sbin/rpki-client: filemode.c 

Log message:
Fix newline in JSON filemode

OK tb@



CVS: cvs.openbsd.org: src

2022-08-25 Thread Klemens Nanni
CVSROOT:/cvs
Module name:src
Changes by: k...@cvs.openbsd.org2022/08/25 11:09:54

Modified files:
lib/libutil: opendev.3 opendev.c 

Log message:
Only return file descriptors to block or character devices

If the requested path contained a slash, opendev(3) blindly opened the file
and returned a file descriptor to it.

Check for block or character devices (according to OPENDEV_BLCK) and fail
for other types.

Spotted through installboot(8) which happily opened a stage file as device
when forgetting the device argument:
# installboot -v ./biosboot
Using / as root
installing bootstrap on ./biosboot
using first-stage /usr/mdec/biosboot, second-stage /usr/mdec/boot
installboot: disklabel: ./biosboot: Inappropriate ioctl for device

This makes it fail earlier, as expected:
# installboot -v ./biosboot
installboot: open: ./biosboot: Block device required

The case where opendev(3) is passed a string not containing a slash, i.e.
a supposed DUID, is fine, as diskmap(4) will ensure that only valid device
paths are returned, if the DUID is valid.

Feedback OK millert



CVS: cvs.openbsd.org: src

2022-08-25 Thread Claudio Jeker
CVSROOT:/cvs
Module name:src
Changes by: clau...@cvs.openbsd.org 2022/08/25 10:49:18

Modified files:
usr.sbin/bgplgd: qs.c slowcgi.c 

Log message:
Use memset() and memcpy() instead of bzero() or bcopy().
In one case use memmove() since the operation is done on the same memory
buffer and may overlap.
OK tb@



CVS: cvs.openbsd.org: src

2022-08-25 Thread Miod Vallat
CVSROOT:/cvs
Module name:src
Changes by: m...@cvs.openbsd.org2022/08/25 10:10:15

Modified files:
sys/arch/octeon/conf: BOOT 

Log message:
No need for wsmux in this kernel configuration; ok visa@



CVS: cvs.openbsd.org: src

2022-08-25 Thread Todd C . Miller
CVSROOT:/cvs
Module name:src
Changes by: mill...@cvs.openbsd.org 2022/08/25 07:32:13

Modified files:
lib/libc/time  : localtime.c 

Log message:
No need to include float.h anymore.



CVS: cvs.openbsd.org: src

2022-08-25 Thread Job Snijders
CVSROOT:/cvs
Module name:src
Changes by: j...@cvs.openbsd.org2022/08/25 05:07:28

Modified files:
usr.sbin/rpki-client: filemode.c 

Log message:
Plug memory leak in filemode

OK tb@ claudio@



Re: CVS: cvs.openbsd.org: src

2022-08-25 Thread Stuart Henderson
On 2022/08/24 15:08, Klemens Nanni wrote:
> CVSROOT:  /cvs
> Module name:  src
> Changes by:   k...@cvs.openbsd.org2022/08/24 15:08:51
> 
> Modified files:
>   distrib/special/installboot: Makefile 
> 
> Log message:
> Forgotten to commit as part of
> 
> 
> /usr/src/usr.sbin/installboot/Makefile revision 1.25

It's unhelpful to include those lines directly quoted in a separate commit log,
it breaks tools which parse log output (like cvsps).

I normally scratch over one of the -'s to avoid the problem.



CVS: cvs.openbsd.org: src

2022-08-25 Thread Claudio Jeker
CVSROOT:/cvs
Module name:src
Changes by: clau...@cvs.openbsd.org 2022/08/25 02:10:25

Modified files:
usr.sbin/bgpd  : kroute.c rde_rib.c 

Log message:
Connected routes use the BGP exit nexthop while other routes need to use
the nexthop from the covering route. Move this logic from RDE to the
kroute code so it is all in one place.
OK tb@