From: Paul Durrant <xadimgnik@gmail.com>
To: "'Michael Young'" <m.a.young@durham.ac.uk>
Cc: xen-devel@lists.xenproject.org, 'Tim Deegan' <tim@xen.org>
Subject: RE: Build problems in kdd.c with xen-4.14.0-rc4
Date: Fri, 3 Jul 2020 11:34:28 +0100 [thread overview]
Message-ID: <004701d65125$87f4de60$97de9b20$@xen.org> (raw)
In-Reply-To: <alpine.LFD.2.22.394.2007031044330.1956@austen3.home>
> -----Original Message-----
> From: Michael Young <m.a.young@durham.ac.uk>
> Sent: 03 July 2020 10:49
> To: paul@xen.org
> Cc: xen-devel@lists.xenproject.org; 'Tim Deegan' <tim@xen.org>
> Subject: RE: Build problems in kdd.c with xen-4.14.0-rc4
>
> On Fri, 3 Jul 2020, Paul Durrant wrote:
>
> >> -----Original Message-----
> >> From: Xen-devel <xen-devel-bounces@lists.xenproject.org> On Behalf Of Michael Young
> >> Sent: 30 June 2020 23:22
> >> To: xen-devel@lists.xenproject.org
> >> Cc: Tim Deegan <tim@xen.org>
> >> Subject: Build problems in kdd.c with xen-4.14.0-rc4
> >>
> >> I get the following errors when trying to build xen-4.14.0-rc4
> >>
> >> kdd.c: In function 'kdd_tx':
> >> kdd.c:754:15: error: array subscript 16 is above array bounds of 'uint8_t[16]' {aka 'unsigned
> >> char[16]'} [-Werror=array-bounds]
> >> 754 | s->txb[len++] = 0xaa;
> >> | ~~~~~~^~~~~~~
> >> kdd.c:82:17: note: while referencing 'txb'
> >> 82 | uint8_t txb[sizeof (kdd_hdr)]; /* Marshalling area for tx */
> >> | ^~~
> >> kdd.c: In function 'kdd_break':
> >> kdd.c:819:19: error: array subscript 16 is above array bounds of 'uint8_t[16]' {aka 'unsigned
> >> char[16]'} [-Werror=array-bounds]
> >> 819 | s->txb[sizeof (kdd_hdr) + i] = i;
> >> | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~
> >> kdd.c:82:17: note: while referencing 'txb'
> >> 82 | uint8_t txb[sizeof (kdd_hdr)]; /* Marshalling area for tx */
> >> | ^~~
> >> In file included from /usr/include/stdio.h:867,
> >> from kdd.c:36:
> >> In function 'vsnprintf',
> >> inlined from 'kdd_send_string' at kdd.c:791:11:
> >> /usr/include/bits/stdio2.h:80:10: error: '__builtin___vsnprintf_chk' specified bound 65519 exceeds
> >> destination size 0 [-Werror=stringop-overflow=]
> >> 80 | return __builtin___vsnprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
> >> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> 81 | __bos (__s), __fmt, __ap);
> >> | ~~~~~~~~~~~~~~~~~~~~~~~~~
> >> cc1: all warnings being treated as errors
> >> make[4]: *** [/builddir/build/BUILD/xen-4.14.0-rc4/tools/debugger/kdd/../../../tools/Rules.mk:216:
> >> kdd.o] Error 1
> >>
> >> The first two array-bounds errors seem to be a result of the
> >>
> >> kdd: stop using [0] arrays to access packet contents
> >>
> >> patch at
> >> http://xenbits.xenproject.org/gitweb/?p=xen.git;a=commit;h=3471cafbdda35eacf04670881dd2aee2558b4f08
> >>
> >> which reduced the size of txb from
> >> sizeof (kdd_hdr) + 65536
> >> to
> >> sizeof (kdd_hdr)
> >> which means the code now tries to write beyond the end of txb in both
> >> cases.
> >>
> >
> > Sorry not to get back to you sooner. Which compiler are you using?
> >
> > Paul
>
> This was with gcc-10.1.1-1.fc32.x86_64
> Full build logs are (at the moment) at
> https://download.copr.fedorainfracloud.org/results/myoung/xentest/fedora-32-x86_64/01515056-xen/
>
Ok, I have an older compiler. Does this patch fix it for you?
---8<---
diff --git a/tools/debugger/kdd/kdd.c b/tools/debugger/kdd/kdd.c
index 866532f0c7..a7d0976ea4 100644
--- a/tools/debugger/kdd/kdd.c
+++ b/tools/debugger/kdd/kdd.c
@@ -79,11 +79,11 @@ typedef struct {
/* State of the debugger stub */
typedef struct {
union {
- uint8_t txb[sizeof (kdd_hdr)]; /* Marshalling area for tx */
+ uint8_t txb[sizeof (kdd_pkt)]; /* Marshalling area for tx */
kdd_pkt txp; /* Also readable as a packet structure */
};
union {
- uint8_t rxb[sizeof (kdd_hdr)]; /* Marshalling area for rx */
+ uint8_t rxb[sizeof (kdd_pkt)]; /* Marshalling area for rx */
kdd_pkt rxp; /* Also readable as a packet structure */
};
unsigned int cur; /* Offset into rx where we'll put the next byte */
---8<---
Paul
> Michael Young
next prev parent reply other threads:[~2020-07-03 10:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-30 22:21 Build problems in kdd.c with xen-4.14.0-rc4 Michael Young
2020-07-02 18:38 ` Olaf Hering
2020-07-03 13:23 ` Paul Durrant
2020-07-03 13:26 ` Olaf Hering
2020-07-03 9:41 ` Paul Durrant
2020-07-03 9:48 ` Michael Young
2020-07-03 10:34 ` Paul Durrant [this message]
2020-07-03 18:54 ` Tim Deegan
2020-07-03 19:58 ` Wei Liu
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='004701d65125$87f4de60$97de9b20$@xen.org' \
--to=xadimgnik@gmail.com \
--cc=m.a.young@durham.ac.uk \
--cc=paul@xen.org \
--cc=tim@xen.org \
--cc=xen-devel@lists.xenproject.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 NNTP newsgroup(s).