From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81B8E42B750 for ; Wed, 10 Jun 2026 15:50:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781106614; cv=none; b=axPDYprT7bMfVEAEZgl8CZ3Ru6J0x+RG08ay3Lq0k2s4Ag+1o5ESAdiWVJcAOd0Pn/JZdZbwj29Fdh33JM96MZiJqiaxk20z7m4OfOrXDjUl3lOzz9tRMZKxHa/BfYWjCgULSWovbXP1dR3ksPJ8U5NUIT/5mtmbIIw3PBfqZfs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781106614; c=relaxed/simple; bh=Uy1jEB3de+y/OfX3XHuNkFbcXv0lUt9DsP84+jWEy24=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AtAS/tZKMIyvOuxRFfpl20VX4cO5F7AryGncLmp8QXCn88vcFfKgzoeM0p7UFiVCc2D3yNdycvn0tzt6nfWqTtdHQvj0qMahCI4P4wWKn10Baj2ICG1/xmv+lfCEgPXhJ0JlkMdpPZN/1BDL2aAbRS36rFCSJC4xRweG4b8mxV4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=A1dV01Ov; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="A1dV01Ov" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-2c0b944f6edso70783475ad.2 for ; Wed, 10 Jun 2026 08:50:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781106613; x=1781711413; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=N62HLkzXr48klLfiaIQLz719iwqu6H5OvWl+Uf/YYek=; b=A1dV01OvXQXtNo8CxM7FlcRA15o3kDdFauiOlq/K7Jbo1CPLHuGv9XLx6XY9b5VHcp 06B44qE9eUsouvWDveW0Ov0gRPCJjC2V5l+HPGk8MQonRkx4oguTVrbei1McOH10S7P/ J2LDaOvk4RQXd06ja1P0Nq7Y9M7gxFGSRlj7rIoc6G0wZhfFce0COX0MvMEzpQgZ8c+o btQVGqUqIuxkp2Hkp68j15hGIjrDWWFny1IcmegC7L/HclR/I91nxK4WO9UPaDWVmZqH Ip76RJFSYJ+ZI8SfwAgtNQIVbxvKk13ym5JCIjm/jBzFPt3beqDTEHNjpM48dM77H+oB Dbjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781106613; x=1781711413; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N62HLkzXr48klLfiaIQLz719iwqu6H5OvWl+Uf/YYek=; b=nwVYdcOMm5EDh7Y1m2jzlhBGvQva/JfDBOdPkkZ4q2jPmLO9FA4Z2GGyJjkL8ANLBk ghBb8rHf6w08Xx/IOax+JqxTe9brygo2kArBHT36G1YYpbZeRWpkIa7MycFqRFK2Rfug iyhaiGVmQ2TOmgag4cu55naziicD4NNNbswN70/LxF13YNVznQLerU3kOZc1yfvXX4mE RwQgXTNrWr5sYbaB5mBZZbGZhhPt24pzS/PhE81oc4SpENoWhmF3T2JWSfFxrIsIWiNe SnVjk4zvwPlolxtfuj1dCx6uTGAYruXeY5EeQLrle/PWqhE3T6MKgMhKQhPvYQLoN46C o+hA== X-Forwarded-Encrypted: i=1; AFNElJ8LGVhr3FfxtenSs5Xl/BPlbivvgkLGRUkRFoanEZ+0AKfFMod8a+Zbsy9se726tIQdU4iffmxPtRaDk40=@vger.kernel.org X-Gm-Message-State: AOJu0YxJEz80IKtzairUHBKqTm1o4x4wjv4VAIe4jbkMX99WNLrWQ/tB vdbYEifljPYvIKceteJ9AytuQ/oUfue4bhmKp4dMjGv+vY3HsEQhQqnJHAY/DpK1iw== X-Gm-Gg: Acq92OFk2Fm0+2u7dVcgjmhz1/gnlA9/FqO997UD4ZF7iVEhePKNL9oU9NC96ku8KZN iWZMUAUutzigOBV9Yp1Qaf7dZtOIPiWfamtRhpcB5W5U3hgcHB+iPtvw5izT8Q/1Zrr3J+vE4F4 qTKl/xZvlO2L6XQI4Wjj7tf1L40l0x3SNHpJnqAB6pgmEiPWvT0siVtBSz2fnxIrr/0x8m4PywZ NBCPCE8O31HO//6A3VCySdnk/66yS+spLVs8PEsq4gqhRNMhwzbqdUyBl0ugJcep93rJ0FWtGRu 8ssOqE7ya5VSDkjx3qrJR7F1YojONl722iWjpQAsoE3M1APRzwaRgyWo35pH1nmA8+VhV1p7lkr 1y+NEfj4dX70zriC3ioVpMbFV6KXwrNVrPRGtOqA4qo2TNTbM4Hvw0KUMeQnyhuJp9reOvYElFG TEsPVwUsOZZBELJ4oYJinQ754Tq7Y21zvaQoUEK927WzXYFWQQxLDH0oNgokXhf2g4qaESnoc9L ZviO2B7x3Lcr8ZD X-Received: by 2002:a17:902:fc4c:b0:2c2:1982:527a with SMTP id d9443c01a7336-2c2198254f0mr234468445ad.16.1781106612163; Wed, 10 Jun 2026 08:50:12 -0700 (PDT) Received: from google.com (112.173.50.34.bc.googleusercontent.com. [34.50.173.112]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c2a4a64e22sm56793545ad.61.2026.06.10.08.50.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2026 08:50:11 -0700 (PDT) Date: Wed, 10 Jun 2026 15:50:07 +0000 From: Nick Desaulniers To: Nathan Chancellor Cc: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= , Thomas Gleixner , Thomas Bogendoerfer , Bill Wendling , Justin Stitt , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Nick Desaulniers Subject: Re: [PATCH] MIPS: VDSO: Avoid including .got in dynamic segment Message-ID: References: <20260609-mips-vdso-fix-section-layout-v1-1-0e80ffadf7c7@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260609-mips-vdso-fix-section-layout-v1-1-0e80ffadf7c7@kernel.org> On Tue, Jun 09, 2026 at 06:31:21PM -0700, Nathan Chancellor wrote: > After commit 2db1ec80dfd5 ("MIPS: VDSO: Fold MIPS_DISABLE_VDSO into > MIPS_GENERIC_GETTIMEOFDAY"), building ARCH=mips allnoconfig with LLVM=1 > shows some warnings from llvm-readelf while checking the VDSO for > dynamic relocations: > > llvm-readelf: warning: 'arch/mips/vdso/vdso.so.dbg.raw': invalid PT_DYNAMIC size (0xa4) > llvm-readelf: warning: 'arch/mips/vdso/vdso.so.dbg.raw': PT_DYNAMIC dynamic table is invalid: SHT_DYNAMIC will be used > > The blamed commit alters the link order of objects into vdso.so.raw, > placing vgettimeofday.o after sigreturn.o. This ultimately results in > the .text section shrinking slightly in size, which in turn changes the > offset of the .dynamic section. > > - [ 9] .text PROGBITS 000002f0 0002f0 000930 00 AX 0 0 16 > - [10] .dynamic DYNAMIC 00000c20 000c20 000090 08 A 5 0 4 > + [ 9] .text PROGBITS 000002f0 0002f0 000924 00 AX 0 0 16 > + [10] .dynamic DYNAMIC 00000c14 000c14 000090 08 A 5 0 4 > > Changing the offset of the .dynamic section causes the dynamic segment > size to grow by the same amount, which triggers a warning in > llvm-readelf because PT_DYNAMIC's p_filesz (0xa4) is no longer a > multiple of its sh_entsize (8): > > - DYNAMIC 0x000c20 0x00000c20 0x00000c20 0x00098 0x00098 R 0x10 > + DYNAMIC 0x000c14 0x00000c14 0x00000c14 0x000a4 0x000a4 R 0x10 > > The size of the dynamic segment was already incorrect before the blamed > comment, as it should be 0x90 like the .dynamic section above (18 > entries at 8 bytes per entry); it just so happens that 0x98 % 8 is 0, > whereas 0xa4 % 8 is 4, so there was no warning. > > Looking at the section to segment mapping of the dynamic segment reveals > that it includes the .got section, as it is implicitly placed after > .dynamic by ld.lld's orphan section heuristics and inherits its segments > from the linker script. > > [ 9] .text PROGBITS 000002f0 0002f0 000924 00 AX 0 0 16 > [10] .dynamic DYNAMIC 00000c14 000c14 000090 08 A 5 0 4 > [11] .got PROGBITS 00000cb0 000cb0 000008 00 WAp 0 0 16 > > Section to Segment mapping: > Segment Sections... > 00 .mips_abiflags > 01 .reginfo > 02 .mips_abiflags .reginfo .hash .dynsym .dynstr .gnu.version .gnu.version_d .note .text .dynamic .got > 03 .dynamic .got > 04 .note > > Explicitly describe the .got section in the MIPS VDSO linker script > after .rodata, which switches back to the default text segment, > resulting in a dynamic segment that is the exact size of the .dynamic > section as expected with no other layout changes. > > - DYNAMIC 0x000c14 0x00000c14 0x00000c14 0x000a4 0x000a4 R 0x10 > + DYNAMIC 0x000c14 0x00000c14 0x00000c14 0x00090 0x00090 R 0x4 > > - 03 .dynamic .got > + 03 .dynamic > > Closes: https://github.com/ClangBuiltLinux/linux/issues/2166 > Fixes: 2db1ec80dfd5 ("MIPS: VDSO: Fold MIPS_DISABLE_VDSO into MIPS_GENERIC_GETTIMEOFDAY") > Signed-off-by: Nathan Chancellor Thanks for the patch! Acked-by: Nick Desaulniers > --- > The fixes tag feels a little strong since it seems like it has just been > luck up until this point that there has been no warning but I decided to > be conservative and include it regardless. Feel free to remove it if you > see fit. > > I think this should go via timers/vdso with the blamed commit. I plan to > send a follow up series for 7.3 to add '--orphan-handling' to the MIPS > VDSO to avoid issues like this in the future but that can go via the > MIPS tree, as it is not really a fix and I will need to properly test > it. > --- > arch/mips/vdso/vdso.lds.S | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/mips/vdso/vdso.lds.S b/arch/mips/vdso/vdso.lds.S > index 05badf3ae0ff..278ab6444e98 100644 > --- a/arch/mips/vdso/vdso.lds.S > +++ b/arch/mips/vdso/vdso.lds.S > @@ -56,6 +56,7 @@ SECTIONS > .dynamic : { *(.dynamic) } :text :dynamic > > .rodata : { *(.rodata*) } :text > + .got : { *(.got) } > > _end = .; > PROVIDE(end = .); > > --- > base-commit: 13f6218e6fe79dc64aed76d738b765b45f62492b > change-id: 20260608-mips-vdso-fix-section-layout-262bc18d0c29 > > Best regards, > -- > Cheers, > Nathan >