Received: by 10.192.165.156 with SMTP id m28csp563484imm; Thu, 19 Apr 2018 03:57:50 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/Ft8KrBQB4pvSCoeZgSwrW22O+4yoIZQFcL171IGU6Zh8P5ZYqZpGmd19YrETqONMnN95t X-Received: by 2002:a17:902:8b84:: with SMTP id ay4-v6mr5651063plb.57.1524135470697; Thu, 19 Apr 2018 03:57:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524135470; cv=none; d=google.com; s=arc-20160816; b=GVmWUwjks+Q7Uc8693nGZk+ABdBAY1zRi9aumhE5I1SOqyIPWjOjmiGThSUB06hoZD p0dySPFTv2yafdlFOyV44vNxpmmOaP7wyAe181dJOtUZxoEBAIbEg2bGfLDjZjavLjYs 88suE5ulCdNUilwAlROQkYFolq2seQZ1qIXVUnPFAujFSAEi4n2SAcoRf5tkCMoLH0Xk /rH7Xutx4DQisnEPrUPIyF1kRxYda24vW5Hqxxbl8nDlUAcTH1IAUwwZE3XNdOI9oikt tC4WJD5kHbQ15vAj2KZTG5qxcRc3Jsox4RdIz+rm1OimEzUg3AT482KKNms/G7r2ecym ft+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=rQHZinOg0u+1TrnkN6pFszmvAHao7hu9OTqrubUbYLc=; b=dN2olk/8CneLOFRki3Oz4BjyBGNGeedUaZwnrnS4FgG5L/fgz8LLRoz8HfFMq0z5hu gUOrEJMCfhGcZrXFr7eRDWw+FWFcEGxEUp0JZPFmnjUck5pLKmbmt9w6jxLDy8J78ugF TLwUsdYXu82DaYfyGLD+yVe0H7n9CcBENvPNJTPHMSFAF21FnAp7SCwQ9Zl/JnR6uWFC ThXP0j24MVavAURAu/7+4crkJ0PWfRL+HSkHdwSvn7EwQJO1dJjyqb+c9er0J7MSltJS 0e2qcJK8/VmXcXXEQroaIGgFwbYaquw+rHDcob87wPMgAKhNERhNYKmwxgJBGwDS4HDJ +B3g== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e18si2759942pgr.216.2018.04.19.03.57.31; Thu, 19 Apr 2018 03:57:50 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752077AbeDSK4U (ORCPT + 99 others); Thu, 19 Apr 2018 06:56:20 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:46036 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751168AbeDSK4S (ORCPT ); Thu, 19 Apr 2018 06:56:18 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3JAtiGU082786 for ; Thu, 19 Apr 2018 06:56:18 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hes6r1pyw-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 19 Apr 2018 06:56:17 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 19 Apr 2018 11:56:15 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 19 Apr 2018 11:56:13 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3JAuCT257147544; Thu, 19 Apr 2018 10:56:12 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5B12542045; Thu, 19 Apr 2018 11:47:43 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DF1FD4204D; Thu, 19 Apr 2018 11:47:42 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 19 Apr 2018 11:47:42 +0100 (BST) From: Thomas Richter To: linux-kernel@vger.kernel.org Cc: heiko.carstens@de.ibm.com, brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com, Thomas Richter , stable@vger.kernel.org, Ananth N Mavinakayanahalli , Anil S Keshavamurthy , David S Miller , Masami Hiramatsu , acme@kernel.org, Steven Rostedt Subject: [PATCH] kprobes: Fix random address output of blacklist file Date: Thu, 19 Apr 2018 12:55:56 +0200 X-Mailer: git-send-email 2.13.5 X-TM-AS-GCONF: 00 x-cbid: 18041910-0008-0000-0000-000004ED0994 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041910-0009-0000-0000-00001E8119DA Message-Id: <20180419105556.86664-1-tmricht@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-19_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804190098 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Fixes: ad67b74d2469 ("printk: hash addresses printed with %p") Cc: # v4.15+ Cc: Ananth N Mavinakayanahalli Cc: Anil S Keshavamurthy Cc: David S Miller Cc: Masami Hiramatsu Cc: acme@kernel.org Cc: Steven Rostedt Signed-off-by: Thomas Richter --- kernel/kprobes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 102160ff5c66..ea619021d901 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -2428,7 +2428,7 @@ static int kprobe_blacklist_seq_show(struct seq_file *m, void *v) 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; } -- 2.14.3