X11 startup scripts: sync ssh key list

2022-06-19 Thread Christian Weisgerber
The X11 session startup files for xenodm and xinit share the same snippet which checks if any of the default ssh private key files exist, and if so, starts ssh-agent and runs ssh-add. The list of key files is outdated. SSH1 "identity" is gone, and "id_ecdsa_sk" and "id_ed25519_sk" have been

Re: obsolete dump options syntax

2022-06-02 Thread Christian Weisgerber
Jan Stary: > http://cvsweb.netbsd.org/bsdweb.cgi/src/sbin/dump/main.c.diff?r1=1.4=1.5=h > "Use getopt(3), with obsolete() from restore(8) for backward compatibility." > > So it's restore(8); I write "restore rf" myself. > Is this it? Does that still need to be supported by dump(8)? The same

Re: ssh-keygen(1): resident fido2 keys

2022-05-01 Thread Christian Weisgerber
Florian Obser: > Sounds reasonable, this adds the FIDO section and moves the -O bits in. > The wording is inspired by / copied from the 8.2 release notes and the > CERTIFICATES section. I think that makes sense. s/token/authenticator/g We standardized on "FIDO authenticator" some time ago,

arm64: constify miscellaneous pin and clock tables

2022-04-16 Thread Christian Weisgerber
So I did "objdump -t bsd | fgrep 'O .data' | sort -k5r" on arm64. Oh my. The diff below constifies a myriad of pin, clock, etc. tables. This is all very mechanical. An arm64 GENERIC.MP kernel still builds and boots with this. OK? M sys/dev/fdt/amlclock.c M sys/dev/fdt/amlpinctrl.c M

Re: ddb: simplify "machine" command handling

2022-04-11 Thread Christian Weisgerber
Christian Weisgerber: > This will allow constifying the ddb command tables in a subsequent > step. And here's that boring follow-up diff. M sys/arch/alpha/alpha/db_interface.c M sys/arch/amd64/amd64/db_interface.c M sys/arch/arm/arm/db_interface.c M sys/arch/arm64/arm64/db_interfa

ddb: simplify "machine" command handling

2022-04-10 Thread Christian Weisgerber
Most of our architectures implement a "machine" command as a MD extension in ddb(4). Currently that is handled in this way: * A define is placed in a MD header. * The MI ddb code checks for the define, creates an incomplete entry in the command table, and provides an initialization function. *

Re: [ouex]hci(4), dwctwo(4): constify bus/pipe method tables

2022-04-10 Thread Christian Weisgerber
Marcus Glocker: > > This constifies the bus method and pipe method tables in our USB > > host controller drivers. > > dwctwo(4) also exists on arm64. Oops, right. That arch I have. The USB host controller drivers also have another set of tables to emulate the root hub. I have extended the

Constify SCSI adapter entry points

2022-04-09 Thread Christian Weisgerber
This constifies the SCSI adapter entry points (struct scsi_adapter). It reaches into some archs I don't have... ok? M sys/arch/luna88k/dev/mb89352.c M sys/arch/luna88k/dev/mb89352var.h M sys/arch/luna88k/dev/spc.c M sys/arch/sparc64/dev/vdsk.c M sys/dev/ata/atascsi.c M

atascsi: constify method tables

2022-04-08 Thread Christian Weisgerber
This constifies the method tables used by the atascsi framework and the ahci(4) and sili(4) drivers. ok? diff 9939c0709df17eb9b8160ad1561241ed2c4b8922 83fd09f48cb0df5e29a782b651c4210e90f90b00 blob - 46c681203e8e39e25167f98907a2ecc848e9d1a4 blob + 19f61480e83314afe9d58d24b52e1b1d7e64ea93 ---

uoak*(4): constify method tables

2022-04-08 Thread Christian Weisgerber
This constifies the method tables in the OAK USB sensor drivers. Bycatch from the ucom changes. ok? diff b29fcdeeb3e7dfaa7565194eb526a7ece255a8a8 9939c0709df17eb9b8160ad1561241ed2c4b8922 blob - 789cef98e6a9a4d88bbb19b33e1801396618c591 blob + 511c0e62aec982253cdf4b27ae2af3e020cc6f9f ---

ucom(4): constify method tables in USB serial drivers

2022-04-08 Thread Christian Weisgerber
This constifies the ucom method tables in the USB serial adapter drivers, i.e., moves another kilobyte of function pointers into read-only space. ok? diff 4df278d953b03573222cb39b422e005d4701614e b29fcdeeb3e7dfaa7565194eb526a7ece255a8a8 blob - 0f5d4bed40c58062bd043d0366485629d59c53cd blob +

[ouex]hci(4), dwctwo(4): constify bus/pipe method tables

2022-04-08 Thread Christian Weisgerber
This constifies the bus method and pipe method tables in our USB host controller drivers. dwctwo(4) only exists on octeon, which I don't have access to. Could somebody check that it builds? ok? diff b5489662588c813212f71c840fa931535322293d 4df278d953b03573222cb39b422e005d4701614e blob -

