Received: by 10.192.165.156 with SMTP id m28csp920224imm; Wed, 18 Apr 2018 00:16:33 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/zaV+R95MtBc7m270V1G2W/OqjKrZS2vhcF+Ko3RZ/yH3vA7Z9pgFLhXro2mj1lSWGM9pp X-Received: by 10.99.156.17 with SMTP id f17mr855681pge.102.1524035793122; Wed, 18 Apr 2018 00:16:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524035793; cv=none; d=google.com; s=arc-20160816; b=s+ck42g1Q7dTXvgcH8o7HgbFZDkyhKwqtuVmRXZJo+JyC0P7/4HIA5VtUtnlL4iJ2K K9NgkQCeNn3DG0j73Upzo5MaE9J5Dzu0A9ZZLAoKwg3L6YY7J7wmBFypm8dqjBLG+ujd fxX57MDHzsyOUvHDZ5kN+C8qbwNfJbuM6EQN4VLfg+LYeI2EmhKrq7EKEWmmhdHWJ/Nl RBnFAG7Ko7orZjz/ZJgEsA98DWDNhxMVSq+aGwKBL2CSyotmhC07KWOhVna3ADDf32J6 S+H3pXvixDdNxjOvJYZFDL1v1en4iA+T60ezlEtYLQyz27PcTActWw/FPSSkSgOcztqF Ow6A== 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=uontePt4hHponKmwcnDxHmNyswoJTTHPEXQQiCss9I8=; b=arflFHG7kZ/ogL06Z6wOYr4RsN/EHSFRQE7Rl6nBAqySgk81SFvQ17WMIXPs6fHqZa 0/IygPCBTQVdzN360beyeEiGx6sJRMqLiytd0sY2EN94cjRHwZqq7b2Tpv6fHnirtxT7 Zx/SJD+BBh2e3GZoETYFIf7eVQsohAVdR9XQW6Dnsbky9iM9Vi3zCXm5yjL3U+92L6fL k1yZAAJ2vITZZ2zB78EDTPTdN4JZddet55N3G52M9dLiqVL7pEjO98TWAPVDxQvoB4aV rBxCuDa5MruWjyNqs5nvjttsj7l38ZV1+mCbq2l63HrOKjLTzkN2Wlnpc+PVOOl/Dvzp 1bww== 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 i1si554819pgv.591.2018.04.18.00.16.19; Wed, 18 Apr 2018 00:16:33 -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 S1753281AbeDRHPA (ORCPT + 99 others); Wed, 18 Apr 2018 03:15:00 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59034 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753190AbeDRHO4 (ORCPT ); Wed, 18 Apr 2018 03:14:56 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3I79XbK106147 for ; Wed, 18 Apr 2018 03:14:56 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 2hdwecseb6-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Wed, 18 Apr 2018 03:14:55 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 18 Apr 2018 08:14:54 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 18 Apr 2018 08:14:52 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3I7EoEO000362; Wed, 18 Apr 2018 07:14:50 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 116E25203F; Wed, 18 Apr 2018 07:05:39 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 8F87F52049; Wed, 18 Apr 2018 07:05:38 +0100 (BST) From: Thomas Richter To: jeyu@kernel.org, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org Cc: borntraeger@de.ibm.com, schwidefsky@de.ibm.com, brueckner@linux.vnet.ibm.com, heiko.carstens@de.ibm.com, peterz@infradead.org, acme@kernel.org, me@tobin.cc, keescook@chromium.org, stable@vger.kernel.org, Thomas Richter Subject: [PATCH v3] module: Fix display of wrong module .text address Date: Wed, 18 Apr 2018 09:14:36 +0200 X-Mailer: git-send-email 2.13.5 X-TM-AS-GCONF: 00 x-cbid: 18041807-0008-0000-0000-000004EC8C62 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041807-0009-0000-0000-00001E8094DD Message-Id: <20180418071436.21392-1-tmricht@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-18_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 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-1804180067 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Reading file /proc/modules shows the correct address: [root@s35lp76 ~]# cat /proc/modules | egrep '^qeth_l2' qeth_l2 94208 1 - Live 0x000003ff80401000 and reading file /sys/module/qeth_l2/sections/.text [root@s35lp76 ~]# cat /sys/module/qeth_l2/sections/.text 0x0000000018ea8363 displays a random address. This breaks the perf tool which uses this address on s390 to calculate start of .text section in memory. Fix this by printing the correct (unhashed) address. Thanks to Jessica Yu for helping on this. Fixes: ef0010a30935 ("vsprintf: don't use 'restricted_pointer()' when not restricting") Cc: # v4.15+ Suggested-by: Linus Torvalds Signed-off-by: Thomas Richter Cc: Jessica Yu --- kernel/module.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/module.c b/kernel/module.c index a6e43a5806a1..40b42000bd80 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -1472,7 +1472,8 @@ static ssize_t module_sect_show(struct module_attribute *mattr, { struct module_sect_attr *sattr = container_of(mattr, struct module_sect_attr, mattr); - return sprintf(buf, "0x%pK\n", (void *)sattr->address); + return sprintf(buf, "0x%px\n", kptr_restrict < 2 ? + (void *)sattr->address : NULL); } static void free_sect_attrs(struct module_sect_attrs *sect_attrs) -- 2.14.3