From: Andreas Schwab <schwab@linux-m68k.org>
To: John David Anglin <dave.anglin@bell.net>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH v3, resend] Fix misaligned accesses to fields in HEADER struct defined in <arpa/nameser_compat.h>
Date: Wed, 16 Mar 2022 17:15:36 +0100 [thread overview]
Message-ID: <87k0ctdgbb.fsf@igel.home> (raw)
In-Reply-To: <YjCXq2SmFYU0eidG@mx3210.localdomain> (John David Anglin's message of "Tue, 15 Mar 2022 13:42:03 +0000")
On Mär 15 2022, John David Anglin wrote:
> diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c
> index 5bc5b41531..9b82c82157 100644
> --- a/resolv/res_mkquery.c
> +++ b/resolv/res_mkquery.c
> @@ -193,6 +193,15 @@ context_mkquery_common (struct resolv_context *ctx,
> return result;
> }
>
> +/* The structure HEADER is normally aligned to a word boundary and its
> + fields are accessed using word loads and stores. We need to access
> + this structure when it is aligned on a byte boundary. This can cause
> + problems on machines with strict alignment. So, we create a new
> + typedef to reduce its alignment to one. This ensures the fields are
> + accessed with byte loads and stores. */
> +typedef HEADER __attribute__ ((__aligned__(1))) UHEADER;
> +#define HEADER UHEADER
> +
The only use of HEADER below that point is in __res_nopt, and AFACS the
only caller __res_context_query always uses aligned memory.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
next prev parent reply other threads:[~2022-03-16 16:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-15 13:42 John David Anglin
2022-03-16 16:15 ` Andreas Schwab [this message]
2022-03-16 16:50 ` John David Anglin
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=87k0ctdgbb.fsf@igel.home \
--to=schwab@linux-m68k.org \
--cc=dave.anglin@bell.net \
--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).