esm(4/i386), it(4): constify sensor tables

2022-04-08 Thread Christian Weisgerber
This constifies the tables of two unrelated sensor drivers: esm(4/i386) and it(4). ok? diff d6a09d27ff49886a6b6f4bd1f7d89c0f90a64b40 refs/heads/const blob - 0a734dc971d9402e738d08d014555c8afb95827b blob + e8a4e5eeadcdcfd23c1dd525470e70522272676b --- sys/arch/i386/i386/esm.c +++

lm, uguru, fins, wbenv: constify sensor tables

2022-04-07 Thread Christian Weisgerber
This constifies the sensor tables of the lm(4), uguru(4), fins(4), and wbenv(4) drivers, which all share the same basic design. ok? diff refs/heads/master refs/heads/const_sensors blob - a813447ec9521a2a11a8b1f5daa38b881da007c1 blob + 3a1b2bfdc2b1d92d62f3b156479ad0ff5b57e463 ---

Constify ifmedia descriptions

2022-04-07 Thread Christian Weisgerber
This constifies the ifmedia description tables, both in the kernel (yes, I did a test compile with option IFMEDIA_DEBUG) and one straggler in userland. ok? diff 3c78bc9451ce7ce927aaecc9f8e5113de7023a9c /usr/src blob - 0ef67c56edd8be741533ccba974c11f198887b32 file + sbin/ifconfig/ifconfig.c ---

wscons: const-ify font encoding tables

2022-04-04 Thread Christian Weisgerber
You'd think that the kernel font bitmaps are a primary example of data that could be read-only... and you'd be wrong. The font encoding tables however are indeed constant as far as I can tell. The diff below marks them as such. NetBSD has the same. ok? diff

ftp.1: fix editing mishap

2022-03-27 Thread Christian Weisgerber
It appears that in revision 1.85 of usr.bin/ftp/ftp.1 a sentence fragment was accidentally not removed. OK? Index: usr.bin/ftp/ftp.1 === RCS file: /cvs/src/usr.bin/ftp/ftp.1,v retrieving revision 1.122 diff -u -p -r1.122 ftp.1 ---

Re: Power-up cc --print-file-name for .so names

2022-02-20 Thread Christian Weisgerber
Mark Kettenis: > There is a scenario where this goes wrong. If a shared library lacks > a DT_SONAME entry, the library filename is used to generate the > DT_NEEDED entries. But I would consider such a shared library broken > and we fixed base a lng time ago. Some care has to be taken when

Re: ypldap: fix -Wunused-but-set-variable warnings

2022-02-05 Thread Christian Weisgerber
Christian Weisgerber: > usr.sbin/ypldap: fix -Wunused-but-set-variable warnings > > * "wrlen" has been write-only since the code was imported. > * Removing "dns_pid" replicates ntpd/ntp.c 1.122 (aece4353519f). > * yp_check() looks like unfinished code. Rathe

Summary of remaining "set but not used" warnings

2022-01-29 Thread Christian Weisgerber
First up, note that clang 13 does not produce those "variable foo set but not used" warnings by default. They need to be enabled by -Wunused-but-set-variable or, more typically, as part of -Wall. Here are the remaining warnings seen in a "make build": bin/ksh required arguments to macros

ypldap: fix -Wunused-but-set-variable warnings

2022-01-29 Thread Christian Weisgerber
usr.sbin/ypldap: fix -Wunused-but-set-variable warnings * "wrlen" has been write-only since the code was imported. * Removing "dns_pid" replicates ntpd/ntp.c 1.122 (aece4353519f). * yp_check() looks like unfinished code. Rather than removing it we can ifdef it out. ok? M

tcpdump: fix -Wunused-but-set-variable warning

2022-01-29 Thread Christian Weisgerber
usr.sbin/tcpdump: fix -Wunused-but-set-variable warning All "infile" handling was moved into priv_exec() when tcpdump was priviledge separated. The options are scanned both in priv_exec() and in main(), so the empty case needs to remain in the latter. ok? M usr.sbin/tcpdump/tcpdump.c diff

Remove unused variable from _asr_strdname(), print_dname()

2022-01-18 Thread Christian Weisgerber
remove unused variable from all copies of _asr_strdname() and print_dname() This also fixes -Wunused-but-set-variable warnings warnings in smtpd and smtpctl. The code was imported with asr and then copied around. ok? M lib/libc/asr/asr.c M regress/lib/libc/asr/bin/res_mkquery.c M

usr.sbin/rad: fix -Wunused-but-set-variable warning

