public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH releases/gcc-13 1/2] libgcc: Fix eh_frame fast path in find_fde_tail
@ 2023-07-18 14:15 Florian Weimer
  2023-07-18 14:15 ` [PATCH releases/gcc-13 2/2] libgcc: Fix -Wint-conversion warning " Florian Weimer
  2023-07-18 14:56 ` [PATCH releases/gcc-13 1/2] libgcc: Fix eh_frame fast path " Richard Biener
  0 siblings, 2 replies; 3+ messages in thread
From: Florian Weimer @ 2023-07-18 14:15 UTC (permalink / raw)
  To: gcc-patches

The eh_frame value is only used by linear_search_fdes, not the binary
search directly in find_fde_tail, so the bug is not immediately
apparent with most programs.

Fixes commit e724b0480bfa5ec04f39be8c7290330b495c59de ("libgcc:
Special-case BFD ld unwind table encodings in find_fde_tail").

libgcc/

	PR libgcc/109712
	* unwind-dw2-fde-dip.c (find_fde_tail): Correct fast path for
	parsing eh_frame.

(cherry picked from commit 49310a993308492348119f4033e4db0bda4fe46a)
---
 libgcc/unwind-dw2-fde-dip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libgcc/unwind-dw2-fde-dip.c b/libgcc/unwind-dw2-fde-dip.c
index 6223f5f18a2..4e0b880513f 100644
--- a/libgcc/unwind-dw2-fde-dip.c
+++ b/libgcc/unwind-dw2-fde-dip.c
@@ -403,8 +403,8 @@ find_fde_tail (_Unwind_Ptr pc,
 	 BFD ld generates.  */
       signed value __attribute__ ((mode (SI)));
       memcpy (&value, p, sizeof (value));
+      eh_frame = p + value;
       p += sizeof (value);
-      dbase = value;		/* No adjustment because pcrel has base 0.  */
     }
   else
     p = read_encoded_value_with_base (hdr->eh_frame_ptr_enc,

base-commit: a1322d76ca1c3c914fb818d9ba3edc291ccfa25e
-- 
2.41.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH releases/gcc-13 2/2] libgcc: Fix -Wint-conversion warning in find_fde_tail
  2023-07-18 14:15 [PATCH releases/gcc-13 1/2] libgcc: Fix eh_frame fast path in find_fde_tail Florian Weimer
@ 2023-07-18 14:15 ` Florian Weimer
  2023-07-18 14:56 ` [PATCH releases/gcc-13 1/2] libgcc: Fix eh_frame fast path " Richard Biener
  1 sibling, 0 replies; 3+ messages in thread
From: Florian Weimer @ 2023-07-18 14:15 UTC (permalink / raw)
  To: gcc-patches

Fixes commit r14-1614-g49310a99330849 ("libgcc: Fix eh_frame fast path
in find_fde_tail").

libgcc/

	PR libgcc/110179
	* unwind-dw2-fde-dip.c (find_fde_tail): Add cast to avoid
	implicit conversion of pointer value to integer.

(cherry picked from commit 104b09005229ef48a79a33511ea192bb3ec3c415)
---
 libgcc/unwind-dw2-fde-dip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libgcc/unwind-dw2-fde-dip.c b/libgcc/unwind-dw2-fde-dip.c
index 4e0b880513f..28ea0e64e0e 100644
--- a/libgcc/unwind-dw2-fde-dip.c
+++ b/libgcc/unwind-dw2-fde-dip.c
@@ -403,7 +403,7 @@ find_fde_tail (_Unwind_Ptr pc,
 	 BFD ld generates.  */
       signed value __attribute__ ((mode (SI)));
       memcpy (&value, p, sizeof (value));
-      eh_frame = p + value;
+      eh_frame = (_Unwind_Ptr) (p + value);
       p += sizeof (value);
     }
   else
-- 
2.41.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH releases/gcc-13 1/2] libgcc: Fix eh_frame fast path in find_fde_tail
  2023-07-18 14:15 [PATCH releases/gcc-13 1/2] libgcc: Fix eh_frame fast path in find_fde_tail Florian Weimer
  2023-07-18 14:15 ` [PATCH releases/gcc-13 2/2] libgcc: Fix -Wint-conversion warning " Florian Weimer
@ 2023-07-18 14:56 ` Richard Biener
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Biener @ 2023-07-18 14:56 UTC (permalink / raw)
  To: Florian Weimer; +Cc: gcc-patches

On Tue, Jul 18, 2023 at 4:19 PM Florian Weimer via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> The eh_frame value is only used by linear_search_fdes, not the binary
> search directly in find_fde_tail, so the bug is not immediately
> apparent with most programs.
>
> Fixes commit e724b0480bfa5ec04f39be8c7290330b495c59de ("libgcc:
> Special-case BFD ld unwind table encodings in find_fde_tail").

Both are OK to backport.

> libgcc/
>
>         PR libgcc/109712
>         * unwind-dw2-fde-dip.c (find_fde_tail): Correct fast path for
>         parsing eh_frame.
>
> (cherry picked from commit 49310a993308492348119f4033e4db0bda4fe46a)
> ---
>  libgcc/unwind-dw2-fde-dip.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libgcc/unwind-dw2-fde-dip.c b/libgcc/unwind-dw2-fde-dip.c
> index 6223f5f18a2..4e0b880513f 100644
> --- a/libgcc/unwind-dw2-fde-dip.c
> +++ b/libgcc/unwind-dw2-fde-dip.c
> @@ -403,8 +403,8 @@ find_fde_tail (_Unwind_Ptr pc,
>          BFD ld generates.  */
>        signed value __attribute__ ((mode (SI)));
>        memcpy (&value, p, sizeof (value));
> +      eh_frame = p + value;
>        p += sizeof (value);
> -      dbase = value;           /* No adjustment because pcrel has base 0.  */
>      }
>    else
>      p = read_encoded_value_with_base (hdr->eh_frame_ptr_enc,
>
> base-commit: a1322d76ca1c3c914fb818d9ba3edc291ccfa25e
> --
> 2.41.0
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-18 14:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-18 14:15 [PATCH releases/gcc-13 1/2] libgcc: Fix eh_frame fast path in find_fde_tail Florian Weimer
2023-07-18 14:15 ` [PATCH releases/gcc-13 2/2] libgcc: Fix -Wint-conversion warning " Florian Weimer
2023-07-18 14:56 ` [PATCH releases/gcc-13 1/2] libgcc: Fix eh_frame fast path " Richard Biener

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).