Re: enhancing i386 mbr.S

2010-02-20 Thread Ted Unangst
On Sat, Feb 20, 2010 at 3:33 PM, Giuseppe Magnotta wrote: > In the (strange) case you have many bootable partition do you think is > safe to boot in the first active one? > > If your answer is yes, please find attached a new patch that in case > there are many bootable partition then print on scre

Re: Patch for boot for enabling gate A20 with BIOS

2010-03-01 Thread Ted Unangst
On Mon, Mar 1, 2010 at 10:15 AM, Giuseppe Magnotta wrote: > Sorry, > > it seems that the patch was not included in my last email. > > Here is the patch: > > Index: gateA20.c Can you explain this? I'd think A20 issues would have been sorted out 15 years ago.

Re: mistake in fsck_ffs.8

2010-03-03 Thread Ted Unangst
On Wed, Mar 3, 2010 at 8:50 AM, Jason McIntyre wrote: >> Which is more correct "filesystems" or "file systems" ? >> > > well, it is not really a question of which is correct, since both are. > more like, which do you want to use... our man pages use both about > equally. At one point I made an ef

Re: uvm_map improvements

2010-03-04 Thread Ted Unangst
On Thu, Mar 4, 2010 at 11:39 AM, Anton Maksimenkov wrote: > Since I not found any support of that idea I think it is better to > keep things simple. So I introduce implementation of the "ReScan" > idea. Independent of any technical merits, I think this has more to do with release timing and avail

Re: suggested patch to httpd.conf in base

2010-03-12 Thread Ted Unangst
On Fri, Mar 12, 2010 at 3:28 PM, wrote: >> Very good suggestion, indeed. >> >> Especially, if someone has a 'dangerous' file, a PHP Shell for instance, >> (a perfect example: >> http://mgeisler.net/downloads/phpshell/phpshell-1.7.tar.gz) >> inside such a directory. (Or even maybe a simple file u

Re: The Design and Implementation of the 4.4BSD and the OpenBSD source code

2010-03-22 Thread Ted Unangst
On Mon, Mar 22, 2010 at 1:20 PM, Alicornio wrote: > 3- In the 4.4 book the kenel is said to have 2 parts, top half > and botton half, and queues between then. "Where are" these > things (hardclock(), softclock(), hardware ints handlers, hardware > traps handlers, queues, etc) in the souce tree? Ho

greo -o flag

2010-03-24 Thread Ted Unangst
Turns out we have an -o option, but it doesn't do what most people expect. That's a problem with nonstandard options, and we were probably lax in asserting that we really wanted these options when importing. oops. Anyway, the GNU -o option seems a lot more useful than ours. They call this o

Re: greo -o flag

2010-03-24 Thread Ted Unangst
On Wed, Mar 24, 2010 at 10:06 PM, Philip Guenther wrote: > Let's think about what you're proposing: "we added -o as an extension, > but now we want a *different* -o, so let's shuffle the extensions > (breaking anything using them) so that people can depend on a > different extension" This doesn't

Re: Doubt about an integer overflow in cut.c

2010-03-26 Thread Ted Unangst
If len + 1 == 0, that means the string is every byte but one, meaning there wouldn't be enough space for len and the string to coexist. On Mar 26, 2010, at 5:18 AM, Amarendra Godbole > wrote: cut.c has the following: [...] void f_cut(FILE *fp, char *fname) { int ch, field, isdelim; ch

cleanup grep options

2010-04-01 Thread Ted Unangst
There are 3 sets of options in the greposphere. Some are defined by posix. Some are extensions defined by gnu. And then there's a few others that show up in our grep. This diff removes some of the entries in the last set. For the most part, our grep tries to be compatible with the defacto g

proc.h and dev/pci

2010-04-01 Thread Ted Unangst
What does sys/proc.h have to do with dev/pci? The answer should probably be not much, but in reality is closer to quite a bit. As part of the ongoing rthreads work, I'm making some changes to internal fields of struct proc. These fields are only accessed by files under kern. Why then, I wond

Re: [patch] libc: wordexp support

2010-04-06 Thread Ted Unangst
On Tue, Apr 6, 2010 at 1:53 AM, Matthew Haub wrote: > This patch adds support for wordexp(3) and wordfree(3) to libc. These > functions conform to IEEE Std 1003.1-2001 (POSIX). The implementation > comes from NetBSD and uses a shell builtin, "wordexp", to perform the > expansion in line with the m

strptime.3

2010-04-09 Thread Ted Unangst
strptime reads strings, it doesn't write them. Index: strptime.3 === RCS file: /home/tedu/cvs/src/lib/libc/time/strptime.3,v retrieving revision 1.12 diff -u -r1.12 strptime.3 --- strptime.3 19 Oct 2008 11:50:35 - 1.12 +++ s

ifconfig.8 trunk section

2010-04-10 Thread Ted Unangst
Quite a bit of redundant text here, this makes it cleaner I think. Index: ifconfig.8 === RCS file: /home/tedu/cvs/src/sbin/ifconfig/ifconfig.8,v retrieving revision 1.192 diff -u -r1.192 ifconfig.8 --- ifconfig.8 23 Nov 2009 19:58:10

systrace vs realapth

2010-04-10 Thread Ted Unangst
systrace uses realpath to find the files it wants to allow/deny. But in doing so, it changes the filenames, sometimes creating valid names out of invalid names. In particular, realpath strips trailing slashes, and some syscalls aren't supposed to work on such filenames. When using systrace,

Re: ifconfig.8 trunk section

2010-04-10 Thread Ted Unangst
On Sat, 10 Apr 2010, Ted Unangst wrote: > Quite a bit of redundant text here, this makes it cleaner I think. jmc wants more changes, jmc gets more changes :) Index: ifconfig.8 === RCS file: /home/tedu/cvs/src/sbin/ifcon

