Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1190601ybt; Thu, 9 Jul 2020 00:34:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUv/S2d2R9VFVFXzWg4voXCHJ9eSTP0zECF5khvu9ylrzJEI9MznT/6rka92lam1dTY3nT X-Received: by 2002:a17:906:da0f:: with SMTP id fi15mr54021682ejb.237.1594280083013; Thu, 09 Jul 2020 00:34:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594280083; cv=none; d=google.com; s=arc-20160816; b=N+2aCmuljK22qwwPUq4vBlS2sSYZV5GelTa0zqEcd5uqX33EOjRpl1K/8KcBAGCDOT luvl/zbtqJxQS9VJiO4UDKygpHEwwkhxGMLI8/L6+XdDo0dKhkybPK3ptRWl2TTMGpkj MNB//MeLPN2FfRuqIrzznMrPv4U3ucwh9ONoxpVBiLsy9QMr/AXObwsx2fHG63akJeYV wpn/zdxOGVZyzuOSNn/D1enuw+YRJ6ReFi2ctzIpI5C+mdGH1njBZbbeEASq4Vin/cBo 2gZNJnb+AWU0iHZ7adNemw4ATN5g1eUinkXA1KX9FFph4DdWnIwvU042UknJtsYCr9FE ABog== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kakKZcSdsSt03vkEyqiFdKJJD1UpoTlT8bIHlJigmBk=; b=Y74HjXXbpbj0FWQre7eJrJdOkO/dbdIaZ9V8IAj9ydkcFy4yDjdm/5wKXZxRedXIaP zIritbTUmyALBTrpsLASjmKTqnTuHQAg7/9Wgg5Qv+GZMYyysUVueHJCZkZ7XFbLArOV A+mUZIJa3PxNaky+cTW95ZUT2GduR0o/lB2TCI1p7i1sTDMdyHLnNGiSC1NWgX5Vw0H6 29cWikibJWeScus/tJd6YkSLQ29yZDPT2SMP9Kmfj9Kn0l6liqy3K/wPsCAZtwXKfz9s jdMGa+dSncyR8RVyRjbPdsQ3MNQQgoV9SvjZNsrvu6RQ7owAHEWXb8Jq4YWc59kOMc4O RwEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0HEp8AIM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id du14si1608732ejc.721.2020.07.09.00.34.20; Thu, 09 Jul 2020 00:34:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0HEp8AIM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726269AbgGIHcF (ORCPT + 99 others); Thu, 9 Jul 2020 03:32:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:43432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726184AbgGIHcE (ORCPT ); Thu, 9 Jul 2020 03:32:04 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (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 2674F20767; Thu, 9 Jul 2020 07:32:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594279924; bh=kakKZcSdsSt03vkEyqiFdKJJD1UpoTlT8bIHlJigmBk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=0HEp8AIMosA+aX0/9PHIsVTDp/+r3qiQ/04W1r98dGizruyYLq/Ta7D+cHnPBZroh CB8PR4wIL7Yjoy5h0nnNNEuhmFhBrWjbqtFKvoAQ/3jxuXAL9S/Ub3eXde+GqK/xMD cAqOs2yrTUBa4ORtQdFc4E55sk8DISnRCsAZSCSM= Date: Thu, 9 Jul 2020 08:31:59 +0100 From: Will Deacon To: =?utf-8?B?5b2t5rWpKFJpY2hhcmQp?= Cc: Ard Biesheuvel , "catalin.marinas@arm.com" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] arm64/module-plts: Consider the special case where plt_max_entries is 0 Message-ID: <20200709073159.GA27725@willie-the-truck> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 09, 2020 at 07:18:01AM +0000, 彭浩(Richard) wrote: > On Thu, 9 Jul 2020 at 09:50, 彭浩(Richard) wrote: > >> >Apparently, you are hitting a R_AARCH64_JUMP26 or R_AARCH64_CALL26 > >> >relocation that operates on a b or bl instruction that is more than > >> >128 megabytes away from its target. > >> > > >> My understanding is that a module that calls functions that are not part of the module will use PLT. > >> Plt_max_entries =0 May occur if a module does not depend on other module functions. > >> > > > >A PLT slot is allocated for each b or bl instruction that refers to a > >symbol that lives in a different section, either of the same module > > (e.g., bl in .init calling into .text), of another module, or of the > >core kernel. > > > >I don't see how you end up with plt_max_entries in this case, though. > if a module does not depend on other module functions, PLT entries in the module is equal to 0. This brings me back to my earlier question: if there are no PLT entries in the module, then count_plts() will not find any R_AARCH64_JUMP26 or R_AARCH64_CALL26 relocations that require PLTs and will therefore return 0. The absence of these relocations means that module_emit_plt_entry() will not be called by apply_relocate_add(), and so your patch should have no effect. You seem to be saying that module_emit_plt_entry() _is_ being called, despite count_plts() returning 0. One way that can happen is if PLTs are needed for branches within a single, very large text section, but you also say that's not the case. So I think we need more information from you so that we can either reproduce this ourselves, or better understand where things are going wrong. Finally, you said that your kernel is "5.6.0-rc3+". Are you able to reproduce with mainline (5.8-rc4)? Will P.S. whenever you reply, the mail threading breaks :(