From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796134752; b=zHjHK+NNX+JxWBK8XY/1hIJQguhKEtDjlKkmgBYu2+NrVgko7X/Ivfinvwemd0xt+IhJ OiRHiSY9vINbfeuKBS4HjNl6QXeOcnh2M9lQtMe6s0H79yjv4+jar+X/mqTwH0E3WdCFI VgHxsfgC35oWTNuo03VVaLC8q8zCrz3jBe4Cc8Kgo7ZI7Ml29IW1BKAHPYOgO53nSqxPc z2BW6IwrZr4dvEuJUXvABC1pQEvS8nlIegmHIl6arhowmgSz5P3s/V6p5yxa6VxV1WmmV mnUnDA2OtO0VFiu4YkwtGQTaOD0q1uj+FQVe2MTmIweT1geI4NhmgDwnox8hPDdLVCw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796134752; h=DMARC-Filter:Received:Received:DKIM-Signature:Date:From:To:Cc: Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; bh=+aZeZl4GHs0DnGPzex1Z+KnusDXTAN+/fierL5uJyBQ=; b=Iz92Q5+l0eas1eI9WAutRJN30jpx2VXHEqL+ezi2UvCwjDRkEPmvfmijVU7Z0Z0nOCPB edU9Gg6jt1gi9inWJEUkuT1mknbONpDp4YRaPjr+/j0h9O945+b5e/jhtH8EImbbkRM3h 2YQl8QuH7gmILriV+Ujw9pRAdu29no1eyOpUfbcfhBIbq5Oe0iXrQcjKajl2MEhEjjyU9 CSc9gOZ8F//n6hiDAwXpIWldF/DpzIRkDMxg9/4M2RCvxgZZK1Eu+Y/CdkbJRWfTUTJv5 XHQ3TpZGRVnkNamTizZMznJDlMUIG9sduy8AjpVAy3OLlZiQ2xvSa0wdpOwtzxUYxlQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=FfQWQD1E; arc=none smtp.remote-ip=217.140.110.172 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 967A1606A688 for ; Tue, 1 Dec 2026 14:19:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 967A1606A688 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=FfQWQD1E Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C32DE152B; Tue, 1 Dec 2026 06:19:07 -0800 (PST) Received: from arm.com (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8A34E3F86F; Tue, 1 Dec 2026 06:19:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796134750; bh=e8FdTO6ZeokiG0qAeUg0A3sLhqUaBJiGjEMAut2vQFI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FfQWQD1Eq11yRxc0H7WdRajeoyMd03aWK8b88yuxFHI/vF8SKdYlnyiFhXo8ASApf G2YEgeYzeenvxS4XSXbdRcnwf/kHM9VmHzf1ddYme7laPNwg13FWA1rLpDYr+7+ROn /ZpXsaKyWaAAihqKrz+XFvIliQcWpVX7vMtzDVSg= Date: Tue, 1 Dec 2026 14:19:07 +0000 From: Catalin Marinas To: Ard Biesheuvel Cc: linux-arm-kernel@lists.infradead.org, will@kernel.org, llvm@lists.linux.dev, arnd@arndb.de, Ard Biesheuvel , kernel test robot Subject: Re: [PATCH] arm64: Fix transient negative image size observed by the linker Message-ID: References: <20261130175121.1358891-2-ardb+git@google.com> X-Mailing-List: llvm@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Ignore this duplicate, our smtp server is playing up and I just resent the wrong reply. On Tue, Dec 01, 2026 at 02:13:36PM +0000, Catalin Marinas wrote: > Hi Ard, > > On Mon, Nov 30, 2026 at 06:51:22PM +0100, Ard Biesheuvel wrote: > > From: Ard Biesheuvel > > > > LLD occasionally errors out with a mysterious 'assignment to symbol foo > > does not converge', usually with a 16k page size kernel config. > > > > This turns out to be caused by the evaluation of the SPAN_NR_ENTRIES() > > macro using a preliminary value for _end that is below KIMAGE_VADDR, > > resulting in the difference to become negative. Subsequent passes > > usually recover from this, but not always, hence the config-dependent > > error. > > > > So ensure that SPAN_NR_ENTRIES() returns 1 for spans where the end > > address is smaller than or equal to the start address. This never > > occurs on the linker passes that matter, but prevents the iterative > > algorithm that LLD implements from diverging. > > > > This reverts commit dc0a08394804 ("arm64: Work around convergence > > issue with LLD linker"), which is superseded by this change. > > > > Reported-by: kernel test robot > > Closes: https://lore.kernel.org/oe-kbuild-all/20261129124345.eiR8unSx-lkp@intel.com/ > > Is this happening with your efi-zboot-elf branch only or mainline as > well? If the latter, we'd need a Fixes tag and cc stable. I'm not sure > what Arnd tested on. > > Your branch moves the INIT_IDMAP_DIR_SIZE and INIT_DIR_SIZE reservations > inside the sections and they depend on _end. IIUC, they become part of > the section size and moving '.' backwards is an error. I found another > report on your branch, not sure it's related but it looks like it's > caused by wrapped values: > > https://lore.kernel.org/all/20261120005637.8iy6yHZU-lkp@intel.com/ > > > diff --git a/arch/arm64/include/asm/kernel-pgtable.h b/arch/arm64/include/asm/kernel-pgtable.h > > index 229ee7976f69..929b5ac39981 100644 > > --- a/arch/arm64/include/asm/kernel-pgtable.h > > +++ b/arch/arm64/include/asm/kernel-pgtable.h > > @@ -42,8 +42,17 @@ > > */ > > #define EXTRA_PAGE __is_defined(CONFIG_RELOCATABLE) > > > > +/* > > + * LLD may evaluate SPAN_NR_ENTRIES() before _end has assumed its final value, > > + * and if the chosen preliminary value happens to be below KIMAGE_VADDR, the > > + * linker may go off into the weeds due to the negative result, ultimately > > + * leading to a 'assignment to symbol foo does not converge' error. > > Nit: it's probably implied but the negative result is actually a very > big uint64_t number. Not sure it needs any clarification. > > > + * > > + * Work around this by ensuring that SPAN_NR_ENTRIES() returns '1' in such > > + * transient cases. The final pass will observe the correct result. > > + */ > > #define SPAN_NR_ENTRIES(vstart, vend, shift) \ > > - ((((vend) - 1) >> (shift)) - ((vstart) >> (shift)) + 1) > > + ((vend) <= (vstart) ? 1 : (((vend) - 1) >> (shift)) - ((vstart) >> (shift)) + 1) > > This looks correct. > > > diff --git a/arch/arm64/kernel/image-vars.h b/arch/arm64/kernel/image-vars.h > > index 19d602e45523..7fc1417aab14 100644 > > --- a/arch/arm64/kernel/image-vars.h > > +++ b/arch/arm64/kernel/image-vars.h > > @@ -154,17 +154,6 @@ KVM_NVHE_ALIAS(kvm_protected_mode_initialized); > > _kernel_codesize = ABSOLUTE(__inittext_end - _text); > > #endif > > > > -/* > > - * LLD will occasionally error out with a '__init_end does not converge' error > > - * if INIT_IDMAP_DIR_SIZE is defined in terms of _end, as this results in a > > - * circular dependency. Counter this by dimensioning the initial IDMAP page > > - * tables based on kimage_limit, which is defined such that its value should > > - * not change as a result of the initdata segment being pushed over a 64k > > - * segment boundary due to changes in INIT_IDMAP_DIR_SIZE, provided that its > > - * value doesn't change by more than 2M between linker passes. > > - */ > > -kimage_limit = ALIGN(ABSOLUTE(_end + SZ_64K), SZ_2M); > > dc0a08394804 ("arm64: Work around convergence issue with LLD linker") > was about the circular dependency (_end -> INIT_IDMAP_DIR_SIZE -> _end). > Does that earlier problem go away with your patch here? > > -- > Catalin