public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* Fix unaligned access
@ 2005-07-13 11:21 Andreas Schwab
  2005-07-13 14:25 ` Ulrich Drepper
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2005-07-13 11:21 UTC (permalink / raw)
  To: libc-hacker

This fixes an unaligned access during nscd communication.

Andreas.

2005-07-13  Andreas Schwab  <schwab@suse.de>

	* nscd/nscd_helper.c (get_mapping): Align control message buffer.

--- nscd/nscd_helper.c.~1.10.~	2005-02-23 11:25:53.000000000 +0100
+++ nscd/nscd_helper.c	2005-07-13 11:54:38.000000000 +0200
@@ -176,7 +176,7 @@ get_mapping (request_type type, const ch
   iov[0].iov_base = resdata;
   iov[0].iov_len = keylen;
 
-  char buf[CMSG_SPACE (sizeof (int))];
+  char buf[CMSG_SPACE (sizeof (int))] __attribute__ ((aligned));
   struct msghdr msg = { .msg_iov = iov, .msg_iovlen = 1,
 			.msg_control = buf, .msg_controllen = sizeof (buf) };
   struct cmsghdr *cmsg = CMSG_FIRSTHDR (&msg);

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: Fix unaligned access
  2005-07-13 11:21 Fix unaligned access Andreas Schwab
@ 2005-07-13 14:25 ` Ulrich Drepper
  2005-07-13 15:01   ` Andreas Schwab
  0 siblings, 1 reply; 9+ messages in thread
From: Ulrich Drepper @ 2005-07-13 14:25 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-hacker

[-- Attachment #1: Type: text/plain, Size: 194 bytes --]

Andreas Schwab wrote:
> This fixes an unaligned access during nscd communication.

When and where?

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

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

* Re: Fix unaligned access
  2005-07-13 14:25 ` Ulrich Drepper
@ 2005-07-13 15:01   ` Andreas Schwab
  2005-07-13 22:55     ` Ulrich Drepper
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2005-07-13 15:01 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: libc-hacker

Ulrich Drepper <drepper@redhat.com> writes:

> Andreas Schwab wrote:
>> This fixes an unaligned access during nscd communication.
>
> When and where?

When this function is called???

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: Fix unaligned access
  2005-07-13 15:01   ` Andreas Schwab
@ 2005-07-13 22:55     ` Ulrich Drepper
  2005-07-14  7:56       ` Andreas Schwab
  0 siblings, 1 reply; 9+ messages in thread
From: Ulrich Drepper @ 2005-07-13 22:55 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-hacker

[-- Attachment #1: Type: text/plain, Size: 374 bytes --]

And again: when and where is this a problem?

I cannot believe it has to be asked.  Those of us actually looking at
bug reports need to know the circumstances to determine whether the fix
might cure the problem.  If this would be a general problem it would
long have shown up.

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

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

* Re: Fix unaligned access
  2005-07-13 22:55     ` Ulrich Drepper
@ 2005-07-14  7:56       ` Andreas Schwab
  2005-07-14  7:59         ` Ulrich Drepper
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2005-07-14  7:56 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: libc-hacker

Ulrich Drepper <drepper@redhat.com> writes:

> And again: when and where is this a problem?

See a few lines below:

  cmsg->cmsg_level = SOL_SOCKET;

Since cmsg is just a pointer to msg.msg_control, this needs to be properly
aligned.  Same for the next three lines.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: Fix unaligned access
  2005-07-14  7:56       ` Andreas Schwab
@ 2005-07-14  7:59         ` Ulrich Drepper
  2005-07-14  8:55           ` Andreas Schwab
  0 siblings, 1 reply; 9+ messages in thread
From: Ulrich Drepper @ 2005-07-14  7:59 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-hacker

[-- Attachment #1: Type: text/plain, Size: 298 bytes --]

Andreas Schwab wrote:
> Since cmsg is just a pointer to msg.msg_control, this needs to be properly
> aligned.  Same for the next three lines.

You don't get it.  Which architecture, what kind of build?

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

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

* Re: Fix unaligned access
  2005-07-14  7:59         ` Ulrich Drepper
@ 2005-07-14  8:55           ` Andreas Schwab
  2005-07-14 14:54             ` Ulrich Drepper
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2005-07-14  8:55 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: libc-hacker

Ulrich Drepper <drepper@redhat.com> writes:

> You don't get it.

You might want to be more specific with your questions the next time.  I
can't read your mind.

>  Which architecture,

Any architecture that can report unaligned accesses, which includes the
ia64.

> what kind of build?

Care to expand?

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: Fix unaligned access
  2005-07-14  8:55           ` Andreas Schwab
@ 2005-07-14 14:54             ` Ulrich Drepper
  2005-07-14 15:34               ` Andreas Schwab
  0 siblings, 1 reply; 9+ messages in thread
From: Ulrich Drepper @ 2005-07-14 14:54 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-hacker

[-- Attachment #1: Type: text/plain, Size: 380 bytes --]

Andreas Schwab wrote:
> Any architecture that can report unaligned accesses, which includes the
> ia64.

Not in all cases.


>>what kind of build?
> 
> Care to expand?

I haven't seen any such message so it cannot happen in all builds.  So
you probably did something special.

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

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

* Re: Fix unaligned access
  2005-07-14 14:54             ` Ulrich Drepper
@ 2005-07-14 15:34               ` Andreas Schwab
  0 siblings, 0 replies; 9+ messages in thread
From: Andreas Schwab @ 2005-07-14 15:34 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: libc-hacker

Ulrich Drepper <drepper@redhat.com> writes:

> I haven't seen any such message so it cannot happen in all builds.

So what?  That's the basic principle of undefined behaviour.

I don't understand all the fuss you made.  If you like to see the bug
solved differently please say so in the first place in clear and
understandable words.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

end of thread, other threads:[~2005-07-14 15:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-13 11:21 Fix unaligned access Andreas Schwab
2005-07-13 14:25 ` Ulrich Drepper
2005-07-13 15:01   ` Andreas Schwab
2005-07-13 22:55     ` Ulrich Drepper
2005-07-14  7:56       ` Andreas Schwab
2005-07-14  7:59         ` Ulrich Drepper
2005-07-14  8:55           ` Andreas Schwab
2005-07-14 14:54             ` Ulrich Drepper
2005-07-14 15:34               ` Andreas Schwab

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