Project

General

Profile

Bug #5961

Fix stack overflow in zfs_create_fs

Added by Matthew Ahrens over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Category:
zfs - Zettabyte File System
Start date:
2015-05-27
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

Do not put zfsvfs_t on the stack. Its size of 7656 bytes consumes too much stack. Allocate it
temporarily instead.

On FreeBSD the kernel stack size is 16384. Issuing 'zpool create' command builds a kernel
stack consisting of at least 36 frames, with zfs_create_fs() somewhere in the middle. If
kernel is compiled with -O0, then stack will be exhausted and kernel panics. The default
compilation option is -O2, and it doesn't panic yet. But still putting extra 7656 bytes
is risky. If any of the 36 functions is modified to consume a bit more stack, we will panic
on the default kernel.

History

#1

Updated by Electric Monk over 4 years ago

  • % Done changed from 0 to 100
  • Status changed from New to Closed

git commit c701fde6911c957e71b37aac4daf672bd828f4d7

commit  c701fde6911c957e71b37aac4daf672bd828f4d7
Author: Gleb Smirnoff <glebius@freebsd.org>
Date:   2015-05-27T14:12:35.000Z

    5961 Fix stack overflow in zfs_create_fs
    Reviewed by: George Wilson <george@delphix.com>
    Reviewed by: Matthew Ahrens <mahrens@delphix.com>
    Approved by: Dan McDonald <danmcd@omniti.com>

Also available in: Atom PDF