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

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

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

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

user tc for alpha

2020-07-07 Thread Christian Weisgerber
Userland gettime support for alpha. Alas, completely untested since I don't have access to that arch. Index: lib/libc/arch/alpha/gen/usertc.c === RCS file: /cvs/src/lib/libc/arch/alpha/gen/usertc.c,v retrieving revision 1.1 diff -u

Re: arm64 usertc

2020-07-11 Thread Christian Weisgerber
Mark Kettenis: > Nevertheless, here is a different take on the problem. Since the > timecounter only uses the low 32 bits we don't need the double read. > This version also changes the timecounter mask from 0x7fff to > 0x. That must be ok, since the counter has 64 bits and we are >

Re: improve pkg_add bandwidth usage with some mirrors

2020-06-19 Thread Christian Weisgerber
On 2020-06-18, Marc Espie wrote: > What pkg_add does internally is a pipeline: > > ftp | signify|internal gunzip > > closing the end file handle should kill the whole chain. > So I need to figure out where it goes wrong, what's the > part that doesn't die "instantly". That's ftp(1). Our SSL

Re: ffs(3): libc arch versions, regress

2020-06-25 Thread Christian Weisgerber
20:31:19 - @@ -0,0 +1,18 @@ +/* $OpenBSD$ */ +/* + * Written by Christian Weisgerber . + * Public domain. + */ + +#include "DEFS.h" + +ENTRY(ffs) + RETGUARD_SETUP(ffs, x15) + rbitw1, w0 + clz w1, w1 + cmp w0, wzr + csinc w0, w

RIP, freedb (cddb service)

2020-06-24 Thread Christian Weisgerber
The freedb.org CD track database is dead. Its shutdown had already been announced for March, and it finally disappeared. gnudb.org, whoever they are, offers the last working alternative that still supports the CDDB protocol. Actually, the port was dead yesterday, but they fixed it today. I

Re: powerpc64: 64-bit-ize memmove.S

2020-06-26 Thread Christian Weisgerber
Christian Weisgerber: > Well, I suggested it, so here's my attempt to switch powerpc64's > libc memmove.S over to 64 bits: Actually, on second thought: That function simply copies as many (double)words plus a tail of bytes as the length argument specifies. Neither source nor desti

powerpc64: 64-bit-ize memmove.S

2020-06-26 Thread Christian Weisgerber
Well, I suggested it, so here's my attempt to switch powerpc64's libc memmove.S over to 64 bits: * Treat length parameter as 64 bits (size_t) instead of 32 (u_int). * Set up the main loop to copy 64-bit doublewords instead of 32-bit words. This definitely needs double and triple checking.

Re: userland clock_gettime proof of concept

2020-06-14 Thread Christian Weisgerber
George Koehler: > --- lib/libc/arch/powerpc/gen/usertc.c.before Sat Jun 13 21:28:50 2020 > +++ lib/libc/arch/powerpc/gen/usertc.cSat Jun 13 21:38:52 2020 > @@ -18,4 +18,19 @@ > #include > #include > > -int (*const _tc_get_timecount)(struct timekeep *, uint64_t *) = NULL; > +int >

Re: userland clock_gettime proof of concept

2020-06-19 Thread Christian Weisgerber
On 2020-06-19, Mark Kettenis wrote: > I'm talking about *skew*, not drift. If there is a significant drift > you already knock out the TSC. > > What's needed is: > > 1. A bit of research of what an acceptable skew is. My hypothesis is >that on many machines with a single socket the TSCs

Re: userland clock_gettime proof of concept