Re: ifconfig.8 trunk section

2010-04-10 Thread Ted Unangst
On Sun, Apr 11, 2010 at 2:34 AM, Ted Unangst wrote: > On Sat, 10 Apr 2010, Ted Unangst wrote: > >> Quite a bit of redundant text here, this makes it cleaner I think. > > @@ -1473,16 +1436,11 @@ > To change the association to another physical interface, the existing > ass

more ifconfig.8 tweaks

2010-04-11 Thread Ted Unangst
I took a few more editorial liberties here, but on the whole I don't think we need to spell out "IEEE 802.11-based wireless network interfaces" every time we're talking about one. Index: ifconfig.8 === RCS file: /cvs/src/sbin/ifconf

Re: more ifconfig.8 tweaks

2010-04-11 Thread Ted Unangst
On Sun, Apr 11, 2010 at 2:00 PM, Jason McIntyre wrote: > On Sun, Apr 11, 2010 at 01:36:35PM -0400, Ted Unangst wrote: >> I took a few more editorial liberties here, but on the whole I don't think >> we need to spell out "IEEE 802.11-based wireless network interfaces&quo

Re: rthreads vs pthreads performance test

2010-04-13 Thread Ted Unangst
On Tue, Apr 13, 2010 at 4:33 AM, Jung wrote: > rthreads vs pthreads performance test > > at today, i did test recent rthreads performance. > previous e-mail http://marc.info/?l=openbsd-tech&m=120634514721997 > rthreads performance was poor. but recent rthreads performance good like > below. > > s

kernel include cleanup

2010-04-18 Thread Ted Unangst
uvm_map.h included proc.h for two functions which are now in systm.h. So you think it would be an easy change to remove proc.h. hahahaha. Turns out sysctl.h depends on proc.h (and includes it ifndef _KERNEL bizarrely enough), but unconditionally picks up uvm_map.h, so nobody in the kernel eve

Re: REPLACE_GETOPT in src/lib/libc/stdlib/getopt_long.c

2010-04-22 Thread Ted Unangst
On Thu, Apr 22, 2010 at 11:35 AM, Hyjial Irldar wrote: > --- getopt_long.c B B B 31 Oct 2007 12:34:57 - B B B 1.23 > +++ getopt_long.c B B B 21 Apr 2010 16:02:26 - > @@ -55,15 +55,11 @@ > B #include > B #include > > -#define B B B B REPLACE_GETOPT B B B B B /* use this get

Re: some cleanup of of uvm_map.c

2010-04-22 Thread Ted Unangst
On Thu, Apr 22, 2010 at 11:56 PM, Anton Maksimenkov wrote: > So, can I remind this simple cleanup? Thanks, applied, but next time watch the tabs vs spaces when mailing a diff. > 2010/1/31 Anton Maksimenkov : >> Here is some cleanup of uvm_map.c code.

Re: ifconfig.8 trunk section

2010-04-23 Thread Ted Unangst
On Fri, Apr 23, 2010 at 1:34 PM, J.C. Roberts wrote: > Personally, I favor brevity to avoid the issue entirely. > > The most important question is, if nit-pickery like this even matters? I really think not. We pick a or an and live with it. I think your contortions to avoid the choice impair th

Re: [patch] vis(3): NUL terminate -> NUL-terminate

