Received: by 10.192.165.156 with SMTP id m28csp242975imm; Tue, 17 Apr 2018 09:23:15 -0700 (PDT) X-Google-Smtp-Source: AIpwx4808Ha/tvblk/qpobO/QJDS+ZDyfgYmRir1cU/nIkqqnGntO2XoBf4CO+fIUSTloxqdR1aL X-Received: by 10.99.125.75 with SMTP id m11mr2285118pgn.391.1523982195221; Tue, 17 Apr 2018 09:23:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523982195; cv=none; d=google.com; s=arc-20160816; b=InJ48EOPtbRylbYzQVwfM5b2pp8UIT/Jp1UglMMBPRHK0pm2P32BnP+46ZFLFCA1Kd OBWF8y5e54osybKtrtA6P8yBzwv8KRKutxFVMlNEw9cqaNIO/RgZtMFxvuT0MH40unKw fhmIMvSsBKMQyPxuJek1QeCddqSg5VJl441n+hgJdEXus5zqPWhNL6GEV9Qze99W3Hve FqTF60IYHFzzHwb0/EKNfyxof4KQJTMDeyb7fw733mR5JgHw72v0kY1nIGwZ8ZwynTsO xRzJhcS6I989knM1OWqO3MtmmTk+o9DRVPwXbqG3KffMNT45X0wUDobJ/mU3w1ZvODdN umyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:arc-authentication-results; bh=cKa3N2nSabnv48o2pI6FCb73SDX49akXEOZQSPVj2gg=; b=GpI7B7bSkCaOQ+x7Id+BbON/hkAPKuBTfMJGHs3OGrCd0KyBe1ZV/nLwJ6B8t8qe+H Ib1LneCGbQGARabAOKABvD2ZZAE9IZiGZPS1/2Uzv2fqAVkAg98Ep6BYaxENlJPv++uV exUV4gj32Nxl/+t38uc+4JrC9DQEgX1w7z3tbjGk60bg46ajFRPz67DAhNnjdlpbaOea IA7sZ3BF1e+Yg9u4QTppJcA84o/0SEdhmp9QhHRlqoG1F9bsyRvA8R7ruq3D8Z6gGXRg P/KnsuTkCZhdvdi858WPnlLMLEkqe3jeH65TZPHPUqjpWdhmHmEsqfyEHI/YYW3NM9Ol 6jwQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5si503696pgq.682.2018.04.17.09.23.00; Tue, 17 Apr 2018 09:23:15 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756002AbeDQQUE (ORCPT + 99 others); Tue, 17 Apr 2018 12:20:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:54318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755873AbeDQQUD (ORCPT ); Tue, 17 Apr 2018 12:20:03 -0400 Received: from jouet.infradead.org (unknown [190.15.121.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 830EC21726; Tue, 17 Apr 2018 16:20:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 830EC21726 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=acme@kernel.org Received: by jouet.infradead.org (Postfix, from userid 1000) id 4BEE0145571; Tue, 17 Apr 2018 13:20:00 -0300 (-03) Date: Tue, 17 Apr 2018 13:20:00 -0300 From: Arnaldo Carvalho de Melo To: Christian Borntraeger Cc: Thomas Richter , jeyu@kernel.org, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, schwidefsky@de.ibm.com, brueckner@linux.vnet.ibm.com, heiko.carstens@de.ibm.com, peterz@infradead.org, me@tobin.cc, keescook@chromium.org Subject: Re: [PATCH] modules: Fix display of wrong module .text address Message-ID: <20180417162000.GA7157@kernel.org> References: <20180417082054.26978-1-tmricht@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, Apr 17, 2018 at 10:24:35AM +0200, Christian Borntraeger escreveu: > > > 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? Adding the missing: Fixes: ef0010a30935 ("vsprintf: don't use 'restricted_pointer()' when not restricting") Should be enough? - Arnaldo > > --- > > 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) > >