svn commit: r192094 - head/sys/kern

Florian Smeets flo at kasimir.com
Fri May 15 07:43:27 UTC 2009


On 15.05.09 09:02, Ed Schouten wrote:
> Hi Kostik,
>
> * Konstantin Belousov<kib at FreeBSD.org>  wrote:
>> Log:
>>    Do not advance req->oldidx when sysctl_old_user returning an
>>    error due to copyout failure or short buffer.
>>
>>    The later breaks the usermode iterators of the sysctl results that pack
>>    arbitrary number of variable-sized structures. Iterator expects that
>>    kernel filled exactly oldlen bytes, and tries to interpret half-filled
>>    or garbage structure at the end of the buffer. In particular,
>>    kinfo_getfile(3) segfaulted.
>>
>>    Reported and tested by:	pho
>>    MFC after:	3 weeks
>
> Is it possible that this change introduces a regression? Right now
> `pstat -t' gets stuck in an infinite loop. I've added the following
> printf:
>

>
> So the problem is that sysctl overwrites the len argument with 0, even
> if it returns back to userspace with ENOMEM.
>
> I see we have two changes in sysctl. In theory it could also be related
> to jhb@'s changes to sysctl locking, but I suspect it's less likely.
>

I'm seeing problems with vmstat -i hanging and taking 100% of one of 4 
cores. A ktrace of the process shows this repeatedly

  13521 vmstat   RET   __sysctl 0
  13521 vmstat   CALL 
__sysctl(0x7fffffffe1f0,0x2,0x800d0e10c,0x7fffffffe2e8,0,0)
  13521 vmstat   SCTL  "hw.intrcnt"
  13521 vmstat   RET   __sysctl -1 errno 12 Cannot allocate memory
  13521 vmstat   CALL 
__sysctl(0x7fffffffe260,0x2,0x7fffffffe1f0,0x7fffffffe258,0x40492b,0xa)
  13521 vmstat   SCTL  "sysctl.name2oid"

I did csup before jhb@'s patch.

Cheers,
Florian


More information about the svn-src-all mailing list