2010-04-23 Thread Ted Unangst
On Fri, Apr 23, 2010 at 2:20 PM, Jason McIntyre wrote: > On Fri, Apr 23, 2010 at 06:53:41PM +0200, Joachim Schipper wrote: >> I noticed that vis(3) talks about "NUL terminated" strings, whereas >> almost other sources (including e.g. strlcat(3), strtok(3), strpbrk(3)) >> talk about "NUL-terminated

enable ufs dirhash mtx

2010-04-23 Thread Ted Unangst
The ufs dirhash code has been mutex ready since introduction. Index: dirhash.h === RCS file: /home/tedu/cvs/src/sys/ufs/ufs/dirhash.h,v retrieving revision 1.4 diff -u -r1.4 dirhash.h --- dirhash.h 29 Apr 2006 23:09:45 - 1.

Re: diff to add posix_madvise().

2010-04-24 Thread Ted Unangst
On Sat, Apr 24, 2010 at 4:33 PM, Brad wrote: >> 4) implement posix_madvise() as a call to _thread_sys_madvise() >>instead of madvise() > > Why this last one? If a program implements its own madvise, calling posix_madvise should do the right thing (not call the program's version). I'll look c

Re: diffs that matter (or not)

2010-05-06 Thread Ted Unangst
On Thu, May 6, 2010 at 4:42 AM, Thomas Pfaff wrote: > Sometimes I'm reading code from the source tree and then stumble upon > various things that I'm wondering if it's worth "fixing". These are > not real bugs, which is the numero uno priority, but I'm wondering if > anyone care about these thing

Re: Why do thread locking for arc4random*()?

2010-05-06 Thread Ted Unangst
On Thu, May 6, 2010 at 10:15 AM, Otto Moerbeek wrote: > On Thu, May 06, 2010 at 06:02:48PM +0400, Vadim Jukov wrote: > >> Hello, tech@'s. >> >> Possibly this question is stupid, but I cannot understand - why do >> thread locking for arc4random*() functions instead of just maintaining >> their data

move klist to process

2010-05-17 Thread Ted Unangst
This moves the knote list to struct process for better process semantics with rthreads. It should have little noticeable effect otherwise, but I've been wrong about simpler diffs before Index: sys/proc.h === RCS file: /home/te

Re: triggering disk boot from ramdisk kernel

2010-05-24 Thread Ted Unangst
On Mon, May 24, 2010 at 12:58 PM, Nick Bender wrote: > I'm working on a new version of the fully automated installation routine > that I had developed for 4.4. One problem that people have identified > using a PXE based install is that it's possible to get in a loop where > you PXE boot and do the

Re: pxeboot hd0a:/bsd tries to nfs_boot...

2010-06-28 Thread Ted Unangst
You can build a kernel that knows where root is. man config On Mon, Jun 28, 2010 at 3:52 PM, Nick Bender wrote: > Hi All, > > First the problem. Once a machine is automatically installed we want to > change things so that it will boot from the hard drive. We have two > possibilities. > > The fir

kernel cpu perf tuning

2010-06-29 Thread Ted Unangst
The current situation where apmd monitors system load and adjusts the hw.setperf sysctl has a number of flaws. While it's nice to keep the policy outside the kernel and allow tuning, the polling interval is too slow to be responsive. More aggressive polling intervals and we end up affecting t

better cpu throttling

2010-06-30 Thread Ted Unangst
I like this one better. Slow down the poll interval just a little so it's not so hysterical, but also go straight to 100. If you need CPU, you need CPU. It still backs down slowly, but that's just to prevent getting caught in slow mode again. It also pays attention to per-core load, much be

Re: better cpu throttling

2010-06-30 Thread Ted Unangst
On Wed, Jun 30, 2010 at 3:23 PM, Luis Henriques wrote: > Probably, a silly question, but here it goes: > > With this patch, I will not be able to set the perflevel to, say, 50% and > keep the system using that performance level forever. Is this correct? > I guess that with current apmd we are abl

Re: [resend] Please test this ACPI panic check diff

2010-07-01 Thread Ted Unangst
On Thu, Jul 1, 2010 at 2:53 PM, Jordan Hargrave wrote: > Index: dev/acpi/acpi.c > === > RCS file: /cvs/src/sys/dev/acpi/acpi.c,v > retrieving revision 1.169 > diff -u -p -u -p -b -r1.169 acpi.c > --- dev/acpi/acpi.c 1 Jul 2010 16:

cvsinfo

2010-07-12 Thread Ted Unangst
To help investigate some changes recently, I wrote a tool that will extract (reverse) patches from cvs. I was telling a coworker about this today, and he said it was a lot like cvsps. Maybe it is, but cvsps chokes big time trying to import our tree. Running it just in sys/dev for testing pri

Re: utmpx for OpenBSD

2010-07-13 Thread Ted Unangst
On Tue, Jul 13, 2010 at 9:45 AM, Ed Schouten wrote: > I sent an email to tedu@ the other day, but I thought it may be better > to just send it to tech@ to see whether we can sort this out. Don't worry, I have not ignored your mail, only postponed processing it. > - Is there any interest in getti

Re: Adding support for Camellia on OpenSSH.

2010-07-17 Thread Ted Unangst
In general, "other people do it" is a weak justification. I don't see any reason to believe camellia would actually be better than aes. Nessie picked aes too, you know. Not to mention there are software patent claims againt camellia. That's a no go right there. On Jul 17, 2010, at 7:12 PM

Re: Adding support for Camellia on OpenSSH.

2010-07-19 Thread Ted Unangst
On Sun, Jul 18, 2010 at 11:14 AM, Yoshisato YANAGISAWA wrote: >> Not to mention there are software patent claims againt camellia. That's >> a no go right there. > > OpenBSD has already included Camellia source code as a part of OpenSSL. It > is disabled by default, though. > At the time OpenSSL i

Re: Adding support for Camellia on OpenSSH.

2010-07-19 Thread Ted Unangst
On Mon, Jul 19, 2010 at 8:22 PM, Joerg Sonnenberger wrote: > On Mon, Jul 19, 2010 at 06:37:21PM -0400, STeve Andre' wrote: >> On Monday 19 July 2010 18:26:15 Ted Unangst wrote: >> > Free software you can't modify is not free software. > > Algorithm != impleme

Re: Adding support for Camellia on OpenSSH.

2010-07-19 Thread Ted Unangst
On Mon, Jul 19, 2010 at 9:06 PM, Joerg Sonnenberger wrote: > On Mon, Jul 19, 2010 at 09:02:35PM -0400, Ted Unangst wrote: >> On Mon, Jul 19, 2010 at 8:22 PM, Joerg Sonnenberger >> > Side note: the complain is also pointless because a modified algorithm >> > would

small mount_mfs nit

2010-07-22 Thread Ted Unangst
There's no reason mount_mfs can't handle force mounts. Without this, -f just prints a silly warning. Index: newfs.c === RCS file: /home/tedu/cvs/src/sbin/newfs/newfs.c,v retrieving revision 1.86 diff -u -r1.86 newfs.c --- newfs.c

Re: [PATCH] change exit status of env(1)

2010-07-22 Thread Ted Unangst
On Thu, Jul 22, 2010 at 6:52 PM, Daniel Dickman wrote: > sure. let me try. the problem is that right now i think env on OpenBSD > can return 4 ambiguous values: 0, 1, 126, 127. if any of these values > are returned i don't think it's possible to know if the value was > returned from env itself or

Re: Building on i386 with DESTDIR

2010-08-01 Thread Ted Unangst
On Sun, Aug 1, 2010 at 11:55 PM, Theo de Raadt wrote: >> 4) An additional header required for gscpm(4): >> >> Index: sys/arch/i386/pci/gscpm.c >> === >> RCS file: /cvs/src/sys/arch/i386/pci/gscpm.c,v >> retrieving revision 1.6 >> diff

