From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.si-head.nl (si-head.tilaa.cloud [37.252.121.114]) by sourceware.org (Postfix) with ESMTPS id E41B43858404 for ; Sat, 7 Aug 2021 14:22:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E41B43858404 Received: from localhost.localdomain (unknown [193.169.4.174]) by mail.si-head.nl (Postfix) with ESMTPSA id D916BC001B; Sat, 7 Aug 2021 17:22:45 +0300 (MSK) From: Nikita Ermakov To: libc-alpha@sourceware.org Cc: Nikita Ermakov Subject: [PATCH] elf: Use the 64-bit wide 'seen' variable Date: Sat, 7 Aug 2021 17:22:23 +0300 Message-Id: <20210807142223.58295-1-sh1r4s3@mail.si-head.nl> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KHOP_HELO_FCRDNS, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2021 14:22:51 -0000 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 --- 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