Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1137245ybe; Wed, 11 Sep 2019 09:56:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwO2rAXNdXggUIylCj117Q4y4q/Y7KhUT9bbZBcWQJ0+4vIZT1uf7zR/q4BywPaqN9aQsNf X-Received: by 2002:aa7:da8b:: with SMTP id q11mr37386291eds.19.1568221012017; Wed, 11 Sep 2019 09:56:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568221012; cv=none; d=google.com; s=arc-20160816; b=sR6Cxr28rSs+VVfD20igUajIm+8953doAyJqd+CUFMax4MW1hQj2feMtCoU53u1LXr CSg63RjM0AYsW//ZR4cEhASViAS3ZnOuQEvpKZiX3fS1ojZb15qtybclrgBIUJanwPwu YMyWSSOeJiYQaC8CFisydGhYz9gOcjf6BLFa06lQSvdTDKmZVSm+K7ZzTFYhL7k8WOyp 88KcOQbeT63yPUyU9ah3HJVHNN4CgxYNiRYcslphgeoCUdfUnu4RrNiAGWiPcYfQIh1Z bIzVymFfI12w0MdXU9TFW/Hlei5lM7e/FrhXjSkQgPPcozyuUsS9vYhqC645BiJjNsaQ CH3Q== 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:dkim-signature; bh=mTW2NGhchHctlDfByjQ3iFEDbmI3VdsCUaLfFyoMAJ8=; b=oEq3afsj0ljyKO4oQsp3ghYK4RbVX7KWNGXtNE+aG3kw/kXVpDTjAAKvn+dk72f8fc ++iXG8J3hOF1qzyLONU5JiLVZNAs0cjqmznsuIaG6QrCpdnLiVcv81zJ9/4rm22MAGYQ hpx1kewsVPorVUBJZR1UXyjkKyshJgGLpG1w4LVzLUnr/KjNpkn6gX8U2kYLqYhEhb8S 1FOhS1BywDgFrX7dbRbt8i+f2UvLXWOCWEMqbglegIJVnKS4xTkdfxb6QlKwVGzWIqB0 H0PXF+Lr6yrMeRHNisw5gg/U9Lpy8QNE5kL2eh3Ms/CBiDVA5U2Tp4b8eg/yNrhVQBLl rmMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="hnB8/Pcy"; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9si11100242edn.318.2019.09.11.09.56.28; Wed, 11 Sep 2019 09:56:52 -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; dkim=pass header.i=@google.com header.s=20161025 header.b="hnB8/Pcy"; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729428AbfIKQxt (ORCPT + 99 others); Wed, 11 Sep 2019 12:53:49 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:41724 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729028AbfIKQxs (ORCPT ); Wed, 11 Sep 2019 12:53:48 -0400 Received: by mail-wr1-f68.google.com with SMTP id h7so24375420wrw.8 for ; Wed, 11 Sep 2019 09:53:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mTW2NGhchHctlDfByjQ3iFEDbmI3VdsCUaLfFyoMAJ8=; b=hnB8/Pcy7pVNims5ONvJOOiLXQquQNUiLlnpuExQysfOSHUYBCHDjSaewyv3gh9S3L rjbI2zg3KwrS6Td16efQHiypKuIAigmR0XqaI0aO7iELofYqsoOOy/kTWx2aVVoZ8OpS L0FPqF95b7ksipCMWGqHwXj5oC6S+IU4adGodm5uCbHfrK09wyRO61F0HCQI0xzDEpBB 5haI+KEXQcefks+1f2d4xCf+radDZ9SQd9DdWWnKf/1lwaZMo2c1J2MvzWBxg3Ant+Ec 5KZZIqRp2cBbjGrvSfgxAlTjIsCzBVe/ZQYE9V8Mw+n3LUM7g2/478Ec8V6Y5U4pqmy3 iAUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=mTW2NGhchHctlDfByjQ3iFEDbmI3VdsCUaLfFyoMAJ8=; b=HMvfx2n9NdDFcry0AtJVhJ+ZeZrhhdV1uneAOY+f0UZMCp3dDf8CHNDRwAfRuhGcaY +P4hx3gJUQESvz2D9vNtwv5Bn2cpt2WbacTX1STRdQdq2FD3yTj0UeBJ0i9IK54fRMz6 46p+xKH+HtmbQHntaJb8RpKtWDFmd99HzyN+ALSBXmrdk6MKcsosr2i31FVq2iFG95fB kfZTgOp3845muMDL6Nc++MGY7iVj1l1Cy89NPWxkIpO6f3HuVVnyb698VuuK1LsSKfn1 kqIdbCMAxPO1peaHvH+p+y9zkzZ4LYBsZk/He1V7H5DCeVt+4WoI+t/ySyRwmVHaqG3i 0Bgw== X-Gm-Message-State: APjAAAUo1k+7Z+WdipcgyYtfbSabTw36QLXNeqaO75Y4Mesotr9UfeMR qdGWo2UOXxi9jkf0ua/rtDMpwQ== X-Received: by 2002:adf:a357:: with SMTP id d23mr3448326wrb.18.1568220825432; Wed, 11 Sep 2019 09:53:45 -0700 (PDT) Received: from google.com ([2a00:79e0:d:210:e8f7:125b:61e9:733d]) by smtp.gmail.com with ESMTPSA id y6sm2420326wmi.14.2019.09.11.09.53.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2019 09:53:44 -0700 (PDT) Date: Wed, 11 Sep 2019 17:53:41 +0100 From: Matthias Maennich To: Will Deacon Cc: Jessica Yu , linux-kernel@vger.kernel.org, maco@android.com, gregkh@linuxfoundation.org, Ard Biesheuvel , Catalin Marinas , kernel-team@android.com Subject: Re: [PATCH] module: Fix link failure due to invalid relocation on namespace offset Message-ID: <20190911165341.GA40932@google.com> References: <20190911122646.13838-1-will@kernel.org> <20190911133506.GB7837@linux-8ccs> <20190911164012.nalsccw6jku7gbpw@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20190911164012.nalsccw6jku7gbpw@willie-the-truck> 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 Wed, Sep 11, 2019 at 05:40:13PM +0100, Will Deacon wrote: >On Wed, Sep 11, 2019 at 03:35:06PM +0200, Jessica Yu wrote: >> +++ Will Deacon [11/09/19 13:26 +0100]: >> > Commit 8651ec01daed ("module: add support for symbol namespaces.") >> > broke linking for arm64 defconfig: >> > >> > | lib/crypto/arc4.o: In function `__ksymtab_arc4_setkey': >> > | arc4.c:(___ksymtab+arc4_setkey+0x8): undefined reference to `no symbol' >> > | lib/crypto/arc4.o: In function `__ksymtab_arc4_crypt': >> > | arc4.c:(___ksymtab+arc4_crypt+0x8): undefined reference to `no symbol' >> > >> > This is because the dummy initialisation of the 'namespace_offset' field >> > in 'struct kernel_symbol' when using EXPORT_SYMBOL on architectures with >> > support for PREL32 locations uses an offset from an absolute address (0) >> > in an effort to trick 'offset_to_pointer' into behaving as a NOP, >> > allowing non-namespaced symbols to be treated in the same way as those >> > belonging to a namespace. >> > >> > Unfortunately, place-relative relocations require a symbol reference >> > rather than an absolute value and, although x86 appears to get away with >> > this due to placing the kernel text at the top of the address space, it >> > almost certainly results in a runtime failure if the kernel is relocated >> > dynamically as a result of KASLR. >> > >> > Rework 'namespace_offset' so that a value of 0, which cannot occur for a >> > valid namespaced symbol, indicates that the corresponding symbol does >> > not belong to a namespace. >> > >> > Cc: Matthias Maennich >> > Cc: Jessica Yu >> > Cc: Ard Biesheuvel >> > Cc: Catalin Marinas >> > Fixes: 8651ec01daed ("module: add support for symbol namespaces.") >> > Reported-by: kbuild test robot >> > Signed-off-by: Will Deacon >> > --- >> > >> > Please note that I've not been able to test this at LPC, but it's been >> > submitted to kernelci. >> >> Thanks for fixing this so quickly. I can confirm that this fixes the >> build for arm64 defconfig and x86 built fine for me as well. I'll wait >> a bit and apply this at the end of the day in case Matthias or anybody >> else would like to confirm/test. > >FWIW, I've managed to boot arm64 Debian under QEMU and load/unload >modules successfully with this patch applied on top of modules-next. Thanks Will for fixing this so quickly! The patch looks good to me. Feel free to add Reviewed-by: Matthias Maennich Tested-by: Matthias Maennich Cheers, Matthias