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 85BC53B2BA for ; Sat, 4 Apr 2026 08:34:26 +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=1775291668; cv=none; b=ZhWeBYNu9fjPgzrnJDjMJ3vrT3WTp9FZBdgaL9z4qQ9Te20MHFjGFjuRtUeWuBN1Kx14T3gDXUk9hZWFI+ZBg+0EI1EsJEpqKPi9VPzdaLZyIy31OceKFMRMBl288qCYA8gq+QlXyzJty7uPv/i0oyeLJOPEb/UOQ0gsEVp8nIg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775291668; c=relaxed/simple; bh=mMH7Lm9sFcJB1fLrK8jvECgdpUFos+TWB7M4bfSQbwM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FnFVCwGJPH/R22vcWrXoyQxfKjgsJomCtcYNJsy9WLP5KxTgD1v11/jQGN8/3bxtaXPx4c9XYk5miEpunqBF7+NfRC3Nb1r1Uk+QEorN6pu9e+B+y9Y/Ql3CjHQSKrpDBlRRomGCV3odpMD7GDeGafzT0E6eThAZA4uCWXFYJE4= 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=GjSHppwN; 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="GjSHppwN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1wt.eu; s=mail; t=1775291665; bh=Ks530s8XiKhQ8Xny8C5oLS4Xdq0Z8zbS8z1zjpFwWcQ=; h=From:Message-ID:From; b=GjSHppwNca+1TX7Max8Yh0jgN96YNhF0ax4ce3UM8+KaPdWNelOFHarLHJ5L3xkBp VEEH5o+YcbnnPMfZ0cNkGBc/VLLumvo+0iN1WhU28Y19EwjnjjfdP7F5qNybPqH3eH ZnS4m4UxKGgt45rbUvxP/0aQvSafxV73+m+TUVZ4= Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by mta1.formilux.org (Postfix) with ESMTP id E6C3CC0EA5; Sat, 04 Apr 2026 10:34:24 +0200 (CEST) Date: Sat, 4 Apr 2026 10:34:24 +0200 From: Willy Tarreau To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] tools/nolibc: use __builtin_offsetof() Message-ID: References: <20260401-nolibc-asprintf-v1-0-46292313439f@weissschuh.net> <20260401-nolibc-asprintf-v1-1-46292313439f@weissschuh.net> 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260401-nolibc-asprintf-v1-1-46292313439f@weissschuh.net> Hi Thomas, On Wed, Apr 01, 2026 at 05:07:27PM +0200, Thomas Weißschuh wrote: > The current custom implementation of offsetof() fails UBSAN: > runtime error: member access within null pointer of type 'struct ...' > This means that all its users, including container_of(), free() and > realloc(), fail. > > Use __builtin_offsetof() instead which does not have this issue and > has been available since GCC 4 and clang 4. Yeah, that's a place where I find the standard ambiguous and ridiculously absurd (since there's no dereference, only an address calculations), but I had to do the same in haproxy recently for the same reasons, and I didn't remember that we had it in nolibc as well. So that's an obvious ack! Acked-by: Willy Tarreau thanks, Willy