Received: by 10.192.165.156 with SMTP id m28csp1573718imm; Tue, 17 Apr 2018 01:26:54 -0700 (PDT) X-Google-Smtp-Source: AIpwx487C+DuVxcYnvBJARzhDvQltUflURO1HgEUl4i6ix/uYfPLY2+2nI3K8LS7lkMQfSBy5hAR X-Received: by 2002:a17:902:7101:: with SMTP id a1-v6mr1172115pll.291.1523953614906; Tue, 17 Apr 2018 01:26:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523953614; cv=none; d=google.com; s=arc-20160816; b=I22vDtm4paQD6UW5y1DBJ0mMq5Uck+23pVIE9DegHzbFb6aR+nGBoY5b8qFpASgpnx BMY8Q7j65apEnobwfvjPUHMrPDLZuc8CFyFV5Gsu7Ibver66rT1vlEw63FV/17h69ue4 qHJl7F3woJm8m1W0d/J+CDAEdkDoXnA+xS7QQ/eObASI1xC3+/cji1Zb3rpStdhYWkRY 2YMJPe42QpzuXGWhYKJ1/XGlDYROv8YBsVBTwhowdrroh6QWdVRcr1qieqLIaY6vKkgf BGDwKRqeMbS4qvhgDYqhfMcqmgIizTyfXEmpxX5W7rnKNg2Zzl29f8fKKzOzM81PAL7z t/pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date:openpgp :from:references:cc:to:subject:arc-authentication-results; bh=PYgGkTlpK2Y9ROq+Xjj+bLCD+akqse9zSk+gDcO3EQg=; b=oEgJ13Qwpf1+XYdue4zVxpcpOCrg6IwC5dPhQy7SbDiKqnWLHYmrvysTl5L89R9EB7 DNY9y451vboOx/tiz4GuPrmnP3L8YkFITR/CGECHPsQk/a4AW/6vODkaE9bR8aeyIDas sBBMfMYu1m+Cr+uwhMTwAw7BSsluorGN1RvrJPHMGTNb9mk0f6QpTGGU2V/4BasqxC2V bMWH3lQM7+L3a7ieALM0SFFd850QP9A66lenGyV2VimiCaUpQM5xZa1Zi4aOQyHzAzkm 4Vp+3zUF6pb0YpjTF9FtoKO/B2TBghOFywcK8QkBAcarl/XCwM72N2K6e0LHrRI5bu9U jGdA== 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 o81si12719120pfa.64.2018.04.17.01.26.40; Tue, 17 Apr 2018 01:26:54 -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 S1752690AbeDQIZd (ORCPT + 99 others); Tue, 17 Apr 2018 04:25:33 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51608 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752273AbeDQIYn (ORCPT ); Tue, 17 Apr 2018 04:24:43 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3H8OdDX029950 for ; Tue, 17 Apr 2018 04:24:42 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hdapj7d51-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 17 Apr 2018 04:24:42 -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:24:39 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) 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:24:37 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3H8OaKV51314736; Tue, 17 Apr 2018 08:24:36 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 34E925203F; Tue, 17 Apr 2018 08:15:26 +0100 (BST) Received: from oc7330422307.ibm.com (unknown [9.145.69.130]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id B780652043; Tue, 17 Apr 2018 08:15:25 +0100 (BST) Subject: Re: [PATCH] modules: Fix display of wrong module .text address To: Thomas Richter , jeyu@kernel.org, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org Cc: 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 References: <20180417082054.26978-1-tmricht@linux.ibm.com> From: Christian Borntraeger Openpgp: preference=signencrypt Date: Tue, 17 Apr 2018 10:24:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180417082054.26978-1-tmricht@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 18041708-0012-0000-0000-000005CBB8F3 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041708-0013-0000-0000-0000194801FF Message-Id: 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-1804170076 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/17/2018 10:20 AM, Thomas Richter wrote: > 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 CC stable? > --- > 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) >