Kernel/Compiler bug

Bryan Drewery bdrewery at FreeBSD.org
Wed Oct 1 23:21:37 UTC 2014


On 10/1/2014 2:37 PM, Dimitry Andric wrote:
> On 01 Oct 2014, at 15:40, Larry Baird <lab at gta.com> wrote:
>> Ryan,
>>
>> On Wed, Oct 01, 2014 at 12:46:35AM -0400, Ryan Stone wrote:
>>> This may not be a compiler bug.  A quick look at the esp values
>>> provided in that backtrace shows that at least 7KB has been used on
>>> the stack.  The stack for kernel threads is only 8KB, and a stack
>>> overflow can cause a double fault like that.
>>>
>>> My suspicion would be that without optimizations on clang uses a lot
>>> more stack space and you push over the limit.  There's a kernel build
>>> option for the stack size that you could change to confirm.  I believe
>>> that it's called KSTACK_PAGES.  Try increasing it to 4.
>> Good catch.  Increasing KSTACK_PAGES does fix the issue.  I wonder with
>> optimization, how close to stack overflow does the kernel get during boot?
> 
> It obviously depends on which optimization flags you use, which drivers
> you include, and so on.  There was a thread some time ago about somebody
> banging into the limit when mounting certain ZFS filesystems, here:
> 
> https://lists.freebsd.org/pipermail/freebsd-current/2012-December/038208.html
> 
> This is why Kostik added printing of the frame addresses to the panic
> backtrace output, so you can easily see if you hit the stack limit.
> 
> That said, 8k is not much these days, especially not with fairly
> complicated code like ZFS, combined with high optimization, which can
> inline a lot of functions, causing even more stack usage.  I would just
> bump KSTACK_PAGES.
> 
> -Dimitry
> 

Is this something that can be bumped in the tree for GENERIC?

-- 
Regards,
Bryan Drewery

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20141001/34b360c0/attachment.sig>


More information about the freebsd-hackers mailing list