Re: Removing kernel thread stack swapping

From: John Baldwin (jhb_at_FreeBSD.org)
Date: 03/03/05

  • Next message: David Schultz: "Re: Removing kernel thread stack swapping"
    To: freebsd-arch@FreeBSD.org
    Date: Thu, 3 Mar 2005 09:54:07 -0500
    
    

    On Thursday 03 March 2005 02:42 am, David Schultz wrote:
    > Any objections to the idea of removing the feature of swapping out
    > kernel stacks? Unlike disabling UAREA swapping, this has the
    > small downside that it wastes 16K (give or take a power of 2) of
    > wired memory per kernel thread that we would otherwise have
    > swapped out. However, this disadvantage is probably negligible by
    > today's standards, and there are several advantages:
    >
    > 1. David Xu found that some kernel code stores externally-accessible
    > data structures on the stack, then goes to sleep and allows the
    > stack to become swappable. This can result in a kernel panic.

    He found one instance.

    > 2. We don't know how many instances of the above problem there are.
    > Selectively disabling swapping for the right threads at the
    > right times would decrease maintainability.

    Probably 1. Note that since at least FreeBSD 1.0 programmers have had to
    realize that the stack can be swapped out. The signal code in pre-5.x stores
    part of the signal state in struct proc directly in order to support swapped
    out stacks. In 5.x we just malloc the whole signal state directly since we
    killed the u-area. sigwait() has a bug that should be fixed, let's not
    engage in overkill and throw the baby out with the bath water. In general we
    need to discourage use of stack variables anyway because when people use
    stack space rather than malloc() space the failure case for running out is
    much worse, i.e. kernel panic when you overflow your stack (even though KVM
    may be available) vs. waiting until some memory is available or returning
    NULL.

    Hence, don't kill this whole feature just because someone is too lazy to fix a
    bug.

    -- 
    John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
    "Power Users Use the Power to Serve"  =  http://www.FreeBSD.org
    _______________________________________________
    freebsd-arch@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-arch
    To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
    

  • Next message: David Schultz: "Re: Removing kernel thread stack swapping"

    Relevant Pages

    • [Full-disclosure] PHRACK 64: ATTACKING THE CORE
      ... - The Slab Allocator ... - Slab overflow exploiting: ... - Forcing a kernel path to sleep ... - Stack Frame Flow Recovery ...
      (Full-Disclosure)
    • Removing kernel thread stack swapping
      ... Any objections to the idea of removing the feature of swapping out ... wired memory per kernel thread that we would otherwise have ... stack to become swappable. ...
      (freebsd-arch)
    • Re: Removing kernel thread stack swapping
      ... Unlike disabling UAREA swapping, this has the ... >> wired memory per kernel thread that we would otherwise have ... >> stack to become swappable. ... The swapper sets a flag on threads that are unswappable. ...
      (freebsd-arch)
    • Re: [Bug #11342] Linux 2.6.27-rc3: kernel BUG at mm/vmalloc.c - bisected
      ... stack usages for you is that they contain a 'cpumask_t' on the stack. ... We can enable MAXSMP and raise the CPU limits some time in the future. ... not accept a specially built kernel, but only a kernel that has been ... know how extensively these distributions test and certify for many known ...
      (Linux-Kernel)
    • Re: Interrupt context...
      ... > gone through most of the posts on interrupt in usenet. ... > kernel stack and ISR is executed. ... More may be saved depending on the architecture. ... Here the kernel have assembler code to save all general ...
      (comp.os.linux.development.system)

  • Quantcast