nicer disklabel -p

2010-08-07 Thread Ted Unangst
1. accept capital letters too, like the interactive -E command does. 2. usage() is not the most appropriate error response. be more helpful. Index: disklabel.c === RCS file: /home/tedu/cvs/src/sbin/disklabel/disklabel.c,v retrievin

minor disklabel cleanup

2010-08-11 Thread Ted Unangst
Noticed this on a previous commit, just before lock. Index: disklabel.c === RCS file: /cvs/src/sbin/disklabel/disklabel.c,v retrieving revision 1.170 diff -u -r1.170 disklabel.c --- disklabel.c 8 Aug 2010 05:24:46 - 1.170 ++

ntfs cleanup

2010-08-11 Thread Ted Unangst
clean up some chunks of the baboon code in here. as a bonus, it fixes an off by one error in a string copy. yes, a fucking off by one string termination bug in 2010. otherwise, i don't think this changes any behavior. Index: ntfs.h

ntfs simpler

2010-08-11 Thread Ted Unangst
no need for quite so many shenanigans for something as simple as a lookup table. can anybody guess why it was multiplying by 256 twice? also, fun fact: you don't need to initialize static data to 0. that's what compilers are for. Index: ntfs_ihash.c ===

small talk cleanup

2010-08-11 Thread Ted Unangst
nothing major, just some fluff here and there. Index: ctl.c === RCS file: /home/tedu/cvs/src/usr.bin/talk/ctl.c,v retrieving revision 1.11 diff -u -r1.11 ctl.c --- ctl.c 27 Oct 2009 23:59:44 - 1.11 +++ ctl.c 12 Au

