• Paolo \'Blaisorblade\' Giarrusso's avatar
    [PATCH] uml: mconsole_proc simplify and partial fix · cb365cb6
    Paolo \'Blaisorblade\' Giarrusso authored
    From: Gerd Knorr <kraxel@bytesex.org>, and me, Paolo Giarrusso
    
    This is a rewrite of the mconsole_proc function.
    
    The old code had the problem that the kernel crashed after calling
    "uml_mconsole proc <somefile>" a few times.  I havn't tracked what exactly
    causes the problem, I guess trying to access the procfs without actually
    mounting it somewhere causes some corruption of kernel data structures.
    
    The new code simply openes /proc/<file> via sys_open().  That simplifies the
    function alot.  It also doesn't crash any more ;)
    
    Also, from Paolo Giarrusso: When printing the content of a file through the
    "proc" command, make it begin on his own line.
    
    PROBLEMS:
    
    Drawback is that it only works when procfs is actually mounted below /proc.
    And within UML, often this is false, because when building honeypots we mount
    HPPFS under /proc to avoid the hacker recognizing he's attacking a UML
    instance.
    
    One suggestion I've received to fix the later issue was to mount the procfs
    within a kernel thread with a private namespace, but I havn't tried that so
    far.
    
    Instead, we'd like to fix the actual code of the mconsole_proc function.  From
    "Anthony Brock" Anthony_Brock (at) ous (dot) edu comes a comment, suggesting
    where the bug lays (as noted in the source): removing part of the code (it
    seems the symlink lookup) there are no more crashes.
    Signed-off-by: default avatarPaolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    cb365cb6
mconsole_kern.c 13.6 KB