From: Nikita Ermakov <sh1r4s3@mail.si-head.nl>
To: libc-alpha@sourceware.org
Cc: Nikita Ermakov <sh1r4s3@mail.si-head.nl>
Subject: [PATCH] elf: Use the 64-bit wide 'seen' variable
Date: Sat, 7 Aug 2021 17:22:23 +0300 [thread overview]
Message-ID: <20210807142223.58295-1-sh1r4s3@mail.si-head.nl> (raw)
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
next reply other threads:[~2021-08-07 14:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-07 14:22 Nikita Ermakov [this message]
2021-08-09 0:46 ` Dmitry V. Levin
2021-08-09 7:48 ` Andreas Schwab
2021-08-17 18:03 ` Nikita Ermakov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210807142223.58295-1-sh1r4s3@mail.si-head.nl \
--to=sh1r4s3@mail.si-head.nl \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).