cleanup portmap

2010-08-12 Thread Ted Unangst
little bits to make things better. mostly style. things of note are checking return value of chdir and changing a loop bound to be more clear. unfortunately, rpc xdr code still uses char * as a generic pointer type, and I'm not sure if this code really wants long instead of int, or why. Index

Re: RLIMIT_AS missing

2010-08-15 Thread Ted Unangst
On Sun, Aug 15, 2010 at 12:55 PM, Philippe Meunier wrote: > Hello, > > I just tried to compile some software on OpenBSD and it failed because > OpenBSD does not provide RLIMIT_AS: > http://www.openbsd.org/cgi-bin/cvsweb/src/sys/sys/resource.h?rev=1.8;content- type=text%2Fplain > even though RLIMIT

Re: Add timeout_add_abstv(9)

2010-08-20 Thread Ted Unangst
On Fri, Aug 20, 2010 at 8:09 AM, Matthew Dempsky wrote: > This diff adds timeout_add_abstv(9), which adds a timeout scheduled at > an absolute time in the future, and changes several obvious call sites > accordingly. Also, it fixes the timeout(9) prototypes for the other > timeout_*() functions t

misc. ctl parser.c cleanup

2010-08-22 Thread Ted Unangst
I think this is slightly better, though there isn't much functional change. This code certainly gets around... Index: dvmrpctl/parser.c === RCS file: /home/tedu/cvs/src/usr.sbin/dvmrpctl/parser.c,v retrieving revision 1.4 diff -u -r

Re: end the VOP experiment

