From: Stafford Horne <shorne@gmail.com>
To: GLIBC patches <libc-alpha@sourceware.org>
Subject: [PATCH] resolv: Fix tests by aligning hand crafted queries
Date: Tue, 15 Jun 2021 08:40:11 +0900 [thread overview]
Message-ID: <20210614234011.2215641-1-shorne@gmail.com> (raw)
When testing OpenRISC I get a bus error in res_send. This is due to the
buf being cast to a (HEADER *) and trying the res_send code trying to read
different bits of the HEADER struct including 16-bit id etc.
On OpenRISC reads of 16-bits and 32-bits from structures need to be 2
byte and 4 byte aligned, respectively.
To fix this we can align the hand crafted queries.
---
resolv/tst-resolv-binary.c | 2 +-
resolv/tst-resolv-trustad.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/resolv/tst-resolv-binary.c b/resolv/tst-resolv-binary.c
index 44895a1baa..f76ae057c4 100644
--- a/resolv/tst-resolv-binary.c
+++ b/resolv/tst-resolv-binary.c
@@ -52,7 +52,7 @@ do_test (void)
for (int b = 0; b <= 255; ++b)
{
- unsigned char query[] =
+ unsigned char query[] __attribute__ ((aligned)) =
{
b, b, /* Transaction ID. */
1, 0, /* Query with RD flag. */
diff --git a/resolv/tst-resolv-trustad.c b/resolv/tst-resolv-trustad.c
index 74ee5db735..8d6989adb4 100644
--- a/resolv/tst-resolv-trustad.c
+++ b/resolv/tst-resolv-trustad.c
@@ -93,7 +93,8 @@ do_test (void)
/* By default, the resolver is not trusted, and the AD bit is
cleared. */
- static const unsigned char hand_crafted_query[] =
+ static const unsigned char hand_crafted_query[]
+ __attribute__ ((aligned)) =
{
10, 11, /* Transaction ID. */
1, 0x20, /* Query with RD, AD flags. */
--
2.31.1
next reply other threads:[~2021-06-14 23:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-14 23:40 Stafford Horne [this message]
2021-09-27 20:43 ` Stafford Horne
2021-09-28 14:36 ` Adhemerval Zanella
2021-09-28 16:00 ` Florian Weimer
2021-10-06 20:53 ` Stafford Horne
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=20210614234011.2215641-1-shorne@gmail.com \
--to=shorne@gmail.com \
--cc=libc-alpha@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).