Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp645510rdb; Tue, 16 Jan 2024 11:11:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IH6HjhrKgsjV6Bj3Y8sLQ+Vhz+x9l7g1oNgkxbhddxPOKWvay56XrysQ6bzXJlszH2kXG+D X-Received: by 2002:ac8:7e93:0:b0:42a:4cf:8131 with SMTP id w19-20020ac87e93000000b0042a04cf8131mr1610946qtj.98.1705432280578; Tue, 16 Jan 2024 11:11:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705432280; cv=pass; d=google.com; s=arc-20160816; b=v+vRCnR/ouBpIDqPhvbKxRKwUKVmkAgUpqcV+IjWTkfQFkJVeLDrR1UN/SrRy5bN4O d/l2Z5twj+Zh8+0nHbFuZwumAluapL2XFrREXNyYyU3wtkwfYW52tgIdp1vNUQ04nMBQ 3o/aYTqPZFLYdWq6ZU+khtsri9QKBYZU8rU0Mr2GL4kFcMt4IuuzIhH43SwmPEZzclbC kMtr8okRfMmDEzryZSRgEMeltInYF711W9i3Nxw1ib9OhVADNrGQWzPKNcLUyviaIqpP FSFX/0+bfuIfyQkhSoeQr8iq0lxS/S9mszkx3VTsxMxA2U5Q03axZF58askpObBfP/1K am1A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2B6FD9kC9gHwUyAkY7d7mb5bcweoO7jseq9GNZcWT/U=; fh=sLlGX4KwWmNNm5EEmMq1LSDk+0vAZSkHhOCDyXKXWSU=; b=zxKiCS7AgpMqqj3DcFwpnKscgla7T/knx4JLzuskgz9H+In0eM6dgSviW6id2K5lzH Vo7IVAU9h9Z2QAXSoNYIP4li5u0fe8A2BmmdlaUlcgJwVOpxxCuZYtZ2eGr9+VeEsXbQ hqIOnLOq83AmPTyV8jGi3TU7Innf959GuPcXoX4o8hYg7JHCK88c5QRHHQWlq7ROi5Nl Q10uNBZMavvElJteHrohJOTy+RkmHRmtI7P8vzgatr4Ma0JF5k+zedFWJwL9+nQwEsLd 1wARYASvJT4F3IZCzz/IRM8RQ/7niSkAV7hxSTxg5FErelwUUuXKu2DBk21FS5lCAoTN h0Eg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gnuweeb.org header.s=default header.b="d/OeJr2K"; arc=pass (i=1 dkim=pass dkdomain=gnuweeb.org); spf=pass (google.com: domain of linux-kernel+bounces-27736-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27736-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=gnuweeb.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id e18-20020ac85dd2000000b00428340b0ae5si10570235qtx.731.2024.01.16.11.11.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 11:11:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27736-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gnuweeb.org header.s=default header.b="d/OeJr2K"; arc=pass (i=1 dkim=pass dkdomain=gnuweeb.org); spf=pass (google.com: domain of linux-kernel+bounces-27736-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27736-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=gnuweeb.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4C2B41C239E3 for ; Tue, 16 Jan 2024 19:11:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D328F1D529; Tue, 16 Jan 2024 19:11:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gnuweeb.org header.i=@gnuweeb.org header.b="d/OeJr2K" Received: from gnuweeb.org (gnuweeb.org [51.81.211.47]) (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 C81671D521 for ; Tue, 16 Jan 2024 19:11:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=gnuweeb.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gnuweeb.org Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=51.81.211.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705432273; cv=none; b=i9Uga6WqybmiMpFcPghHxHLCkJ/IGeCuz5HYbk5RpHIIwnM85vMiiiNF9YNrWiw/wwVSGfu2X/jL4VlnmyI1eAJgFuocloPqjy+gLxTlQmem0Ya3O88rsdRzmBIgll2JpaEWGAmDbIqXfXT45zPoyE6ckHpVKvVwxmqkg8uNYkY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705432273; c=relaxed/simple; bh=QHoB78cJOL25PB7cy0vQdTJF5vkSAXmPONmp3oHOHMA=; h=DKIM-Signature:Received:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To:X-Bpl; b=ODKUX7c8G2Xb+R3mkhC7C3JtnlEYpKy4GBZw5nMWWZsFc4lPMX8olU79GwZKzFzN0O9KMQXijDjeAFrbUkERV+8nj3laeW/LlIBOG0x4JOWxd6LDKtjxLY4XV7aJwTH6kCKz1yBhnKerwtGxhth1KUqoljsqAu2qz2TMigqg45g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gnuweeb.org header.i=@gnuweeb.org header.b=d/OeJr2K; arc=none smtp.client-ip=51.81.211.47 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1705432272; bh=QHoB78cJOL25PB7cy0vQdTJF5vkSAXmPONmp3oHOHMA=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=d/OeJr2Kt7RWSVtin71qo4ogb2W/phbU7XMAbxF0oKasjko4er6LZfiFhgq4t9HeG kRPd+VS6CDrfswitnxKlnZtKcIAbq+TrTPaVM3eT71XUn3L4mIT3thOwOmoo9M9u4s 3pUcPMSKMKZJKj0vupYGhrHz4Kq981MeRp+6ylNuDEBNdAhzkVyoOIkFIz0MaMvmJi uD7cNvndVsjo1dHBHwh88v10NZcAgMmY1Lu4kTHqF8eFerLrXeEcXDHmAXFlbmVV+u MGbqDdB0BxOM1wbrzrcgZQq2gHk7IV9Y4RRiLHn156JUGP4aJX14WElYsB7sk1Qlls MFDoN9sYwRz4w== Received: from biznet-home.integral.gnuweeb.org (unknown [182.253.126.189]) by gnuweeb.org (Postfix) with ESMTPSA id 55C7424C3A2; Wed, 17 Jan 2024 02:11:10 +0700 (WIB) Date: Wed, 17 Jan 2024 02:11:05 +0700 From: Ammar Faizi To: Willy Tarreau Cc: Charles Mirabile , linux-kernel@vger.kernel.org, Thomas =?iso-8859-1?Q?Wei=DFschuh?= Subject: Re: [PATCH] nolibc/stdlib: Improve `getauxval(3)` implementation Message-ID: References: <20240116181147.2230944-1-cmirabil@redhat.com> 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: X-Bpl: hUx9VaHkTWcLO7S8CQCslj6OzqBx2hfLChRz45nPESx5VSB/xuJQVOKOB1zSXE3yc9ntP27bV1M1 On Tue, Jan 16, 2024 at 07:59:39PM +0100, Willy Tarreau wrote: > On Tue, Jan 16, 2024 at 07:58:09PM +0100, Willy Tarreau wrote: > > On Wed, Jan 17, 2024 at 01:52:06AM +0700, Ammar Faizi wrote: > > > What do you think about other architectures? Will it potentially be > > > misinterpreted? > > > > Indeed, it would fail on a 64-bit big endian architecture. Let's > > just declare the local variable the same way as it is in the spec, > > it will be much cleaner and more reliable. > > With that said, if previous code used to work on such architectures, > maybe the definition above is only for x86_64 and differs on other > archs. Maybe it's really defined as two longs ? I just took a look at the kernel source code: https://github.com/torvalds/linux/blob/v6.7/fs/binfmt_elf.c#L226-L261 The auxv is stored in `elf_info` variable, the type is `elf_addr_t`. Not sure what kind of typedef is that. I'll check. Each auxv entry is added using this macro: #define NEW_AUX_ENT(id, val) \ do { \ *elf_info++ = id; \ *elf_info++ = val; \ } while (0) where `id` is the type. That clearly implies `type` and `val` have the same size on the Linux kernel. -- Ammar Faizi