[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZabUyZG3C3LUax6f@biznet-home.integral.gnuweeb.org>
Date: Wed, 17 Jan 2024 02:11:05 +0700
From: Ammar Faizi <ammarfaizi2@...weeb.org>
To: Willy Tarreau <w@....eu>
Cc: Charles Mirabile <cmirabil@...hat.com>, linux-kernel@...r.kernel.org,
Thomas Weißschuh <linux@...ssschuh.net>
Subject: Re: [PATCH] nolibc/stdlib: Improve `getauxval(3)` implementation
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
Powered by blists - more mailing lists