• Thomas Richter's avatar
    kprobes: Fix random address output of blacklist file · bcbd385b
    Thomas Richter authored
    File /sys/kernel/debug/kprobes/blacklist displays random addresses:
    
    [root@s8360046 linux]# cat /sys/kernel/debug/kprobes/blacklist
    0x0000000047149a90-0x00000000bfcb099a	print_type_x8
    ....
    
    This breaks 'perf probe' which uses the blacklist file to prohibit
    probes on certain functions by checking the address range.
    
    Fix this by printing the correct (unhashed) address.
    
    The file mode is read all but this is not an issue as the file
    hierarchy points out:
     # ls -ld /sys/ /sys/kernel/ /sys/kernel/debug/ /sys/kernel/debug/kprobes/
    	/sys/kernel/debug/kprobes/blacklist
    dr-xr-xr-x 12 root root 0 Apr 19 07:56 /sys/
    drwxr-xr-x  8 root root 0 Apr 19 07:56 /sys/kernel/
    drwx------ 16 root root 0 Apr 19 06:56 /sys/kernel/debug/
    drwxr-xr-x  2 root root 0 Apr 19 06:56 /sys/kernel/debug/kprobes/
    -r--r--r--  1 root root 0 Apr 19 06:56 /sys/kernel/debug/kprobes/blacklist
    
    Everything in and below /sys/kernel/debug is rwx to root only,
    no group or others have access.
    
    Background:
    Directory /sys/kernel/debug/kprobes is created by debugfs_create_dir()
    which sets the mode bits to rwxr-xr-x. Maybe change that to use the
    parent's directory mode bits instead?
    
    Link: http://lkml.kernel.org/r/20180419105556.86664-1-tmricht@linux.ibm.com
    
    Fixes: ad67b74d ("printk: hash addresses printed with %p")
    Cc: stable@vger.kernel.org
    Cc: <stable@vger.kernel.org> # v4.15+
    Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
    Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
    Cc: David S Miller <davem@davemloft.net>
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: acme@kernel.org
    Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
    Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
    bcbd385b
kprobes.c 64.3 KB