Received: by 10.192.165.148 with SMTP id m20csp1689894imm; Thu, 26 Apr 2018 00:21:37 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+cq51BcPsnLaJ9ljucyuNHNFm7fhbavSFlMaglzFQjUzWbfKILx84F1w7gmWOyDRxiJaoz X-Received: by 10.98.3.3 with SMTP id 3mr21312071pfd.255.1524727297630; Thu, 26 Apr 2018 00:21:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524727297; cv=none; d=google.com; s=arc-20160816; b=0IoTJ/7fxYZAcFrdBWhEabLHcA76lvRrUp0/3rl0DQ6JqBmReVN6Uisaeb35FVsDu4 4Vqo4L1Hkkr5hswwZ0g8Ln/02q3vr7hwLcDMRnDIe3PzGKqbBMVUTajPvdR7Fy4GK87d PvBsIGDOkypGL1lwzEs1ZKXPdxDMP86ycicR2hBRZzaP5+flBfmTd62eY5tcCccQvGFs /rDjATYxzGL5tIN1IBV90zSuBUVqrRCe2YPD/dqEgoynPaJGnB+7B/qE7AZdofH6SPu4 GueAMelEM+wxEr5Du4lkB8yy+x1PPSAXEXU6Tg8MS848DdF0EHD31PmrLxT36WpF55of tNBw== 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=u0mg2CgYtZT/0An2JRPCx1XV1vcgnlHmnXdZMc464Cg=; b=LsJGnbdjaDFRCZHlgbRo4LQd/yv+W8mn9j3VR2G0FqzPoswNj8eJ4qAiRxagBzW/96 G+l0Ivt31n4yQtaEXaOtkc/HKVXoXqLo/vtnOtGdccCb1t46v2h1hBirA/YGRDluXsY5 f64xLRJQ/Gos4phEoWf5Gdugd7hsK8dlaEXbfssHegVbpZgBTVo3Kec0a+lMppnUhyNK JYp5oV4PiiDYx3PP/kdkiDJypYCteMhw/21U0bFTepKfNO4gfai0JBBz33DR90Ykmxag Y+7tLZ45d8QBb4fVsaqkURoZyk8MV+l7cezeVQcNcgwDytGrSyRG2tqxsYV/oi3vd3m3 nX6g== 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 w6si14634000pgp.496.2018.04.26.00.21.23; Thu, 26 Apr 2018 00:21:37 -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 S1754150AbeDZHUY (ORCPT + 99 others); Thu, 26 Apr 2018 03:20:24 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:57006 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753000AbeDZHUV (ORCPT ); Thu, 26 Apr 2018 03:20:21 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3Q7KB8Y105297 for ; Thu, 26 Apr 2018 03:20:20 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hk8d0mhm8-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 26 Apr 2018 03:20:20 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 26 Apr 2018 08:20:18 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 26 Apr 2018 08:20:15 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3Q7KFhh45285540; Thu, 26 Apr 2018 07:20:15 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9E9B04C04E; Thu, 26 Apr 2018 08:12:33 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 26F604C052; Thu, 26 Apr 2018 08:12:33 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 26 Apr 2018 08:12:33 +0100 (BST) From: Thomas Richter To: ananth@linux.vnet.ibm.com, anil.s.keshavamurthy@intel.com, davem@davemloft.net, mhiramat@kernel.org, akpm@linux-foundation.org, acme@kernel.org, rostedt@goodmis.org Cc: brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, Thomas Richter , stable@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] kprobes: Fix random address output of blacklist file Date: Thu, 26 Apr 2018 09:19:59 +0200 X-Mailer: git-send-email 2.13.5 X-TM-AS-GCONF: 00 x-cbid: 18042607-0020-0000-0000-000004163846 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18042607-0021-0000-0000-000042AB3BD9 Message-Id: <20180426071959.82407-1-tmricht@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-26_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804260071 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: To: Ananth N Mavinakayanahalli To: Anil S Keshavamurthy To: David S Miller To: Masami Hiramatsu To: Andrew Morton To: acme@kernel.org To: 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