From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta1.formilux.org (mta1.formilux.org [51.159.59.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C7CA46BF for ; Sat, 7 Feb 2026 15:45:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=51.159.59.229 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770479120; cv=none; b=glS72BzpY4AgbUh/x3ReTinUhrMTo0kH9Dq0fKAEHy48Kq0Q/2+mQCvh8unEmYhARQY6T3dcuWwv4HMjVPnwCvBelXpptHQq8JsGi/WSS/dVV+6P7YWPlruri4nRPD8nqdHEMry2P6RCtjGGyXCq77jJXrzUcziLfliCsY9NQ5g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770479120; c=relaxed/simple; bh=htNEWlq6IkAlRP3Io5v5UU3E0GKzBKI41LnyMcIwNOA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PM9Jc+RU92Cj7ASr6VMOIO0Xy8osMame7KJc9W01NjBEHp7LYtbXZoQau65J6cycMPBXyH8vypW/iuYqsIzXlRuuy76IymlDxXf/W4gNJaNV27l4c5MQ2JRegWxT9neqmBzIdCHWwn404tmLv4tG8sbhCtspei24P4SSzjY/fnk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=1wt.eu; spf=pass smtp.mailfrom=1wt.eu; dkim=pass (1024-bit key) header.d=1wt.eu header.i=@1wt.eu header.b=Xg5KnKzH; arc=none smtp.client-ip=51.159.59.229 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=1wt.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=1wt.eu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=1wt.eu header.i=@1wt.eu header.b="Xg5KnKzH" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1wt.eu; s=mail; t=1770479117; bh=uXhJIG3YCUZAV+LA8zAx7K83vkkYEo/Cg0u6zAT3pe4=; h=From:Message-ID:From; b=Xg5KnKzHxwo9wHTFcnZCC1orZGaiETrCmSiIu0pajySeeDnkGnyTsp/KuZ2FHF7OI DGZ3KM0xgZqoaEAWIyaz1hyK7vvx65bf9Qk1oVHG/B1EvHw4vh8r0Kmmgs75yx2wEq M53fylJLz3x9R+lSYzT7Cx/M2DEw8xRiy/Jejl+w= Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by mta1.formilux.org (Postfix) with ESMTP id AD90DC0B44; Sat, 07 Feb 2026 16:45:17 +0100 (CET) Date: Sat, 7 Feb 2026 16:45:17 +0100 From: Willy Tarreau To: Daniel Palmer Cc: linux@weissschuh.net, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v2 02/10] tools/nolibc: crt: Split _start_c() into stack-only and normal parts Message-ID: References: <20260204124542.523567-1-daniel@thingy.jp> <20260204124542.523567-3-daniel@thingy.jp> 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: <20260204124542.523567-3-daniel@thingy.jp> On Wed, Feb 04, 2026 at 09:45:34PM +0900, Daniel Palmer wrote: > To prepare for nolibc programs being able to relocate themselves > we need to split _start_c() into two parts: > > - One part that only uses the stack so there are no accesses via > the GOT etc that isn't setup yet. Note that on m68k at least > this also means forcing the stackprotector off because accessing > the stack protector canary is done via the GOT. > > - Another part that is called after we have done relocation so it > is safe to access global variables etc that might use the GOT etc. > > Signed-off-by: Daniel Palmer > --- > tools/include/nolibc/compiler.h | 6 ++++ > tools/include/nolibc/crt.h | 57 ++++++++++++++++++--------------- > 2 files changed, 38 insertions(+), 25 deletions(-) > > diff --git a/tools/include/nolibc/compiler.h b/tools/include/nolibc/compiler.h > index 87090bbc53e0..3f403e54e4f4 100644 > --- a/tools/include/nolibc/compiler.h > +++ b/tools/include/nolibc/compiler.h > @@ -47,4 +47,10 @@ > # define __nolibc_fallthrough do { } while (0) > #endif /* __nolibc_has_attribute(fallthrough) */ > > +#if __nolibc_has_feature(undefined_behavior_sanitizer) > +# define __no_sanitize __attribute__((no_sanitize("function"))) > +#else > +# define __no_sanitize > +#endif I'm starting to feel uncomfortable with the addition of new __no_foo stuff, which doesn't have the "nolibc" prefix, risking to conflict with userland code. I think we'll have to go through a cleanup patch at some point for __no_sanitize and __no_stack_protector. So probably in order to reduce the technical debt it would be nice to to prepend __nolibc in front of this new internal macro. Maybe this part of the patch should be a separate cleanup patch by the way, as future patches might depend on it. Willy