• J
    coredump: add support for exe_file in core name · 57cc083a
    Jiri Slaby 提交于
    Now, exe_file is not proc FS dependent, so we can use it to name core
    file.  So we add %E pattern for core file name cration which extract path
    from mm_struct->exe_file.  Then it converts slashes to exclamation marks
    and pastes the result to the core file name itself.
    
    This is useful for environments where binary names are longer than 16
    character (the current->comm limitation).  Also where there are binaries
    with same name but in a different path.  Further in case the binery itself
    changes its current->comm after exec.
    
    So by doing (s/$/#/ -- # is treated as git comment):
    
      $ sysctl kernel.core_pattern='core.%p.%e.%E'
      $ ln /bin/cat cat45678901234567890
      $ ./cat45678901234567890
      ^Z
      $ rm cat45678901234567890
      $ fg
      ^\Quit (core dumped)
      $ ls core*
    
    we now get:
    
      core.2434.cat456789012345.!root!cat45678901234567890 (deleted)
    Signed-off-by: NJiri Slaby <jslaby@suse.cz>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
    Reviewed-by: NAndi Kleen <andi@firstfloor.org>
    Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    57cc083a
exec.c 51.2 KB