2022-01-17 Thread Christian Weisgerber
usr.sbin/rad: fix -Wunused-but-set-variable warning Trivial removal of unused variable. M usr.sbin/rad/frontend.c diff c9fb0989c5128843af76d1ecd08c6f483f233307 1779a21799642d5916a407f0cea6255b101c055c blob - e6f6ae0419ab1662ebb2e8cdd17c07a82d1b87f9 blob +

usr.sbin/ospf6ctl: fix -Wunused-but-set-variable warning

2022-01-17 Thread Christian Weisgerber
usr.sbin/ospf6ctl: fix -Wunused-but-set-variable warning Maybe this is uncompleted code, but I think we can remove it for the time being. M usr.sbin/ospf6ctl/ospf6ctl.c diff a992977b148f5fd9d4e3b9af9aeccac488edfa7a c9fb0989c5128843af76d1ecd08c6f483f233307 blob -

usr.sbin/ospf6d: fix -Wunused-but-set-variable warnings

2022-01-17 Thread Christian Weisgerber
usr.sbin/ospf6d: fix -Wunused-but-set-variable warnings merge_config() sets "rchange", but doesn't use it. Comparing the code to osfpd/ospfd.c makes me think that's an omission. Either way it seems odd that the two code bases differ here. rde_summary_update() is incomplete. We can simply

usr.sbin/eigrpd: fix -Wunused-but-set-variable warning

2022-01-16 Thread Christian Weisgerber
usr.sbin/eigrpd: fix -Wunused-but-set-variable warning M usr.sbin/eigrpd/rde_dual.c diff 41bbcfa017d9537de08312789d0087c674ce4732 77e83947795bf5b53aef72070d7630a825b52c1f blob - f1ed306e1371896676cf45b26e102af5e4d77b36 blob + 9465250934a6b1a5f6d565a13d32c4c450786670 ---

usr.sbin/dvmrpctl: fix -Wunused-but-set-variable warning

2022-01-16 Thread Christian Weisgerber
usr.sbin/dvmrpctl: fix -Wunused-but-set-variable warning This looks like /* not yet implemented */, but the companion functions show_rib_detail_msg() and show_mfc_detail_msg() are equally empty. M usr.sbin/dvmrpctl/dvmrpctl.c diff 4bd575d8630c92f404211d2c625b200ac28213b9

usr.sbin/dhcpd: fix -Wunused-but-set-variable warning

2022-01-16 Thread Christian Weisgerber
usr.sbin/dhcpd: fix -Wunused-but-set-variable warning I think this should be fine as strtonum() will catch any errors. M usr.sbin/dhcpd/parse.c diff 5ce17aab12dafb0a17452c4e0e86b29d89d83d13 4bd575d8630c92f404211d2c625b200ac28213b9 blob - 5b719219d00046e02e932796a78dc14ceddaa109 blob +

usr.bin/mg: fix -Wunused-but-set-variable warnings

2022-01-16 Thread Christian Weisgerber
usr.bin/mg: fix -Wunused-but-set-variable warnings * strtonum() is only called to verify that a string is numerical, the return value is unused. * inlist is no longer used after the code was refactored. OK? M usr.bin/mg/interpreter.c diff 6e5c342a53c05496c18849837c67b7dc05ce3792

sbin/isakmpd: fix -Wunused-but-set-variable warnings

2022-01-15 Thread Christian Weisgerber
sbin/isakmpd: fix -Wunused-but-set-variable warnings The one in pf_key_v2.c could use an extra set of eyes, but I don't think there are any side effects. M sbin/isakmpd/ipsec.c M sbin/isakmpd/pf_key_v2.c M sbin/isakmpd/udp_encap.c M sbin/isakmpd/x509.c diff

sbin/pfctl: fix -Wunused-but-set-variable warning

2022-01-15 Thread Christian Weisgerber
sbin/pfctl: fix -Wunused-but-set-variable warning M sbin/pfctl/pfctl_optimize.c diff 7c5dd09ecd1ff078b868c9ab52aac9754cde7761 6e5c342a53c05496c18849837c67b7dc05ce3792 blob - 1ab170a832dd183a2895774549ff93896803039a blob + 5736a0d7b0ba04afeed855daa61fc6b5ef3894e4 ---

lib/libfuse: fix -Wunused-but-set-variable warning

2022-01-15 Thread Christian Weisgerber
Since the switch to LLVM 13, there are a number of compiler warnings in base about variables that are assigned to but never used. Let's start picking the low-hanging fruit, ok? lib/libfuse: fix -Wunused-but-set-variable warning M lib/libfuse/fuse_opt.c diff

Re: unlock mmap(2) for anonymous mappings

2022-01-13 Thread Christian Weisgerber
Klemens Nanni: > > > Now this is clearly a "slow" path. I don't think there is any reason > > > not to put all the code in that if (uvw_wxabort) block under the > > > kernel lock. For now I think making access to ps_wxcounter atomic is > > > just too fine grained. > > > > Right. Lock the

Re: Rework UNIX sockets locking to be fine grained

