Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 May 2009 09:28:51 +0200
From:      Florian Smeets <flo@kasimir.com>
To:        Ed Schouten <ed@80386.nl>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov <kib@FreeBSD.org>
Subject:   Re: svn commit: r192094 - head/sys/kern
Message-ID:  <4A0D19B3.3070007@kasimir.com>
In-Reply-To: <20090515070239.GQ58540@hoeg.nl>
References:  <200905141054.n4EAsvp1088977@svn.freebsd.org> <20090515070239.GQ58540@hoeg.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On 15.05.09 09:02, Ed Schouten wrote:
> Hi Kostik,
>
> * Konstantin Belousov<kib@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A0D19B3.3070007>