2020-06-21 Thread Christian Weisgerber
Paul Irofti: > This also handles negative skew values that my prevoius diff did not. > --- sys/arch/amd64/amd64/tsc.c > +++ sys/arch/amd64/amd64/tsc.c > @@ -216,6 +217,8 @@ tsc_get_timecount(struct timecounter *tc) > void > tsc_timecounter_init(struct cpu_info *ci, uint64_t cpufreq) > { > +

Re: userland clock_gettime proof of concept

2020-06-21 Thread Christian Weisgerber
Paul Irofti: > > b) Revert _timekeep init (breaks naddy@'s machine) > > Robert helped properly track down this issue to a silly null-ref. If that was indeed the problem... > --- lib/libc/dlfcn/init.c > +++ lib/libc/dlfcn/init.c > @@ -105,6 +107,14 @@ _libc_preinit(int argc, char **argv, char

Re: userland clock_gettime proof of concept

2020-06-21 Thread Christian Weisgerber
Paul Irofti: [Unrelated, just to mark where we're at] > Right. Just reproduced it here. This moves the check at the top so that > each CPU checks its own skew and disables tc_user if necessary. I tweaked the patch locally to make _timekeep a visible global symbol in libc. Printing its value has

Re: userland clock_gettime proof of concept

2020-06-21 Thread Christian Weisgerber
Christian Weisgerber: > I tweaked the patch locally to make _timekeep a visible global > symbol in libc. > > Printing its value has revealed two issues: > > * The timekeep page is mapped to the same address for every process. > It changes across reboots, but once running,

Re: userland clock_gettime proof of concept

2020-06-21 Thread Christian Weisgerber
Paul Irofti: > Can't test right now, but if you enable the TSC_DEBUG in cpu.c or if you > put a printf in the CPU_INFO_FOREACH you will probably see the correct > skew values. It's worse: CPU_INFO_FOREACH() only sees cpu0. The others aren't attached yet. -- Christian "naddy" Weisgerber

Re: Retire

2020-06-21 Thread Christian Weisgerber
On 2020-06-20, Christian Weisgerber wrote: >> Well... they something in ports might still look at them in >> >> >> Can someone from ports speak about this? > > I have started an amd64 bulk build without . There were no build failures attributable to t

Re: Retire

2020-06-20 Thread Christian Weisgerber
On 2020-06-19, "Theo de Raadt" wrote: > Well... they something in ports might still look at them in > > Can someone from ports speak about this? I have started an amd64 bulk build without . -- Christian "naddy" Weisgerber na...@mips.inka.de

Re: userland clock_gettime proof of concept

2020-06-20 Thread Christian Weisgerber
On 2020-06-19, Paul Irofti wrote: > I have addressed your comments bellow, except for the CPU skew one. That > code disables TSC for all CPUs, not just for PRIMARY. Would you like to > walk and add code for every CPU to check the drift and then disable the > TSC? It seems a little too much... >

Re: userland clock_gettime proof of concept

2020-06-20 Thread Christian Weisgerber
On 2020-06-20, Christian Weisgerber wrote: > I can't get this revision of the diff to work on amd64: > * patch source > * build and install kernel, reboot > * make build > * reboot -> "Process (pid 1) got signal 11" > > I'm at a loss. As part of the "

Re: userland clock_gettime proof of concept

2020-06-22 Thread Christian Weisgerber
Paul Irofti: > 683 /* map the process's timekeep page */ > 684 if (exec_timekeep_map(pr)) > 685 goto free_pack_abort; > 686 /* setup new registers and do misc. setup. */ > 687 if (pack.ep_emul->e_fixup != NULL) { > 688 if

Re: userland clock_gettime proof of concept

2020-06-22 Thread Christian Weisgerber
Christian Weisgerber: > If I move > > vaddr_t ps_timekeep;/* User pointer to timekeep */ > > up into the zeroed area, I get a properly randomized _timekeep in > userland. Also note that exec_sigcode_map() has this pr->ps_si

Re: libkern: ffs() for arm64, powerpc, powerpc64

2020-06-09 Thread Christian Weisgerber
Mark Kettenis: > Unfortunately that doesn't quite work. At least in my build it > doesn't pick up .c files in the linker/arch directories. > > > Index: lib/libkern/arch/arm64/ffs.c I was certain I had checked this, but indeed it doesn't work. The Makefile rules are generated from

Re: libkern: ffs() for arm64, powerpc, powerpc64

2020-06-10 Thread Christian Weisgerber
/libkern/arch/arm64/ffs.S diff -N lib/libkern/arch/arm64/ffs.S --- /dev/null 1 Jan 1970 00:00:00 - +++ lib/libkern/arch/arm64/ffs.S10 Jun 2020 17:38:50 - @@ -0,0 +1,17 @@ +/* $OpenBSD$ */ +/* + * Written by Christian Weisgerber . + * Public domain. + */ + +#include + +ENTRY(ffs

cpu_rnd_messybits() for arm64

2020-06-05 Thread Christian Weisgerber
Here is a cpu_rnd_messybits() implementation for arm64. It reads the virtual counter and xors it with a bit-reversed copy of itself. The virtual counter is used by the only timecounter implementation used on arm64, so I assume it is generally available. It's a 64-bit counter, which we reduce to

Re: cpu_rnd_messybits() for arm64

2020-06-05 Thread Christian Weisgerber
Mark Kettenis: > > Here is a cpu_rnd_messybits() implementation for arm64. > > It reads the virtual counter and xors it with a bit-reversed copy > > of itself. > > > > The virtual counter is used by the only timecounter implementation > > used on arm64, so I assume it is generally available. > >

Re: powerpc64: ldbrx/stdbrx for endian.h?

2020-06-08 Thread Christian Weisgerber
David Gwynne: > > Starting with POWER7 (Power ISA v.2.06), there are also corresponding > > 64-bit instructions. Do we want to use those on powerpc64? Or do > > we want to keep compatibility with older processors? > > I'm ok with using the instructions. I can't think of what benefit compat in

Re: powerpc64: ldbrx/stdbrx for endian.h?

2020-06-08 Thread Christian Weisgerber
On 2020-06-08, Christian Weisgerber wrote: >> Did they also happen to add opcodes for doing swaps in registers? > > No. > (I haven't looked at the vector instructions yet.) PS: There's a vector permutate instruction, but AFAICT there is no way to move data between general pur

powerpc64: ldbrx/stdbrx for endian.h?

2020-06-08 Thread Christian Weisgerber
powerpc has byte-swapping 16 and 32-bit load/stores and we use those in . Starting with POWER7 (Power ISA v.2.06), there are also corresponding 64-bit instructions. Do we want to use those on powerpc64? Or do we want to keep compatibility with older processors? Index:

Re: libkern: ffs() for arm64

2020-06-08 Thread Christian Weisgerber
On 2020-06-08, Christian Weisgerber wrote: > More archs to come... Style question: Since this mostly comes down to embedding a single special instruction in between normal C operations, I wonder whether I should just do .c with asm() instead of .S, and leave all the boilerplate to the compi

libkern: ffs() for arm64

2020-06-08 Thread Christian Weisgerber
$ */ +/* + * Written by Christian Weisgerber . + * Public domain. + */ + +#include + +ENTRY(ffs) + RETGUARD_SETUP(ffs, x15) + rbitw1, w0 + clz w1, w1 + cmp w0, #0 + csinc w0, wzr, w1, eq + RETGUARD_CHECK(ffs, x15) + ret +END(ffs) -- Christian

ffs(3): libc arch versions, regress

2020-06-09 Thread Christian Weisgerber
-N lib/libc/arch/aarch64/string/ffs.c --- /dev/null 1 Jan 1970 00:00:00 - +++ lib/libc/arch/aarch64/string/ffs.c 9 Jun 2020 19:54:21 - @@ -0,0 +1,15 @@ +/* $OpenBSD$ */ +/* + * Written by Christian Weisgerber . + * Public domain. + */ + +#include + +int +ffs(int x) +{ + x = x

Re: libkern: ffs() for arm64, powerpc, powerpc64

2020-06-09 Thread Christian Weisgerber
On 2020-06-09, Christian Weisgerber wrote: > Here are optimized ffs(3) implementations for > * arm64 (superseding the earlier ffs.S) > * powerpc > * powerpc64 > +int ffs(int x) Oops, I'm going to change that to int ffs(int x) before commit. -- Christian &qu

cpu_rnd_messybits() for alpha, powerpc, sparc64

2020-06-04 Thread Christian Weisgerber
Here's a proposal for implementing cpu_rnd_messybits() as a read of the cycle counter on alpha, powerpc, and sparc64. Since I don't have those archs, the diff is not even compile-tested. * alpha: RPCC is a 32-bit counter (in a 64-bit register) * powerpc: TB is a 64-bit counter split into two

Re: userland clock_gettime proof of concept

2020-06-10 Thread Christian Weisgerber
Paul Irofti: > This iteration of the diff adds bounds checking for tk_user and moves > the usertc.c stub to every arch in libc as recommanded by deraadt@. > It also fixes a gettimeofday issue reported by cheloha@ and tb@. Additionally, it changes struct timekeep in an incompatible way. ;-) A

Re: userland clock_gettime proof of concept

2020-06-11 Thread Christian Weisgerber
Christian Weisgerber: > Should we already bump major while the diff matures? Oh, we can't quite bump yet. tk_major und tk_minor are only set in exec_timekeep_map(), but aren't checked anywhere. + timekeep->tk_major = 0; + timekeep->tk_minor = 0; Those

Re: userland clock_gettime proof of concept

2020-06-11 Thread Christian Weisgerber
Paul Irofti: > > Additionally, it changes struct timekeep in an incompatible way. ;-) > > A userland built before the addition of tk_nclocks is very unhappy > > with a kernel built afterwards. > > I have not seen this problem and have not built a snapshot to update or go > back. What do you mean

Re: userland clock_gettime proof of concept

2020-06-11 Thread Christian Weisgerber
Paul Irofti: > > Paul, that tk_nclocks addition isn't useful. You need to do the > > bounds checking against the number of clocks you have implemented in > > libc. How many clocks the kernel has implemented doesn't matter. > > What you are saying is that we could be in a situation where the

Re: userland clock_gettime proof of concept

2020-06-11 Thread Christian Weisgerber
Paul Irofti: [lib/libc/arch/*/gen/usertc.c] > +int (*const _tc_get_timecount)(struct timekeep *, uint64_t *) = NULL; [lib/libc/sys/microtime.c] > +static inline int > +tc_delta(struct timekeep *tk, u_int *delta) > +{ > + uint64_t tc; > + if (delta == NULL || _tc_get_timecount(tk, ))

Re: userland clock_gettime proof of concept

2020-06-11 Thread Christian Weisgerber
Theo de Raadt: > The diff is growing complexity to support a future which wouldn't > exist if attempts at *supporting all* architectures received priority. Adding support for more archs is very simple, since you just need to copy the corresponding get_timecounter function from the kernel.

Re: userland clock_gettime proof of concept

2020-06-10 Thread Christian Weisgerber
Paul Irofti: > > This iteration of the diff adds bounds checking for tk_user and moves > > the usertc.c stub to every arch in libc as recommanded by deraadt@. > > It also fixes a gettimeofday issue reported by cheloha@ and tb@. > > Forgot to add armv7 tk_nclock entries. Noticed by benno@,

Re: ffs(3): libc arch versions, regress

2020-06-12 Thread Christian Weisgerber
Christian Weisgerber: > This adds the optimized ffs(3) versions on aarch64 and powerpc to > libc, for completeness' sake. > > Also add a brief regression test. > > OK? Index: lib/libc/arch/aarch64/string/Makefile.inc ==

cpu_rnd_messybits() for hppa

2020-06-12 Thread Christian Weisgerber
Here's a cpu_rnd_messybits() for hppa. This just steals from itmr_get_timecount(). If we want to use the mfctl() macro, we need to include into cpu.h. I don't know if we want that, so I went with the explicit asm() instead. Completely untested. Index: sys/arch/hppa/hppa/machdep.c

Re: symmetric toeplitz hashing

2020-06-13 Thread Christian Weisgerber
On 2020-06-13, Theo Buehler wrote: > Others have pointed out off-list that one can use __builtin_popcount(), > but __builtin_parity() is exactly what I want. Is it available on all > architectures? The standard implementation will be perfectly fine, no need to resort to magic compiler

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: 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: 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

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

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 - >

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: 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: 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

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: 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: 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') { > > -

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

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 +++

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: 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: 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

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-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

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: 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

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: 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-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

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: 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

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: 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

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: 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

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: 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

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-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: 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: 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

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 ---

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

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

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/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/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

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

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 ---

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

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

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

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

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

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

<    1   2   3   4   5   6   >