Re: libkvm requires kvm_getargv before kvm_getenv when both needed

2018-05-03 Thread Otto Moerbeek
On Thu, May 03, 2018 at 07:15:24PM +0300, Vadim Zhukov wrote: > 2018-05-03 18:59 GMT+03:00 Otto Moerbeek : > > Yes, looks good from reading. But all te extra checks before calling > > free can go. That's idiom from a *long* time ago. > > Like that? I've checked all free() calls in libkvm. > > I'

Re: libkvm requires kvm_getargv before kvm_getenv when both needed

2018-05-03 Thread Vadim Zhukov
2018-05-03 18:59 GMT+03:00 Otto Moerbeek : > Yes, looks good from reading. But all te extra checks before calling > free can go. That's idiom from a *long* time ago. Like that? I've checked all free() calls in libkvm. I've also added zeroing of vmst field in mips64 code, like it's done for other

Re: libkvm requires kvm_getargv before kvm_getenv when both needed

2018-05-03 Thread Todd C. Miller
On Thu, 03 May 2018 17:59:39 +0200, Otto Moerbeek wrote: > Yes, looks good from reading. But all te extra checks before calling > free can go. That's idiom from a *long* time ago. There is more cleanup that can be done in this code. For example, the use of 0 instead of NULL. But that can be a s

Re: libkvm requires kvm_getargv before kvm_getenv when both needed

2018-05-03 Thread Otto Moerbeek
On Thu, May 03, 2018 at 09:19:01AM -0600, Todd C. Miller wrote: > On Thu, 03 May 2018 13:58:35 +0300, Vadim Zhukov wrote: > > > Here is patch for libkvm that fixes a few memory handling problems. > > Most changes are mechanical, with some exceptions: > > > > 1. Most notable: this splits argv bu

Re: libkvm requires kvm_getargv before kvm_getenv when both needed

2018-05-03 Thread Todd C. Miller
On Thu, 03 May 2018 13:58:35 +0300, Vadim Zhukov wrote: > Here is patch for libkvm that fixes a few memory handling problems. > Most changes are mechanical, with some exceptions: > > 1. Most notable: this splits argv buffer into argv-specific one > and environ-specific one. This makes ps -e

Re: libkvm requires kvm_getargv before kvm_getenv when both needed

2018-05-03 Thread Vadim Zhukov
2018-05-02 16:54 GMT+03:00 Todd C. Miller : > On Tue, 01 May 2018 13:35:54 -0600, "Theo de Raadt" wrote: >> > b) Their working space should be independent of each other. This >> > isn't hard, just splitting kd->argbuf into kd->argbuf and >> > kd->envbuf. Seems a bit saner. >> >> I think

Re: libkvm requires kvm_getargv before kvm_getenv when both needed

2018-05-02 Thread Todd C. Miller
On Tue, 01 May 2018 13:35:54 -0600, "Theo de Raadt" wrote: > > b) Their working space should be independent of each other. This > > isn't hard, just splitting kd->argbuf into kd->argbuf and > > kd->envbuf. Seems a bit saner. > > > > I think (b) would be the better solution, this seems

Re: libkvm requires kvm_getargv before kvm_getenv when both needed

2018-05-01 Thread Theo de Raadt
Vadim Zhukov wrote: > 2018-05-01 21:53 GMT+03:00 Theo de Raadt : > > ktrace makes the problem more clear: > > > > 25908 ps CALL > > sysctl(1.55.75675.1,0xed0cc78,0x7f7cd3d8,0,0) > > 25908 ps RET sysctl -1 errno 14 Bad address > > And that's it, thanks! > > Now little

Re: libkvm requires kvm_getargv before kvm_getenv when both needed

2018-05-01 Thread Vadim Zhukov
2018-05-01 21:53 GMT+03:00 Theo de Raadt : > ktrace makes the problem more clear: > > 25908 ps CALL > sysctl(1.55.75675.1,0xed0cc78,0x7f7cd3d8,0,0) > 25908 ps RET sysctl -1 errno 14 Bad address And that's it, thanks! Now little ps(1) is happy. But now there's a question

Re: libkvm requires kvm_getargv before kvm_getenv when both needed

2018-05-01 Thread Theo de Raadt
ktrace makes the problem more clear: 25908 ps CALL sysctl(1.55.75675.1,0xed0cc78,0x7f7cd3d8,0,0) 25908 ps RET sysctl -1 errno 14 Bad address

libkvm requires kvm_getargv before kvm_getenv when both needed

2018-05-01 Thread Vadim Zhukov
Hi all. So I finally got bored of ps not displaying command args when "-e" is present. Yes, ps(1) is broken: compare end of lines in output of "ps -ww" and "ps -eww". And IIRC it behaves this way long enough, but I always thought that it's me not missing something in ps(1) manual. Bad zhuk@. This