tags 456205 patch
thanks

Hi Ghe,

I can confirm Bob's report that this code is an issue on alpha.  The
CMSG_SPACE() macro unfortunately only ensures that the buffer is large
enough to /permit/ an aligned read without reading past the end of the
buffer; it does not ensure that the buffer itself is aligned, or allocate
enough space to permit an aligned read offset into the buffer if the buffer
isn't aligned.

So the fix Bob proposes is somewhat over-reaching, in that it will force
8-byte alignment even on archs that don't require it and waste a few bytes
on the stack in the process; but I don't think that should be a blocker for
implementing this patch, considering this bug almost certainly causes radvd
to die with SIGBUS on sparc - I haven't tested this myself, or else I would
raise the bug's severity to 'serious'.

Attached is a debdiff that implements Bob's fix.  Let me know if you would
like me to upload an NMU for this.

Cheers,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
[EMAIL PROTECTED]                                     [EMAIL PROTECTED]
diff -u radvd-1.1/debian/changelog radvd-1.1/debian/changelog
--- radvd-1.1/debian/changelog
+++ radvd-1.1/debian/changelog
@@ -1,3 +1,13 @@
+radvd (1:1.1-2.1) UNRELEASED; urgency=low
+
+  * Non-maintainer upload for the alpha port.
+  * Fix the alignment of the "chdr" buffer in send.c, so that we stop getting
+    unaligned traps that make the process run much less efficiently.  This
+    probably also causes radvd to crash outright on sparc, though this has
+    not been confirmed.  Thanks to Bob Tracy for the patch.  Closes: #456205.
+
+ -- Steve Langasek <[EMAIL PROTECTED]>  Thu, 28 Aug 2008 01:19:30 -0700
+
 radvd (1:1.1-2) unstable; urgency=low
 
   * Migrated to unstable
only in patch2:
unchanged:
--- radvd-1.1.orig/debian/patches/send.c-unaligned-traps.patch
+++ radvd-1.1/debian/patches/send.c-unaligned-traps.patch
@@ -0,0 +1,11 @@
+--- radvd-1.1.orig/send.c
++++ radvd-1.1/send.c
+@@ -27,7 +27,7 @@
+ 	struct msghdr mhdr;
+ 	struct cmsghdr *cmsg;
+ 	struct iovec iov;
+-	char chdr[CMSG_SPACE(sizeof(struct in6_pktinfo))];
++	char __attribute__((aligned(8))) chdr[CMSG_SPACE(sizeof(struct in6_pktinfo))];
+ 	struct nd_router_advert *radvert;
+ 	struct AdvPrefix *prefix;
+ 	struct AdvRoute *route;

Reply via email to