Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1122519ybe; Wed, 11 Sep 2019 09:42:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqyCTU4BqdQ6EmdYG0kk2bAmZFJEVFnlai53SanfZ4NXV8cS21HTjJ37sVz7PCelMIr5/3OH X-Received: by 2002:a05:6402:1614:: with SMTP id f20mr1724267edv.63.1568220160187; Wed, 11 Sep 2019 09:42:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568220160; cv=none; d=google.com; s=arc-20160816; b=RRBtv4VYvMoR3PF+e+XEcD5OFFkPX5QKB9x+NbI9bayunGTIXfm1naYECF52oDb1hS k54U0fpg95h8SLGv2qqR49/7G99rXi3M3WxJ+fCpdKQyfL52+9Q9OiiB/h6JZeXxD2Th UhcDCiL4y8w6RRn2tIcAU0zXLSWznLeUq5DB47+eBO1U2fGZbGrlx3bM3h6mSaDDUtvN e2uYw30lCQGivE4ZRk2lWSE2Mkl+WORGJU4CS2pwWG4o8jtYuGcyPgMrfd/BhO8SxyrF ZXq1F/JoUqNuaIcrFVcvQmxS1GDYNz7F64g2HA1339+8mXqLXpXsCJe17npZbGOa4H1y tpLw== 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=t5ws4sCxlpXpJnM+aILp9ful1gAR/dtTxEtBphv+WWc=; b=L9I+TxgjZoeWECa2NHNBjnkGillaVDRenR5DF4RGXwSuWYNfwQLslMF7KPcJMwvFv3 vd0D2y9d2w48K4L/Cafk1Ug0yZ0bIAzVr/aW2eeActfedSJmvtstjBOfKggrHGjcnHEu j9AS+y/cf10osRzPoB44NYPLkL+C8FGjOFWvOaZcQLCp07A4d7AOVCZHMsf+pSU8bY55 0FxS+LtHedxGMh8eiTiA8rwR0rVsPOpj9Y2X9eynSioei33otrb+45BYng1lHGIMPr5b njjGjviZvR5i1N+rlL+ivoRw5SwdsCf015rytx7Ns/lELly5X36ArEk4kd6Upofie8TZ pjVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SCJ519pK; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l5si10822909ejc.23.2019.09.11.09.42.16; Wed, 11 Sep 2019 09:42:40 -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=@kernel.org header.s=default header.b=SCJ519pK; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729140AbfIKQkS (ORCPT + 99 others); Wed, 11 Sep 2019 12:40:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:37654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727839AbfIKQkS (ORCPT ); Wed, 11 Sep 2019 12:40:18 -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 3014920838; Wed, 11 Sep 2019 16:40:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568220017; bh=IYlQzZjToZbYtDmhBVLvoXVdhbIE48lfVFIE1bOVOQ4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SCJ519pKPOYYsA536PDlGELRLGoajfeziyypGF33UqFYKSFfKVwawoyiuNpwGt/A6 aSlZT1KxY4TptGNwGrbLQWFyS42WBYjgsrzOrlSFs2nrdj24OB46VWtUV5l+tm6Pmm lKe27NFw4LJNUPUlhUMQxK7VaH62KDbiLzOkDtm0= Date: Wed, 11 Sep 2019 17:40:13 +0100 From: Will Deacon To: Jessica Yu Cc: linux-kernel@vger.kernel.org, maco@android.com, gregkh@linuxfoundation.org, Matthias Maennich , Ard Biesheuvel , Catalin Marinas Subject: Re: [PATCH] module: Fix link failure due to invalid relocation on namespace offset Message-ID: <20190911164012.nalsccw6jku7gbpw@willie-the-truck> References: <20190911122646.13838-1-will@kernel.org> <20190911133506.GB7837@linux-8ccs> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190911133506.GB7837@linux-8ccs> User-Agent: NeoMutt/20170113 (1.7.2) 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 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. Will