From: Paul Iannetta <piannetta@kalrayinc.com>
To: Alan Modra <amodra@gmail.com>
Cc: binutils@sourceware.org
Subject: Re: [PATCH] kvx: fix kvx_reassemble_bundle index 8 out of bounds
Date: Thu, 24 Aug 2023 11:26:49 +0200 [thread overview]
Message-ID: <20230824092649.2gucfvnmswr362us@ws2202.lin.mbt.kalray.eu> (raw)
In-Reply-To: <ZOceCbu2r9L9obFC@squeak.grove.modra.org>
[-- Attachment #1: Type: text/plain, Size: 2089 bytes --]
On Thu, Aug 24, 2023 at 06:38:25PM +0930, Alan Modra wrote:
> On Thu, Aug 24, 2023 at 10:49:06AM +0200, Paul Iannetta wrote:
> > On Thu, Aug 24, 2023 at 12:42:33PM +0930, Alan Modra wrote:
> > > On Wed, Aug 23, 2023 at 04:39:19PM +0200, Paul Iannetta via Binutils wrote:
> > > > As discussed earlier, I removed kvx_elf64_linux_vec, fix the handling of unique
> > > > symbols by using has_gnu_osabi instead of overwriting e_ident, change (unsigned)
> > > > long long into {u,}int64 and at some place int by int32_t.
> > >
> > > I've committed these for you. BTW, oss-fuzz is poking at the kvx
> > > support and finding holes. See pr30793.
> >
> > The attached patch should fix pr30793.
>
> decode_prologue_epilogue_bundle too?
Indeed, thanks. (Currently, this is deadcode, because it is only used
by gdb which we have not contribued back yet).
>
> >
> > Thanks,
> > Paul
> >
> >
>
> > >From 03c35cf18fa689bc7d727c506d30c396244cb307 Mon Sep 17 00:00:00 2001
> > From: Paul Iannetta <piannetta@kalrayinc.com>
> > Date: Thu, 24 Aug 2023 10:39:14 +0200
> > Subject: [PATCH] kvx: fix kvx_reassemble_bundle index 8 out of bounds
> >
> > opcodes/ChangeLog:
> >
> > 2023-08-24 Paul Iannetta <piannetta@kalrayinc.com>
> >
> > * kvx-dis.c (print_insn_kvx): Change the loop condition so that
> > wordcount is always less than KVXMAXBUNDLEWORDS.
> > ---
> > opcodes/kvx-dis.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/opcodes/kvx-dis.c b/opcodes/kvx-dis.c
> > index e63430a9e57..a78eb5f84ec 100644
> > --- a/opcodes/kvx-dis.c
> > +++ b/opcodes/kvx-dis.c
> > @@ -1056,7 +1056,7 @@ print_insn_kvx (bfd_vma memaddr, struct disassemble_info *info)
> > wordcount++;
> > }
> > while (kvx_has_parallel_bit (bundle_words[wordcount - 1])
> > - && wordcount < KVXMAXBUNDLEWORDS);
> > + && wordcount < KVXMAXBUNDLEWORDS - 1);
> > invalid_bundle = kvx_reassemble_bundle (wordcount, &insncount);
> > }
> >
> > --
> > 2.35.1.500.gb896f729e2
> >
>
>
> --
> Alan Modra
> Australia Development Lab, IBM
>
>
>
>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-kvx-fix-kvx_reassemble_bundle-index-8-out-of-bounds.patch --]
[-- Type: text/x-diff, Size: 1347 bytes --]
From 73bb3fb50eb05cf57795e6a078c0758658519df3 Mon Sep 17 00:00:00 2001
From: Paul Iannetta <piannetta@kalrayinc.com>
Date: Thu, 24 Aug 2023 10:39:14 +0200
Subject: [PATCH] kvx: fix kvx_reassemble_bundle index 8 out of bounds
opcodes/ChangeLog:
2023-08-24 Paul Iannetta <piannetta@kalrayinc.com>
* kvx-dis.c (print_insn_kvx): Change the loop condition so that
wordcount is always less than KVXMAXBUNDLEWORDS.
(decode_prologue_epilogue_bundle): Likewise.
---
opcodes/kvx-dis.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/opcodes/kvx-dis.c b/opcodes/kvx-dis.c
index e63430a9e57..2a5aa1d6cde 100644
--- a/opcodes/kvx-dis.c
+++ b/opcodes/kvx-dis.c
@@ -1056,7 +1056,7 @@ print_insn_kvx (bfd_vma memaddr, struct disassemble_info *info)
wordcount++;
}
while (kvx_has_parallel_bit (bundle_words[wordcount - 1])
- && wordcount < KVXMAXBUNDLEWORDS);
+ && wordcount < KVXMAXBUNDLEWORDS - 1);
invalid_bundle = kvx_reassemble_bundle (wordcount, &insncount);
}
@@ -1237,7 +1237,7 @@ decode_prologue_epilogue_bundle (bfd_vma memaddr,
nb_syl++;
}
while (kvx_has_parallel_bit (bundle_words[nb_syl - 1])
- && nb_syl < KVXMAXBUNDLEWORDS);
+ && nb_syl < KVXMAXBUNDLEWORDS - 1);
if (kvx_reassemble_bundle (nb_syl, &nb_insn))
return -1;
--
2.35.1.500.gb896f729e2
next prev parent reply other threads:[~2023-08-24 9:26 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-22 16:01 [PATCH] kvx: fix 32-bit build and validation Paul Iannetta
2023-08-23 0:27 ` Alan Modra
2023-08-23 7:44 ` Paul Iannetta
2023-08-23 12:14 ` Alan Modra
2023-08-23 14:39 ` [PATCH 0/4] kvx: various fixes Paul Iannetta
2023-08-23 14:39 ` [PATCH 1/4] kvx: remove kvx_elf64_linux_vec Paul Iannetta
2023-08-23 14:39 ` [PATCH 2/4] kvx: fix handling of STB_GNU_UNIQUE symbols Paul Iannetta
2023-08-23 14:39 ` [PATCH 3/4] kvx: use {u,}int32_t and {u,}int64_t Paul Iannetta
2023-08-23 14:39 ` [PATCH 4/4] kvx: bfd/config.bfd & ld/configure.tgt Paul Iannetta
2023-08-24 3:12 ` [PATCH 0/4] kvx: various fixes Alan Modra
2023-08-24 6:26 ` Paul Iannetta
2023-08-24 8:49 ` [PATCH] kvx: fix kvx_reassemble_bundle index 8 out of bounds Paul Iannetta
2023-08-24 9:08 ` Alan Modra
2023-08-24 9:26 ` Paul Iannetta [this message]
2023-09-07 12:46 ` Alan Modra
2023-09-07 15:27 ` Paul Iannetta
2023-08-23 14:40 ` [PATCH] kvx: fix 32-bit build and validation Paul Iannetta
2023-08-23 3:16 ` Alan Modra
2023-08-23 13:39 ` Luis Machado
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=20230824092649.2gucfvnmswr362us@ws2202.lin.mbt.kalray.eu \
--to=piannetta@kalrayinc.com \
--cc=amodra@gmail.com \
--cc=binutils@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).