[PATCH] elf: Use the 64-bit wide 'seen' variable
Nikita Ermakov
sh1r4s3@mail.si-head.nl
Sat Aug 7 14:22:23 GMT 2021
The 32-bit 'seen' variable doesn't allow to check any auxiliary entry
type with a value greater than 31 as it leads to wrapping and crumbling
of the 'seen' variable.
For example, if AT_UID (which is 11) would precede AT_L1D_CACHEGEOMETRY
(which is 43), then uid would be overridden by an AT_L1D_CACHEGEOMETRY
value.
Using 64-bit wide 'seen' variable allows to handle such situations.
Signed-off-by: Nikita Ermakov <sh1r4s3@mail.si-head.nl>
---
elf/dl-sysdep.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c
index d47bef1340..bb81d3be57 100644
--- a/elf/dl-sysdep.c
+++ b/elf/dl-sysdep.c
@@ -96,12 +96,12 @@ _dl_sysdep_start (void **start_argptr,
#else
uid_t uid = 0;
gid_t gid = 0;
- unsigned int seen = 0;
+ uint64_t seen = 0;
# define set_seen_secure() (seen = -1)
# ifdef HAVE_AUX_XID
# define set_seen(tag) (tag) /* Evaluate for the side effects. */
# else
-# define M(type) (1 << (type))
+# define M(type) ((uint64_t)1 << (type))
# define set_seen(tag) seen |= M ((tag)->a_type)
# endif
#endif
--
2.32.0
More information about the Libc-alpha
mailing list