Message ID | 20230824113249.1197514-1-torbjorn.svensson@foss.st.com |
---|---|
State | Accepted |
Headers |
Return-Path: <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a7d1:0:b0:3f2:4152:657d with SMTP id p17csp1052019vqm; Thu, 24 Aug 2023 04:33:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF79uhYmjk1WxSiAT/EFjkC69rvJ15uIWJaSAllHodrhr6IVtZMmdXz+RU0vN0CQAFSpgQg X-Received: by 2002:a19:8c0f:0:b0:500:7685:839 with SMTP id o15-20020a198c0f000000b0050076850839mr8943295lfd.65.1692876818379; Thu, 24 Aug 2023 04:33:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692876818; cv=none; d=google.com; s=arc-20160816; b=TvsY18hbpzk9oM2k3Cv1veiD2jW1PMCRH2Z90l6mzGhf5W/5fDyLvB6m/EkXoxqdwt 3ZThGsRRY1QtrA9HfbKFs0N0Rqy23I66HiuGxgAK3JnuCA01oMcG2N0EkM5G/cl9rkKm b6PfpAWYq6y3tzXLJdgp70r4Qv52N1e+3EHwFmXHmc/hKOutZed8j2yqYvA3SsqT1hIn 0Zrt0cZXMs9dx2zpTE0Ck+3ekC4T5urY+/E9LHWW3njDpqgPT38ZN+rTZYeqWoQAcDWn x/z/st1hkyqlxm7a5wviRYe6b4fnPs1elVZXxWEJ0gdOy2JTuuLUUSp4H3MZhLAR17eM xClA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=xG95D+qbTRvfCpmgA+ZhpNLU1izv6DyqulJR28/OwlI=; fh=N75XyrYMqmzsevkL9IL1qzKDkPkFjcF8xFSMOEBzmJI=; b=cyLIeeaSnmcf/SOocUL5Es7akst+myS/W5YFMw1pzjc/6v246Z0Lf+f0s4ORhgHtti TjruRPJuvCFUEGkYuUN/tFWUzTp+j/9z1xMks90czknZzeCODBaIST9PSrgIdNRcY9mV 8u93GwiizwZ2Ohxi5eJrQfCWtCwNykXGsLhm6LdPl9jSzGOf0og1f3p6sQN4cAtwjDkm qXyCc32Sd04oPzMuiFT+uplUwU4k29zUhr6hPfxKpDMsSZMjOB3CAY5RtMwst9x0ANUX KU1JicJ/r4o+pKvCiEl2QfR0PJ/zDX0/ypoAAmlZKwIWe2O8RFgttedYI8oddSVJB2Vr RNog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=nUGYsCoj; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id f26-20020a056402161a00b00525425365d3si10071958edv.8.2023.08.24.04.33.38 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Aug 2023 04:33:38 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=nUGYsCoj; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2FDD53857438 for <ouuuleilei@gmail.com>; Thu, 24 Aug 2023 11:33:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2FDD53857438 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1692876817; bh=xG95D+qbTRvfCpmgA+ZhpNLU1izv6DyqulJR28/OwlI=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=nUGYsCojsz5HOEEfTRWXd6wBaJXGzoa+UmPNRK3CeqSC5ZN7HyjCIaORTe9nRd2iK 9J8QFKi+WbYMRM2/jHzsg7waRiPiaPOFgMz4nxnmdMPhn9TAl2GdCdf6LdRQ4XsfqM ATIDXmrxXaZGx3ziM07yNMp7yWMKecX4RdPIByj0= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx08-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by sourceware.org (Postfix) with ESMTPS id 2A7963858426 for <binutils@sourceware.org>; Thu, 24 Aug 2023 11:33:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2A7963858426 Received: from pps.filterd (m0369457.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 37O9cUe2000385 for <binutils@sourceware.org>; Thu, 24 Aug 2023 13:33:16 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3sn1y5qmbt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for <binutils@sourceware.org>; Thu, 24 Aug 2023 13:33:16 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 22EFB10005C for <binutils@sourceware.org>; Thu, 24 Aug 2023 13:33:15 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id E598822D16E for <binutils@sourceware.org>; Thu, 24 Aug 2023 13:33:15 +0200 (CEST) Received: from jkgcxl0004.jkg.st.com (10.74.22.255) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 24 Aug 2023 13:33:15 +0200 To: <binutils@sourceware.org> CC: =?utf-8?q?Torbj=C3=B6rn_SVENSSON?= <torbjorn.svensson@foss.st.com>, Yvan ROUX <yvan.roux@foss.st.com> Subject: [PATCH] libctf: ctf_member_next needs to return (ssize_t)-1 on error Date: Thu, 24 Aug 2023 13:32:49 +0200 Message-ID: <20230824113249.1197514-1-torbjorn.svensson@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.74.22.255] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-24_08,2023-08-24_01,2023-05-22_02 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> From: =?utf-8?q?Torbj=C3=B6rn_SVENSSON_via_Binutils?= <binutils@sourceware.org> Reply-To: =?utf-8?q?Torbj=C3=B6rn_SVENSSON?= <torbjorn.svensson@foss.st.com> Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" <binutils-bounces+ouuuleilei=gmail.com@sourceware.org> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1775110002689161763 X-GMAIL-MSGID: 1775110002689161763 |
Series |
libctf: ctf_member_next needs to return (ssize_t)-1 on error
|
|
Checks
Context | Check | Description |
---|---|---|
snail/binutils-gdb-check | success | Github commit url |
Commit Message
Torbjorn SVENSSON
Aug. 24, 2023, 11:32 a.m. UTC
The function ctf_member_next should return (ssize_t)-1 on
error. As the function ctf_set_errno returns (ctf_id_t)-1L and that is
then casted to "unsigned long" as it's the return type of the function,
it's not compatible and causes the value 0xffffffff to be returned on
64-bit Windows builds. As a result, the check for a negative value in
ctf_dedup_rhash_type will never be true and a resulting infinit loop is
created.
This was found testing an arm-none-eabi toolchain built with
x86_64-w64-mingw32. If the same source tree is built with
i686-w64-mingw32, everything appears to be working correctly.
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
---
libctf/ctf-types.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On Thu, Aug 24, 2023 at 01:32:49PM +0200, Torbjörn SVENSSON via Binutils wrote: > diff --git a/libctf/ctf-types.c b/libctf/ctf-types.c > index c20ff825d9a..058b647ba9a 100644 > --- a/libctf/ctf-types.c > +++ b/libctf/ctf-types.c > @@ -233,7 +233,8 @@ ctf_member_next (ctf_dict_t *fp, ctf_id_t type, ctf_next_t **it, > end_iter: > ctf_next_destroy (i); > *it = NULL; > - return ctf_set_errno (ofp, ECTF_NEXT_END); > + ctf_set_errno (ofp, ECTF_NEXT_END); > + return -1; > } > > /* Iterate over the members of an ENUM. We pass the string name and associated This isn't the correct fix. There are many uses of ctf_set_errno, even in the function you are patching. Some other fix is needed to cope with unsigned long being smaller than ssize_t for the Microsoft 64-bit ABIs.
diff --git a/libctf/ctf-types.c b/libctf/ctf-types.c index c20ff825d9a..058b647ba9a 100644 --- a/libctf/ctf-types.c +++ b/libctf/ctf-types.c @@ -233,7 +233,8 @@ ctf_member_next (ctf_dict_t *fp, ctf_id_t type, ctf_next_t **it, end_iter: ctf_next_destroy (i); *it = NULL; - return ctf_set_errno (ofp, ECTF_NEXT_END); + ctf_set_errno (ofp, ECTF_NEXT_END); + return -1; } /* Iterate over the members of an ENUM. We pass the string name and associated