Received: by 10.192.165.148 with SMTP id m20csp768339imm; Fri, 27 Apr 2018 07:14:13 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo5aldZYZxe7kLAaaYKS8PuPX6oT4CTaVh7ZTq1o3R2DWjar0ZuD91+OoIefnyYBQzHFzu3 X-Received: by 2002:a17:902:5602:: with SMTP id h2-v6mr2518550pli.115.1524838453763; Fri, 27 Apr 2018 07:14:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524838453; cv=none; d=google.com; s=arc-20160816; b=tWRFTc4jlg4UySDx/ShlJ7M8nSW3siWJGwkRH2x3PNqaBERLda0PCUqCTiseKE/ZPs fT/mKqNVi+ra65kNbiKFHtzXJ76J4FcjeiakXfl2L93swuJOoe5+muCaBqJ0+VWsvjja J9cX/QHq2j2hkCviR5uetZ8baMhjXQNtvsBhGfF8xU9W94KaB44kwISLjG29LjR/wuO/ r4+oCb9E9dI8GPtxUdXixR5RuGgOqOlSsDyuyqLyAL0OEov+29oqeiQoFsTZ4wxMRK/J H7gPAH+Zv2sV5s1sIbsOPyRGmiMyH/xz0BRAp7r6gU2qQQIA/4Gx+IMRqNuhdwcFe0np FArw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=kSKr6z/OYGYo0BDdyvbRwP567kW3+zwSQv0SSs5gIg0=; b=TmP9JkWfvvGeUPxp6nAaWCaZF7OWqQMFd6d5pS0q8y3XH/4SeWKtGF3LJMNFUWWyIL Bd12ANxtZ7BRBwYi04ia8il8GNfrmHUaxOA9CMfAcFTObrPmzpNNZHiD1SaJvcLQTuFW JOSWJFR+HCD6J9SFPgCk3GRe7lVAxXBGE/ucW97i673/Slq9UtVIe1ymu/Ypp8laLROS 63PxXjuHc4PWZs0huWlCmP1kS/YvIruDbfnIkl38eZ6jKgY7HTZqQ+FXaYG6o8Nn9ZEG zuwi3VaHDWmswxDbybUYKiDLjCYx9oYFJFL6dSjDKZ/SwfR4YQTKAhIADLKEQ7zV/vq+ ezAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j18-v6si1304750pgn.78.2018.04.27.07.14.00; Fri, 27 Apr 2018 07:14:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935262AbeD0OMz (ORCPT + 99 others); Fri, 27 Apr 2018 10:12:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:57312 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934839AbeD0OMw (ORCPT ); Fri, 27 Apr 2018 10:12:52 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 72BE12189E; Fri, 27 Apr 2018 14:12:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 72BE12189E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ananth N Mavinakayanahalli , Anil S Keshavamurthy , David S Miller , Masami Hiramatsu , acme@kernel.org, Thomas Richter , "Steven Rostedt (VMware)" Subject: [PATCH 4.16 80/81] kprobes: Fix random address output of blacklist file Date: Fri, 27 Apr 2018 15:59:22 +0200 Message-Id: <20180427135747.861646355@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180427135743.216853156@linuxfoundation.org> References: <20180427135743.216853156@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Richter commit bcbd385b61bbdef3491d662203ac2e8186e5be59 upstream. 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: ad67b74d2469 ("printk: hash addresses printed with %p") Cc: stable@vger.kernel.org Cc: # v4.15+ Cc: Ananth N Mavinakayanahalli Cc: Anil S Keshavamurthy Cc: David S Miller Cc: Masami Hiramatsu Cc: acme@kernel.org Signed-off-by: Thomas Richter Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Greg Kroah-Hartman --- kernel/kprobes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -2428,7 +2428,7 @@ static int kprobe_blacklist_seq_show(str struct kprobe_blacklist_entry *ent = list_entry(v, struct kprobe_blacklist_entry, list); - seq_printf(m, "0x%p-0x%p\t%ps\n", (void *)ent->start_addr, + seq_printf(m, "0x%px-0x%px\t%ps\n", (void *)ent->start_addr, (void *)ent->end_addr, (void *)ent->start_addr); return 0; }