Received: by 10.192.165.156 with SMTP id m28csp896399imm; Tue, 17 Apr 2018 23:42:28 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/tY/4czGKwJZ0evTLI/4gQnAxqsM9WJe2uVU+JAj16JKG5YoGVK7aPC2spGjK0wwsw7x7j X-Received: by 2002:a17:902:8692:: with SMTP id g18-v6mr936805plo.152.1524033748201; Tue, 17 Apr 2018 23:42:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524033748; cv=none; d=google.com; s=arc-20160816; b=dkymScb8Ma3rNXTfFNgvnDFYb1g553nYOQGgGXOKMTLgZwy5I00hXxUPCEnWSNGqkN C4YVBnyudrFT7zSt3XDuOkp8gx9yDO4kuGhCUhYJFOlSt7/nou8vqb5Pn+XJQvgjzfMS KFtGjtZ1ZeTgC7drn0dgAbE6jfhyGTjZsbGv9YOFhWXW00PI+2Sz10pRAQ+G7GW9LEvR 3SUfLdK+ivH5l0TmSGcrF/FHotaKI4OHeWv708eyDVkaLrmtdmnpXPuxejFuLnrbDoWH edjgx045X3M/uRVTewlD58Npx9JWdmHKamOTUutazSsCT1iK8fVJlPdLGfRxsw87dkAU mNIw== 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=CRVBqAA0ILR2DHvtQrUn/qDsSk1OX8i6L8/0KOUc9k4=; b=KrEY+dx5U3QfQBb6rwaIvcW0JSSDLRM1ycux8mGEwU/onPUS31KA+7B4YJnaEUqVrk hvxzFrpEbsesbb/Z1+4vtl2HCOka9+qthhnHLbNZHNpWCKzmDEyQiBt3hT4+gkCxem8k tdc9xaTLZL9/QQkLQpAZHRWfWhaXKempp4NEhZ2ZhRqagflUaQbfD9mVda1cFTgXBGyg NQg1HnobTYKqfJc6Iy/3MEqg+8hVawXg1OKsOKObNcXTuF9rkGPngF40ImITC1/+3V0+ q8d7v6YalgTcNnG1FpkdDxRA6K97IoLDizI8T6lkAGlRc2fGyFFMLKZlMnWJrev/r7sM DktQ== 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 c32-v6si610704plj.381.2018.04.17.23.42.14; Tue, 17 Apr 2018 23:42:28 -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 S1752811AbeDRGjc (ORCPT + 99 others); Wed, 18 Apr 2018 02:39:32 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:42200 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752145AbeDRGja (ORCPT ); Wed, 18 Apr 2018 02:39:30 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3I6YAAH018138 for ; Wed, 18 Apr 2018 02:39:30 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hdx1cevwq-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Wed, 18 Apr 2018 02:39:29 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 18 Apr 2018 07:39:28 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 18 Apr 2018 07:39:26 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3I6dPRV59703400; Wed, 18 Apr 2018 06:39:25 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0ECA7A405D; Wed, 18 Apr 2018 07:31:33 +0100 (BST) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 98F18A4051; Wed, 18 Apr 2018 07:31:32 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 18 Apr 2018 07:31:32 +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 v2] module: Fix display of wrong module .text address Date: Wed, 18 Apr 2018 08:39:04 +0200 X-Mailer: git-send-email 2.13.5 X-TM-AS-GCONF: 00 x-cbid: 18041806-0044-0000-0000-000005497423 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041806-0045-0000-0000-000028898653 Message-Id: <20180418063904.100200-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=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804180061 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fixes: ef0010a30935 ("vsprintf: don't use 'restricted_pointer()' when not restricting") for /sys/module/*/sections/.text file. 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. Suggested-by: Linus Torvalds Signed-off-by: Thomas Richter Cc: Jessica Yu Cc: stable@vger.kernel.org --- 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 : 0); } static void free_sect_attrs(struct module_sect_attrs *sect_attrs) -- 2.14.3