2010-08-27 Thread Ted Unangst
On Fri, Aug 27, 2010 at 4:54 AM, Thordur I Bjornsson wrote: > +/* Global vfs data structures for cd9660. */ > +struct vops cd9660_vops = { > + .vop_default= eopnotsupp, > + .vop_lookup = cd9660_lookup, > + .vop_create = cd9660_create, > + .vop_mknod = cd966

Re: end the VOP experiment

2010-08-27 Thread Ted Unangst
Very good then. Hard to remember what c99 features are supported where. On Aug 27, 2010, at 10:44 AM, Thordur I Bjornsson wrote: On Fri, Aug 27, 2010 at 09:34:30AM -0400, Ted Unangst wrote: On Fri, Aug 27, 2010 at 4:54 AM, Thordur I Bjornsson > wrote: +/* Global vfs data structures

Re: Looking for testers for a simple X test

2010-08-31 Thread Ted Unangst
On Mon, Aug 30, 2010 at 11:56 PM, patrick keshishian wrote: >> Option "UseSIGIO" "false" > dependent and that this option in general should only be used > as a work-around to a bug until fixed. That's what we're doing. But since X is never going to fix the bug, that's a long until.

Re: "generating new host key..."

2010-09-07 Thread Ted Unangst
On Tue, Sep 7, 2010 at 6:47 PM, Alexander Hall wrote: This isn't C. :) > first=1 first=true >first= first=false > [ $first ] || echo $first || echo

Re: "generating new host key..."

2010-09-08 Thread Ted Unangst
On Tue, Sep 7, 2010 at 7:18 PM, Alexander Hall wrote: > $ which true false > /usr/bin/true > /usr/bin/false > > while those should be available to /etc/rc, I'd prefer not using them. -5 points for using which. :) $ whence -v true true is a shell builtin I happen to think that explicit true and

Re: [patch] ls + utf-8 support

2016-01-17 Thread Ted Unangst
Ingo Schwarze wrote: > The old ls(1) also weeded out non-printable bytes, in particular > control codes. The old ls only had this behavior for terminals however. Redirecting to a file or pipe would always output the original bytes.

Re: security(8) mailbox check question

2016-01-23 Thread Ted Unangst
Ingo Schwarze wrote: > the smtpd(8) daemon supports "deliver to maildir" out of the box, > and even though putting the user maildirs below /var/mail/ is not > the default, it's one of many possible and logical choices, and i > see nothing wrong with it. I think the possibility to fill up /var make

Re: bug in fputwc(3) error reporting

2016-01-23 Thread Ted Unangst
Ingo Schwarze wrote: > Consequently, i propose to not revert our fgetwc(3) patch and to > commit this fputwc(3) patch, too, making us agree with FreeBSD, > NetBSD, Dragonfly, SunOS, glibc, and POSIX, even tough nominally > violating the C standard (but in a way that seems less dangerous > than the

Re: Replace less(1)'s stdbool clone with the real McCoy

2016-01-29 Thread Ted Unangst
Ingo Schwarze wrote: > Hi Michael, > > Michael McConville wrote on Fri, Jan 29, 2016 at 11:33:50AM -0500: > > > Does this make sense? > > We usually don't use bool, it is pointless. > > I'd say leave the type as int, just delete the silly macros, > and use 0 and 1 directly. To throw in my vote

Re: domainname(1) - make usage __dead

2016-01-29 Thread Ted Unangst
Gleydson Soares wrote: > -void > +__dead static void > usage(void) > { > (void)fprintf(stderr, "usage: %s [name-of-domain]\n", __progname); do we have a preferred order for these words? i always use static void __dead because i like the real C keywords first, then the annotations to follow

Re: OpenBSD ASLR and the stack

2016-03-22 Thread Ted Unangst
Shawn Webb wrote: > Does OpenBSD's ASLR implementation also randomize the top stack address? > Or is it simply a random gap (top of the stack still at the same > address, but application starts utilizing the stack at a random, but > properly aligned, offset)? The top of the stack, above the random

Re: uvm: shrinking amap kmem consumption

2016-03-22 Thread Ted Unangst
Stefan Kempf wrote: > To reduce these memory requirements, we need three flavors of amaps: > > - Tiny amaps with only one slot store the pointer to the vm_anon in the > amap directly. The two ints are not needed. This was Theo's idea. > > - Small amaps with up to 32 slots need 8 instead of 16 b

Re: Scheduler hack for multi-threaded processes

2016-03-23 Thread Ted Unangst
Mark Kettenis wrote: > So here is a diff that keeps yield() the same and adds the code in the > sched_yield(2) implementation instead. It also changes the logic that > picks the priority to walk the complete threads listand pick the > highest priotity of all the threads. That should be enough to

Re: tcp syn cache random reseed

2016-03-24 Thread Ted Unangst
Alexander Bluhm wrote: > On Sat, Mar 19, 2016 at 10:41:06PM +0100, Alexander Bluhm wrote: > > The drawback is that the the cache lookup has to be done in two syn > > caches when an ACK arrives. > > This can be prevented most of the time. Switch the cache only after > 10 uses. So most of the

Re: [patch] ftpd: unused include

2016-04-06 Thread Ted Unangst
frit...@alokat.org wrote: > Looks like monitor.h doesn't need to be included > in monitor_fdpass.c. > > Mentioned by att...@stalphonsos.com. it's better if the declaration and definition of functions always match.

Re: tidy syscall_mi.h

2016-04-07 Thread Ted Unangst
Michal Mazurek wrote: > Depending on the NOLOCK flag, the KERNEL_LOCK will, or will not be acquired > before calling pledge_syscall(). I therefore conclude that KERNEL_LOCK > is not needed to call pledge_syscall(). > > Also remove the goto. The code is simple enough to avoid it easily. > > I thin

Re: patch: serialize multiple threads calling pledge(2)

2016-04-09 Thread Ted Unangst
Sebastien Marie wrote: > Hi, > > The following diff makes the effect of multiple threads calling > pledge(2) to be serializable. > > It adds a loop (with tsleep(9)) at pledge(2) entrance if another thread > is already inside (due to sleep), changes return to goto statment, and > wakeup other thre

Re: tcpdump man page

2016-04-09 Thread Ted Unangst
Edgar Pettijohn wrote: > The -i flag doesn't appear to do what the man page suggests. Correcting > the source is above my paygrade, but the man page isn't. hmm? what do you think tcpdump does if -i isn't specified? > > Index: tcpdump.8 > =

Re: bufcache KNF

2016-04-11 Thread Ted Unangst
Martin Pieuchot wrote: > ok? > > -int chillbufs(struct > -bufcache *cache, struct bufqueue *queue, int64_t *queuepages); > +int chillbufs(struct bufcache *, struct bufqueue *, int64_t *); fwiw i like names in prototypes, so i know what's going on. i know style says that, but i think the advic

Re: bufcache KNF

2016-04-11 Thread Ted Unangst
Mark Kettenis wrote: > And prototypes with names in public headers are still an issue. I think you misspelled standard. :)

Re: manual section search order

2016-04-12 Thread Ted Unangst
Marc Espie wrote: > Parentheses are okay in urls, so I see no reason why: > > man.openbsd.org/carp(4) > > shouldn't work. There are an astounding number of text to html URL parsers/highlighters that cannot quite handle parentheses. That's not our problem, but instead of trying to boil the ocean,

better rm / diff

2016-04-15 Thread Ted Unangst
I think this is a more reliable way of detecting rm -rf /. Previous effort was reverted due to false positives. Index: rm.c === RCS file: /cvs/src/bin/rm/rm.c,v retrieving revision 1.36 diff -u -p -r1.36 rm.c --- rm.c1 Feb 201

Re: better rm / diff

2016-04-15 Thread Ted Unangst
Todd C. Miller wrote: > On Fri, 15 Apr 2016 14:04:20 -0400, "Ted Unangst" wrote: > > > I think this is a more reliable way of detecting rm -rf /. > > Previous effort was reverted due to false positives. > > I think it makes more sense to just check st_dev and s

Re: anti-ROP mechanism in libc

2016-04-25 Thread Ted Unangst
Theo de Raadt wrote: > + cp -p /usr/lib/$_lib /usr/lib/$_tmplib > + install -o root -g bin -m 0444 $_lib /usr/lib/$_lib && > + rm -f /usr/lib/$_tmplib || > + mv /usr/lib/$_tmplib /usr/lib/$_lib I'm a li

Re: anti-ROP mechanism in libc

2016-04-25 Thread Ted Unangst
Robert Peichaer wrote: > On Mon, Apr 25, 2016 at 10:57:37AM -0400, Ted Unangst wrote: > > Theo de Raadt wrote: > > > + cp -p /usr/lib/$_lib /usr/lib/$_tmplib > > > + install -o root -g bin -m 0444 $_lib /usr/lib/$_lib && > &g

Re: Clearing environ

2016-04-25 Thread Ted Unangst
Jeremie Courreges-Anglas wrote: > > A few ports make use of clearenv(3), a GNU extension. This function was > rejected by POSIX, so what's left? > I think ports should probably use calloc here if we want to push those > patches upstream. But supporting the "environ = NULL" method looks > cheap.

Re: Clearing environ

2016-04-25 Thread Ted Unangst
Todd C. Miller wrote: > On Mon, 25 Apr 2016 22:39:48 +0200, Jeremie Courreges-Anglas wrote: > > > Agreed, I also had this in mind. But then, should the memset call with > > a zero size be avoided? > > > > if (lastenv != environ) > > memcpy(P, environ, cnt * sizeof(char *)); > >

Re: more systrace mop up 2/2: man8.${ARCH}/MAKEDEV.8

2016-04-25 Thread Ted Unangst
Theo Buehler wrote: > Index: share/man/man8//man8.alpha/MAKEDEV.8 please note the comment at the top of these files. they are autogenerated.

Re: doas: adjust yyerror() output

2016-04-25 Thread Ted Unangst
Gleydson Soares wrote: > > I just stumbled over this... > > % doas abc > syntax error at line 1 > % > > I took some secs trying to figure out what was wrong with abc's command > syntax that I typed out. > But bingo, It was happenned due my doas.conf has a syntax error... > Seems that yyerr

Re: doas: adjust yyerror() output

2016-04-26 Thread Ted Unangst
Gleydson Soares wrote: > > what about just printing "doas: "? > > I prefer not hardcoded string, although I've committed as you pointed out, getprogname() doesn't seem any more portable than __progname, which is the classic means of doing this. It's useful in cases where a program may have more t

Re: multi-pool malloc wip diff

2016-04-28 Thread Ted Unangst
Otto Moerbeek wrote: > static void > -ofree(struct dir_info *pool, void *p) > +ofree(struct dir_info *argpool, void *p) > { > + struct dir_info *pool; > struct region_info *r; > size_t sz; > + int i; > > + pool = argpool; > r = find(pool, p); > if (r == NULL)

Re: DMA overruns and iommu's

2016-05-02 Thread Ted Unangst
Mark Kettenis wrote: > It is pretty clear that the DMA engine on the Davicom dc(4) hardware > is broken and will read beyond the end of the buffer that we pass it. > This is bad news for hardware that uses an IOMMU, as it will detect > the DMA overrun and (at least on sparc64) signal an unrecoverab

Re: sqlite c api manpages?

2016-05-02 Thread Ted Unangst
Kristaps Dzonsons wrote: > If you're on OpenBSD, you started with "apropos -s3 sqlite3", were > shocked that there's nothing there, then moved on to Google with a > wounding confusion in your heart. Indeed. I see this didn't get much traction, but it sounds good to me. We are shipping sqlite as a

Re: Return ESRCH instead of zero result for KERN_FILE sysctl

2016-05-02 Thread Ted Unangst
Alexander Bluhm wrote: > > Can we have the same logic for KERN_FILE_BYPID and KERN_FILE_BYUID? I think this should be BYPID only. I'm not sure why. Maybe because a user exists even when the user isn't running any processes. But a process doesn't exist when it doesn't exist.

libcrypto errata

2016-05-03 Thread Ted Unangst
OpenSSL announced several issues today that also affect LibreSSL. - Memory corruption in the ASN.1 encoder (CVE-2016-2108) - Padding oracle in AES-NI CBC MAC check (CVE-2016-2107) - EVP_EncodeUpdate overflow (CVE-2016-2105) - EVP_EncryptUpdate overflow (CVE-2016-2106) - ASN.1 BIO excessive memory

Re: Return ESRCH instead of zero result for KERN_FILE sysctl

2016-05-03 Thread Ted Unangst
Alexander Bluhm wrote: > On Tue, May 03, 2016 at 12:20:34AM -0400, Ted Unangst wrote: > > Alexander Bluhm wrote: > > > > > > Can we have the same logic for KERN_FILE_BYPID and KERN_FILE_BYUID? > > > > I think this should be BYPID only. I'm not sure wh

Re: libcrypto errata

2016-05-03 Thread Ted Unangst
Ted Unangst wrote: > http://ftp.openbsd.org/pub/OpenBSD/patches/5.9/common/005_crypto.patch.sig There is an additional chunk in this diff, for s3_pkt.c, that should have not been included. It adds a memset that will zero a buffer after libssl is done using it to prevent info leaks. As far a

enable shadow only pwd

2016-05-04 Thread Ted Unangst
i think it's time. otherwise we'll never find the bugs. Index: gen/getpwent.c === RCS file: /cvs/src/lib/libc/gen/getpwent.c,v retrieving revision 1.60 diff -u -p -r1.60 getpwent.c --- gen/getpwent.c 28 Dec 2015 22:08:18 -

Re: enable shadow only pwd

2016-05-05 Thread Ted Unangst
Stuart Henderson wrote: > If you'd sent this 10 days ago we could have had enough of them > fixed at p2k16. As I won't have time to do that now, here are and here i waited until after to avoid causing trouble. my bad.

Re: httpd: patch for portability asprintf use

2016-05-06 Thread Ted Unangst
Theo de Raadt wrote: > > If OpenBSD's behavior of asprintf is non-standard and everyone else is > > doing it differently, we would probably have to apply the patch. But this > > would also affect many other places in the tree were we rely on our > > asprintf semantics. > > Actually, we have fixed

Re: Allow top(1) to search arguments (again)

2016-05-10 Thread Ted Unangst
Edd Barrett wrote: > On Thu, Apr 28, 2016 at 03:26:48PM +0100, Edd Barrett wrote: > > Resubmitting this diff, as I've been unable to get an OK. > > Style tweaks fixed, as pointed out by Michal Mazurek. Thanks for this. > > OK? ok

bcopy in libkvm

2016-05-10 Thread Ted Unangst
memcpy is newer and better. Index: kvm.c === RCS file: /cvs/src/lib/libkvm/kvm.c,v retrieving revision 1.59 diff -u -p -r1.59 kvm.c --- kvm.c 19 Dec 2015 18:40:30 - 1.59 +++ kvm.c 10 May 2016 22:46:07 - @@ -7

free size for descript tables

2016-05-10 Thread Ted Unangst
this is tricky, but not too hard. expanded dfff context to see the malloc. Index: kern_descrip.c === RCS file: /cvs/src/sys/kern/kern_descrip.c,v retrieving revision 1.130 diff -u -p -u -1 -7 -r1.130 kern_descrip.c --- kern_descrip.c

Re: tidy strstr.3

2016-05-11 Thread Ted Unangst
Michal Mazurek wrote: > * add explicit RETURN VALUES section > * add an EXAMPLES section, from NetBSD and FreeBSD > * mention memmem(3) does it really need an example? is strcpy next? other changes make sense.

Re: Allow top(1) to search arguments (again)

2016-05-11 Thread Ted Unangst
this improves the realloc loop. there is no need to constantly call realloc to resize the memory. if we have enough, we have enough. also no need to penny pinch the initial allocation. calling sysctl all the time is still wasteful, but harder to fix. Index: machine.c =

remove kevent perm check

2016-05-12 Thread Ted Unangst
There is a permission check for EVFILT_PROC that is not documented. Actually, it directly contradicts the documentation, which says you can watch any process you can see. The documented behavior makes sense, since I could also just run ps in a tight loop and get the same info, only less efficiently

<    1   2   3   4   5   6   7   8   9   10   >