2021-12-02 Thread Christian Weisgerber
Vitaliy Makkoveev: > Include missing "sys/refcnt.h" header to unpcb.h to fix libkvm and > netstat(1) build. No functional changes. I ran an amd64 package bulk build with this, four ncpu=4 machines. No problems. (Other than for dpb's ssh connection multiplexing, I don't think Unix domain sockets

Re: Variable type fix in parse.y (all of them)

2021-10-12 Thread Christian Weisgerber
Christian Weisgerber: > Here's another attempt, incorporating millert's feedback and adding > a few more casts: Any interest in this or not worth the churn and I should drop it? > Index: bin/chio/parse.y > === > RCS

Re: Variable type fix in parse.y (all of them)

2021-10-02 Thread Christian Weisgerber
Here's another attempt, incorporating millert's feedback and adding a few more casts: Index: bin/chio/parse.y === RCS file: /cvs/src/bin/chio/parse.y,v retrieving revision 1.23 diff -u -p -r1.23 parse.y --- bin/chio/parse.y15 Oct

Re: Variable type fix in parse.y (all of them)

2021-09-30 Thread Christian Weisgerber
Todd C. Miller: > On Thu, 30 Sep 2021 21:37:06 +0200, Christian Weisgerber wrote: > > > Unfortunately that also affects the parsebuf/pushback_buffer complex > > used in some parser.y files. > > That would require a few extra casts but it is straightforward. E.g. lik

Re: Variable type fix in parse.y (all of them)

2021-09-30 Thread Christian Weisgerber
Todd C. Miller: > lungetc((u_char)*p); > ... > c = (u_char)*--p; > > Since we use casts sparingly, when they are present they indicate > something you need to pay attention to. That is not the case when > we simply change the type. Unfortunately that also affects the

Re: Variable type fix in parse.y (all of them)

2021-09-30 Thread Christian Weisgerber
Christian Weisgerber: > The oft-copied parse.y code declares some variables as "unsigned char *" > but passes them to functions that take "char *" arguments and doesn't > make any use of the unsigned property. While I'm here... > int > yylex(v

Variable type fix in parse.y (all of them)

2021-09-29 Thread Christian Weisgerber
The oft-copied parse.y code declares some variables as "unsigned char *" but passes them to functions that take "char *" arguments and doesn't make any use of the unsigned property. For OpenBSD's clang, -Wpointer-sign has been disabled by default, but when that code is built elsewhere, the

Re: fresh prompt after Ctrl-C in cdio(1)

2021-08-12 Thread Christian Weisgerber
Ingo Schwarze: > deraadt@ recently pointed out to me in private mail that it is good > for usability if interactive programs providing line editing > functionality are consistent what they do with Ctrl-C, ideally > discard the current input line and provide a fresh prompt. > > So i propose to do

scp: tweak man page for -3 by default

2021-08-10 Thread Christian Weisgerber
scp: tweak documentation and error message for -3 by default Now that the -3 option is enabled by default, flip the documentation and an error message from "requires -3" to "blocked by -R". OK? diff 453220bf36dcff10addeceb44e98f71bfeddcd53 f457be8f3b007fb662dd10fb565ab79b602109f5 blob -

Re: scp(1) changes in snaps

2021-08-07 Thread Christian Weisgerber
"Theo de Raadt": > 2) With very long names, it truncates the end of the path. This is less useful > information. Imagine a copy operation with multiple files being transferred, > one of them is huge and surprisingly long, but you cannot identify which one > because all the truncated long paths

Re: scp(1) changes in snaps

2021-08-06 Thread Christian Weisgerber
Damien Miller: > Just a head-up: snaps currently contain a set of changes[1] to > make scp(1) use the SFTP protocol by default. > Please report any incompatibilities or bugs that you encounter here > (tech@), to bugs@ or to openssh@. An obvious cosmetic difference is that relative paths are

Re: Avoid shifting of a negative value in sys_adjfreq()

2021-05-30 Thread Christian Weisgerber
Visa Hankala: > However, wouldn't it be better if the code avoided the > situation, for example by defining ADJFREQ_MIN as the negative > of ADJFREQ_MAX? Indeed it would. ok naddy@ > --- kern/kern_time.c 23 Dec 2020 20:45:02 - 1.151 > +++ kern/kern_time.c 30 May 2021 15:38:09 -

Re: shell manpage tweaks wrt getopt

2021-05-01 Thread Christian Weisgerber
Marc Espie: > I would also actually be fairly happy if we changed drastically the way > sh(1) and ksh(1) look. To me, sh(1) should be the (more or less) standard > shell documentation, AND ksh(1) should contain the differences/extensions. I think that is a terrible idea. Historically the

Re: shell manpage tweaks wrt getopt

2021-05-01 Thread Christian Weisgerber
Jason McIntyre: > - i'm ok with the getopt.1 and ksh.1 parts > - i'm not ok with the addition to sh.1 > > no one has really given a good reason why they think it should go into > sh.1. i've given a few why i think it should not. My understanding is that sh.1 is a subset of ksh.1, describing the

switchd genmap.sh: getopt -> getopts

2021-04-30 Thread Christian Weisgerber
In this auxiliary script, replace the deprecated getopt with getopts. There is no pressing reason to do so, but let's stop perpetuating an obsolete idiom. ok? Index: usr.sbin/switchd/genmap.sh === RCS file:

Re: shell manpage tweaks wrt getopt

2021-04-30 Thread Christian Weisgerber
Marc Espie: > Until a patch from naddy, I wasn't even aware of getopts in sh(1) Let's start the discussion with this instead. This puts the deprecation notice in getopt.1 in a prominent place, and uses the same snippet in sh.1 and ksh.1. Index: bin/ksh/ksh.1

Re: Unlock top part of uvm_fault()

2021-04-24 Thread Christian Weisgerber
Christian Weisgerber: > > Diff below remove the KERNEL_LOCK()/UNLOCK() dance from uvm_fault() for > > both amd64 and sparc64. That means the kernel lock will only be taken > > for lower faults and some amap/anon code will now run without it. > > I ran an amd64 bulk bui

Re: Unlock top part of uvm_fault()

2021-04-23 Thread Christian Weisgerber
Martin Pieuchot: > Diff below remove the KERNEL_LOCK()/UNLOCK() dance from uvm_fault() for > both amd64 and sparc64. That means the kernel lock will only be taken > for lower faults and some amap/anon code will now run without it. > > I'd be interested to have this tested and see how much does

Re: quiz: Fix multi-line questions (trailing newline)

2021-03-10 Thread Christian Weisgerber
Todd C. Miller: > I don't think your use of qlen is safe since it is initialized > to zero. Specifically, it looks like "qp->q_text[qlen - 1]" > would be an out of bounds read. Should qlen be initialized > to strlen(qp->q_text) if qp->q_text != NULL? Right. Next iteration: Index: quiz.c

Re: quiz: Fix multi-line questions (trailing newline)

2021-03-09 Thread Christian Weisgerber
Alex Karle: > Looking deeper, there is a bug in quiz(6) for datfiles with multi-line > answers. > > Specifically, the following quiz.db line: > > foo:\ > bar > > Is parsed into "foo:bar\n", which made it impossible to get right (since > the comparison was expecting a newline).

Re: ftp: make use of getline(3)

2021-02-14 Thread Christian Weisgerber
Christian Weisgerber: > > Make use of getline(3) in ftp(1). > > > > Replace fparseln(3) with getline(3). This removes the only use > > of libutil.a(fparseln.o) from the ramdisk. > > Replace a complicated fgetln(3) idiom with the much simpler getline(3). >

Re: ftp: make use of getline(3)

2021-02-06 Thread Christian Weisgerber
Christian Weisgerber: > Make use of getline(3) in ftp(1). > > Replace fparseln(3) with getline(3). This removes the only use > of libutil.a(fparseln.o) from the ramdisk. > Replace a complicated fgetln(3) idiom with the much simpler getline(3). New diff that fixes a bug I intro

disklabel: make use of getline(3)

2021-01-31 Thread Christian Weisgerber
Replace fgetln(3) with getline(3). Since getline() returns a C string, we don't need to carry around the length separately. OK? Index: sbin/disklabel/editor.c === RCS file: /cvs/src/sbin/disklabel/editor.c,v retrieving revision

fdisk: make use of getline(3)

2021-01-30 Thread Christian Weisgerber
Replace fgetln(3) with getline(3). OK? Index: sbin/fdisk/misc.c === RCS file: /cvs/src/sbin/fdisk/misc.c,v retrieving revision 1.63 diff -u -p -r1.63 misc.c --- sbin/fdisk/misc.c 3 Jul 2019 03:24:01 - 1.63 +++

disklabel: pointer deref fix

2021-01-29 Thread Christian Weisgerber
Fix a pointer dereference in disklabel(8). This looks like somebody wrote *s[0] in place of (*s)[0]. Which in this case happens to be equivalent, but it still looks wrong. OK? Index: sbin/disklabel/editor.c === RCS file:

sed: make use of getline(3)

2021-01-29 Thread Christian Weisgerber
Replace fgetln(3) with getline(3) in sed. The mf_fgets() part is from Johann Oskarsson for Illumos/FreeBSD. Passes our sed regression tests. OK? Index: usr.bin/sed/main.c === RCS file: /cvs/src/usr.bin/sed/main.c,v retrieving

Re: ftp: make use of getline(3)

2021-01-29 Thread Christian Weisgerber
Hiltjo Posthuma: > > @@ -75,19 +74,8 @@ cookie_load(void) > > if (fp == NULL) > > err(1, "cannot open cookie file %s", cookiefile); > > date = time(NULL); > > - lbuf = NULL; > > - while ((line = fgetln(fp, )) != NULL) { > > - if (line[len - 1] == '\n') { > > -

ftp: make use of getline(3)

2021-01-29 Thread Christian Weisgerber
Make use of getline(3) in ftp(1). Replace fparseln(3) with getline(3). This removes the only use of libutil.a(fparseln.o) from the ramdisk. Replace a complicated fgetln(3) idiom with the much simpler getline(3). OK? Index: distrib/special/ftp/Makefile

Re: getopt.3 bugs section

2021-01-09 Thread Christian Weisgerber
Edgar Pettijohn: > In the BUGS section for the getopt(3) manual it mentions not using > single digits for options. I know spamd uses -4 and -6 there are > probably others. Should they be changed? Or is the manual mistaken? You misunderstand. The manual warns against the use of digits to pass

Re: Rename SIMPLEQ_ to STAILQ_, diff 1/7

2020-12-28 Thread Christian Weisgerber
Denis Fondras: > This diff renames SIMPLEQ_* to STAILQ_* in /usr/src/sys/sys to unify with > FreeBSD and Linux. > > I added aliases at the end of queue.h to avoid breaking base too much. they > will > be removed as soon as diff 2,3,4,5,6,7 are commited. > > net/sniproxy has a patch to define

Re: Rename SIMPLEQ_ to STAILQ_, diff 1/7

2020-12-26 Thread Christian Weisgerber
Theo de Raadt: > What is lacking in this converstation is the justification. > Why? Providing STAILQ in OpenBSD will simplify porting to OpenBSD. (Reality check: There is one port affected by this.) Switching OpenBSD to STAILQ will simplify porting from OpenBSD. (There are three or four FreeBSD

Re: Rename SIMPLEQ_ to STAILQ_, diff 1/7

2020-12-26 Thread Christian Weisgerber
Denis Fondras: > This diff renames SIMPLEQ_* to STAILQ_* in /usr/src/sys/sys to unify with > FreeBSD and Linux. > > I added aliases at the end of queue.h to avoid breaking base too much. they > will > be removed as soon as diff 2,3,4,5,6,7 are commited. We'll need to run a ports bulk build

libcurses: --enable-const

2020-12-12 Thread Christian Weisgerber
ncurses has a configure option that adds a few more consts to its headers by way of the NCURSES_CONST define. Starting with version 6.0, this has become the default. OpenBSD is still on ncurses 5.7, but FreeBSD and I guess most Linux distributions have moved on. I suggest we also enable the

Re: rpki-client: use strndup instead of malloc + memcpy

2020-12-03 Thread Christian Weisgerber
Claudio Jeker: > In tal_parse() use strndup() to create the tal descr instead of the more > complex malloc, memcpy version. Result is the same but the strndup version > is a lot nicer. Yes, but... > --- tal.c 11 Oct 2020 12:39:25 - 1.22 > +++ tal.c 3 Dec 2020 12:00:25 - >

Re: powerpc lld fix

2020-11-15 Thread Christian Weisgerber
Mark Kettenis: > What would the impact on ports of disabling base-gcc be on powerpc? None. $ cd /usr/ports $ make ARCH=macppc MACHINE_ARCH=powerpc show=CHOSEN_COMPILER |grep -B1 base-gcc $ -- Christian "naddy" Weisgerber na...@mips.inka.de

basename(3) should have non-const arg, says POSIX

2020-10-19 Thread Christian Weisgerber
[Picking this up again after a month:] Our basename(3) and dirname(3) take a const argument: char*basename(const char *); char*dirname(const char *); POSIX says otherwise... char *basename(char *path); char *dirname(char *path); ... and explicitly says the functions may modify

arm64 ddb: decode "udf" instruction

2020-10-19 Thread Christian Weisgerber
This decodes the UDF ("permanently undefined") instruction in ddb's arm64 disassembler. The particular immediate16 format appears to be unique to this instruction. OK? Or don't bother? Index: arch/arm64/arm64/disasm.c === RCS

arm64, armv7: proper illegal instruction

2020-10-19 Thread Christian Weisgerber
Belatedly, ARM has taken a slice of the reserved opcode space and assigned it as a properly defined illegal instruction, udf #imm16. (Armv8 Architecture Reference Manual, edition F.c, section C6.2.335). Clang already knows about it. We really should use this instead of picking something ad-hoc

Non-const basename: usr.bin/cvs

2020-10-16 Thread Christian Weisgerber
Accommodate POSIX basename(3) that takes a non-const parameter and may modify the string buffer. There were only two compiler warnings about discarded const, but there are numerous instances where the code assumes non-POSIX semantics for basename() and dirname(). Given that there is at least a

Non-const basename: usr.bin/ftp

2020-10-15 Thread Christian Weisgerber
Accommodate POSIX basename(3) that takes a non-const parameter and may modify the string buffer. I've tried to follow the conventions of the existing code. ok? Index: usr.bin/ftp/fetch.c === RCS file: /cvs/src/usr.bin/ftp/fetch.c,v

Non-const basename: usr.sbin/vmd, usr.sbin/vmctl

2020-10-14 Thread Christian Weisgerber
Accommodate POSIX basename(3) that takes a non-const parameter and may in fact modify the string buffer. The file is built by vmd and vmctl. I'm uncertain if we want a truncation check here. Both in vmd and vmctl, the path has been validated by a previous open(), but given the code complexity,

Non-const basename: usr.bin/rcs

2020-10-14 Thread Christian Weisgerber
Accommodate POSIX basename(3) that takes a non-const parameter and may in fact modify the string buffer. ok? Index: usr.bin/rcs/rlog.c === RCS file: /cvs/src/usr.bin/rcs/rlog.c,v retrieving revision 1.74 diff -u -p -r1.74 rlog.c ---

Non-const basename: sbin/pfctl

2020-10-13 Thread Christian Weisgerber
Accommodate a basename(3) that takes a non-const parameter and may in fact modify the string buffer. The length of anchor has already been checked in main(). ok? Index: sbin/pfctl/pfctl.c === RCS file: /cvs/src/sbin/pfctl/pfctl.c,v

net/pfvar.h: MAXPATHLEN -> PATH_MAX

2020-10-13 Thread Christian Weisgerber
In revision 1.407 of , deraadt@ replaced MAXPATHLEN with PATH_MAX so userland wouldn't have to pull in . In 1.466, sashan@ accidentally slipped one MAXPATHLEN back in, because its use is ubiquitous on the kernel side of pf. Switch this over to PATH_MAX again. pfctl(8) doesn't actually use this,

Non-const basename: bin/chio

2020-10-13 Thread Christian Weisgerber
As far as I understand, the basename() here is specifically intended to skip a leading "/dev/". So how about doing this expressly? Do we want to use _PATH_DEV or "/dev/"? There's a "/dev/rst%d" a few lines outside of the diff context... Index: bin/chio/parse.y

Non-const basename: usr.sbin/hotplugd

2020-10-13 Thread Christian Weisgerber
Accommodate a basename(3) that takes a non-const parameter and may in fact modify the string buffer. Between access(file, ...) and execl(file, ...), no check for truncation should be necessary. ok? Index: usr.sbin/hotplugd/hotplugd.c

Non-const basename: libkvm

2020-10-13 Thread Christian Weisgerber
Accommodate a basename(3) that takes a non-const parameter and may in fact modify the string buffer. Note that strlen(uf) >= PATH_MAX is already checked by the caller in _kvm_open(). ok? Index: lib/libkvm/kvm.c === RCS file:

Re: Non-const basename: usr.bin/sed

2020-10-11 Thread Christian Weisgerber
Martijn van Duren: > Wouldn't the following diff be a little simpler? Yes, it would. Should dirbuf be static like oldfname and tmpfname? Index: main.c === RCS file: /cvs/src/usr.bin/sed/main.c,v retrieving revision 1.40 diff -u

Re: WANTLIB problems and possible solution: the libset design

2020-10-11 Thread Christian Weisgerber
Marc Espie: > The new design: > > The idea behind "libset" is to be able to specify a "set" of wantlib that > corresponds to our package, AND to just write WANTLIB wrt that libset for > that specific set of libraries. I'm struggling to understand whether this libset records the libraries a port

Non-const basename: usr.bin/compress

2020-10-10 Thread Christian Weisgerber
Accommodate POSIX basename(3) that takes a non-const parameter and may in fact modify the string buffer. Following martijn@'s comment for the sed diff, we don't need to check for truncation because the "in" path has already been validated by a preceding open(2). ok? Index:

Non-const basename: usr.bin/sed

2020-10-10 Thread Christian Weisgerber
Changing basename(3) and dirname(3) to the POSIX-mandated non-const parameters produces this warnings when compiling sed(1): /usr/src/usr.bin/sed/main.c:401:16: warning: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qua lifiers]

Non-const basename: usr.bin/patch

2020-10-10 Thread Christian Weisgerber
Changing basename(3) and dirname(3) to the POSIX-mandated non-const parameters produces these warnings when compiling patch(1): /usr/src/usr.bin/patch/backupfile.c:61:34: warning: passing 'const char *' to pa rameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-disca

Re: ssh-keygen: generate ed25519 keys by default

2020-10-08 Thread Christian Weisgerber
On 2020-10-08, Eldritch wrote: > With the recent change to prefer ed25519 keys on the server side [1] > (unless I misunderstood what the change does), I think generating This only changed the client's order of preference for the various server key types. If a server doesn't offer an Ed25519

Re: basename(3) should have non-const arg, says POSIX

2020-09-12 Thread Christian Weisgerber
Todd C. Miller: > This is probably the right thing to do but we should fix the warnings > it generates. In this new world order, passing a const char * to > basename() or dirname() is unsafe. FWIW, here's the list: /usr/src/lib/libkvm/kvm.c:684:16: warning: passing 'const char *' to parameter

basename(3) should have non-const arg, says POSIX

2020-09-12 Thread Christian Weisgerber
Our basename(3) and dirname(3) take a const argument: char*basename(const char *); char*dirname(const char *); POSIX says otherwise... char *basename(char *path); char *dirname(char *path); ... and explicitly says the functions may modify the input string. Our functions were

Format string check for dprintf(3)

2020-09-10 Thread Christian Weisgerber
Add format string checking annotations for dprintf(3) and vdprintf(3). This was apparently forgotten when the functions were added. It is required so the compiler can warn t.c:25:25: warning: format string is not a string literal (potentially insecure) [-Wformat-security]

Re: timekeep: fixing large skews on amd64 with RDTSCP

2020-08-23 Thread Christian Weisgerber
Scott Cheloha: > This "it might slow down the network stack" thing keeps coming up, and > yet nobody can point to (a) who expressed this concern or (b) what the > penalty is in practice. It was kettenis@ who simply raised the question and asked for comments from the network people. I think we

Re: man find -exec -- a little bit more hand-holding

2020-08-14 Thread Christian Weisgerber
On 2020-08-14, Jason McIntyre wrote: > - i cannot work out what is with the \! examples. i know we try to make > entries work for both csh and sh style shells, but stuff like this > works without escaping: > > $ find . ! -type f Going through the CVS and SCCS history, I see that the

mountd: Avoid reading one byte before buffer

2020-08-06 Thread Christian Weisgerber
>From CheriBSD, via FreeBSD: | Avoid reading one byte before the path buffer. | | This happens when there's only one component (e.g. "/foo"). This | (mostly-harmless) bug has been present since June 1990 when it was | commited to mountd.c SCCS version 5.9. | | Note: the bug is on the second

Re: timekeep: fixing large skews on amd64 with RDTSCP

2020-07-27 Thread Christian Weisgerber
Scott Cheloha: > --- lib/libc/arch/amd64/gen/usertc.c 8 Jul 2020 09:17:48 - 1.2 > +++ lib/libc/arch/amd64/gen/usertc.c 25 Jul 2020 17:50:38 - > @@ -21,9 +21,12 @@ > static inline u_int > rdtsc(void) > { > - uint32_t hi, lo; > - asm volatile("rdtsc" : "=a"(lo),

Re: timekeep: fixing large skews on amd64 with RDTSCP

2020-07-16 Thread Christian Weisgerber
Scott Cheloha: > Can we add the missing LFENCE instructions to userspace and the > kernel? And can we excise the upper 32 bits? > + uint32_t lo; > + > + asm volatile("lfence"); > + asm volatile("rdtsc" : "=a"(lo)); That's wrong. rtdsc will clobber %rdx, whether you use that value

Re: armv7: tweak timercounter mask

2020-07-12 Thread Christian Weisgerber
Mark Kettenis: > > There is the strong suspicion that the 0x7fff mask in the various > > armv7 timecounters was simply copied from powerpc, and that these really > > are full 32-bit counters. > > > > I wanted to verify this from the data sheets, but I'm insufficiently > > familiar with the

Re: powerpc(64): tweak timecounter mask

2020-07-12 Thread Christian Weisgerber
Mark Kettenis: > > Date: Sun, 12 Jul 2020 18:12:39 +0200 > > From: Christian Weisgerber > > > > The PowerPC/Power ISA Time Base is a 64-bit register. We can use > > the full lower 32 bits. > > > > OK? > > Sure, but this needs to be coordinated

armv7: tweak timercounter mask

2020-07-12 Thread Christian Weisgerber
There is the strong suspicion that the 0x7fff mask in the various armv7 timecounters was simply copied from powerpc, and that these really are full 32-bit counters. I wanted to verify this from the data sheets, but I'm insufficiently familiar with the ARM ecosystem to locate those. Back in

Re: powerpc(64): tweak timecounter mask

2020-07-12 Thread Christian Weisgerber
Christian Weisgerber: > - tb_get_timecount, NULL, 0x7fff, 0, "tb", 0, NULL, 0 > + tb_get_timecount, NULL, 0x, 0, "tb", 0, NULL, 0 PS: Do we prefer ~0u over 0x? -- Christian "naddy" Weisgerber na...@mips.inka.de

powerpc(64): tweak timecounter mask

2020-07-12 Thread Christian Weisgerber
The PowerPC/Power ISA Time Base is a 64-bit register. We can use the full lower 32 bits. OK? Index: arch/macppc/macppc/clock.c === RCS file: /cvs/src/sys/arch/macppc/macppc/clock.c,v retrieving revision 1.44 diff -u -p -r1.44

  1   2   3   4   5   6   >