Received: by 10.192.165.156 with SMTP id m28csp1572345imm; Tue, 17 Apr 2018 01:24:57 -0700 (PDT) X-Google-Smtp-Source: AIpwx49N29O4ZtUmirzhGI9+yevP4bDZv0CM6vydV1qjoxMy3V38Fnum47TGb7Xswn/dnfltPCD+ X-Received: by 10.101.67.6 with SMTP id j6mr1025438pgq.126.1523953497072; Tue, 17 Apr 2018 01:24:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523953497; cv=none; d=google.com; s=arc-20160816; b=wxumSmWzL+eUEAElE8IbnXYPCbsGeKVMXXaEv6QfD2jMEo0SS5nauhYEQXfzUvV+ij COGyrK3Tfi3t7noLmqzrT1CNTO4IBFobVDaiip5z3d61tcc2cKl6r+n7TucAa+pvpcXg 4czk9EGi9YuKLQtt4F9SlieTQbXKjwnOnfdVYmXscSpFAsanwQm6b3/BBtmJm4G37rTm t/ucJyWgT78pHyZlyiKvtQ9Dpr5/xzd3o7IBcDjlkbrQ8NnRiJmKH5cCeIlGFWW/egrI wgIabfAvMe83VG9TkS5gffTFwD2z+vZRe4M+hOwey8XNh2NLfcGNfb3GtrX6n5HiZ0ZW CW9g== 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=9YKUzhXghSwC74aHGYg/FEuZy7IMyclg2Bmg3rn3W2s=; b=Kb3RyeBtOWxq5HhqY3CYMlqG0cykdsqNUvAXt9zm16gLp4UyQ/YvxBe5jlgPmcv7P+ xEPwv6RVTfvvCmJ4SIARpq3dJFtDgO2CMFNUJm2gB7SqRpk/BWnS1nc7h8sam6ljTSe/ rRdxmD5KW+1XFrDEjSdXCHB3R3HYuxzVRGk5FFmZ51I+nHK0n4FUmPcsTlqr8/SFxLLD dySpP6aMjuM9/uhBguJJ1rAvqTrEkHrFW+ZoWA8mxpcqAwf468TbCWYIvrIjijNFk1Jz DbW6sxqH7D3ODkZ74pHZt/blMYTXNvOq+RHW99qTxecSbmBwzuSlSIiBrXshZ6oTFVGy 0fDA== 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 t16si12616930pfj.10.2018.04.17.01.24.43; Tue, 17 Apr 2018 01:24:57 -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 S1752326AbeDQIX0 (ORCPT + 99 others); Tue, 17 Apr 2018 04:23:26 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:33550 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752609AbeDQIVO (ORCPT ); Tue, 17 Apr 2018 04:21:14 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3H8KYTh064274 for ; Tue, 17 Apr 2018 04:21:14 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hday9eesx-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 17 Apr 2018 04:21:13 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Apr 2018 09:21:11 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 17 Apr 2018 09:21:08 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3H8L65B61997176; Tue, 17 Apr 2018 08:21:07 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4499BAE053; Tue, 17 Apr 2018 09:10:57 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E3465AE051; Tue, 17 Apr 2018 09:10:56 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 17 Apr 2018 09:10:56 +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, Thomas Richter Subject: [PATCH] modules: Fix display of wrong module .text address Date: Tue, 17 Apr 2018 10:20:54 +0200 X-Mailer: git-send-email 2.13.5 X-TM-AS-GCONF: 00 x-cbid: 18041708-0012-0000-0000-000005CBB89C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041708-0013-0000-0000-0000194801A6 Message-Id: <20180417082054.26978-1-tmricht@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-17_03:,, 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-1804170075 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In kernel v4.16.0 the module .text address is displayed wrong when using /sys/module/*/sections/.text file. Commit ef0010a30935 ("vsprintf: don't use 'restricted_pointer()' when not restricting") is the first bad commit. Here is the issue, using module qeth_l2 on s390 which is the ethernet device driver: [root@s35lp76 ~]# lsmod Module Size Used by qeth_l2 94208 1 ... [root@s35lp76 ~]# cat /proc/modules | egrep '^qeth_l2' qeth_l2 94208 1 - Live 0x000003ff80401000 ^ This is the correct address in memory [root@s35lp76 ~]# cat /sys/module/qeth_l2/sections/.text 0x0000000018ea8363 <---- This is a wrong address [root@s35lp76 ~]# 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. Suggested-by: Linus Torvalds Signed-off-by: Thomas Richter Cc: Jessica Yu --- kernel/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/module.c b/kernel/module.c index a6e43a5806a1..77ab7211ddef 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -1472,7 +1472,7 @@ 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, "%#lx\n", kptr_restrict < 2 ? sattr->address : 0); } static void free_sect_attrs(struct module_sect_attrs *sect_attrs) -- 2.14.3