• Fernando Vazquez's avatar
    [PATCH] stack overflow safe kdump: safe_smp_processor_id() · dc2bc768
    Fernando Vazquez authored
    This is a the first of a series of patch-sets aiming at making kdump more
    robust against stack overflows.
    
    This patch set does the following:
    
    * Add safe_smp_processor_id function to i386 architecture (this function was
      inspired by the x86_64 function of the same name).
    
    * Substitute "smp_processor_id" with the stack overflow-safe
      "safe_smp_processor_id" in the reboot path to the second kernel.
    
    This patch:
    
    On the event of a stack overflow critical data that usually resides at the
    bottom of the stack is likely to be stomped and, consequently, its use should
    be avoided.
    
    In particular, in the i386 and IA64 architectures the macro smp_processor_id
    ultimately makes use of the "cpu" member of struct thread_info which resides
    at the bottom of the stack.  x86_64, on the other hand, is not affected by
    this problem because it benefits from the use of the PDA infrastructure.
    
    To circumvent this problem I suggest implementing "safe_smp_processor_id()"
    (it already exists in x86_64) for i386 and IA64 and use it as a replacement
    for smp_processor_id in the reboot path to the dump capture kernel.  This is a
    possible implementation for i386.
    Signed-off-by: default avatarFernando Vazquez <fernando@intellilink.co.jp>
    Looks-reasonable-to: Andi Kleen <ak@muc.de>
    Acked-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
    Cc: Vivek Goyal <vgoyal@in.ibm.com>
    Cc: James Bottomley <James.Bottomley@steeleye.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    dc2bc768
smp.h 2.49 KB