public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in app-admin/sudo/files: sudo-1.8.2-fix-pwutil-alignment.patch
@ 2011-10-12 18:50 Sergei Trofimovich (slyfox)
  0 siblings, 0 replies; only message in thread
From: Sergei Trofimovich (slyfox) @ 2011-10-12 18:50 UTC (permalink / raw
  To: gentoo-commits

slyfox      11/10/12 18:50:26

  Added:                sudo-1.8.2-fix-pwutil-alignment.patch
  Log:
  Fixed alignment issue on alpha found by armin76 (fix from upstream).
  
  (Portage version: 2.1.10.11/cvs/Linux x86_64)

Revision  Changes    Path
1.1                  app-admin/sudo/files/sudo-1.8.2-fix-pwutil-alignment.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-admin/sudo/files/sudo-1.8.2-fix-pwutil-alignment.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-admin/sudo/files/sudo-1.8.2-fix-pwutil-alignment.patch?rev=1.1&content-type=text/plain

Index: sudo-1.8.2-fix-pwutil-alignment.patch
===================================================================
status: upstream

> Program received signal SIGBUS, Bus error.
> 0x0000020005ff64e0 in make_grlist_item (user=0x120037090 "root", gids=0x120037140, ngids=11) at ./pwutil.c:552
> 552                 grlist->groups[ngroups++] = cp;

Found by armin76.

On alpha gid_t (grlist->gids) is 4-bytes long (and 4-bytes algned)
while char** (grlist->groups) is 8-bytes aligned.
Reorder to satisfy both alignmens.

# HG changeset patch
# User Todd C. Miller <Todd.Miller@courtesan.com>
# Date 1316193166 14400
# Branch 1.8
# Node ID e877c89ae32fc1fa7c3933f9599761d43f79dc96
# Parent  f31543c80b9857cf4d14048be0c3ff34a47201c4
# Parent  c89508c73c46bca11b6b9d3980cd4a511efcde6f
Fix a crash in make_grlist_item() on 64-bit machines with strict
alignment.

diff -r f31543c80b98 -r e877c89ae32f plugins/sudoers/pwutil.c
--- a/plugins/sudoers/pwutil.c	Fri Sep 16 13:12:34 2011 -0400
+++ b/plugins/sudoers/pwutil.c	Fri Sep 16 13:12:46 2011 -0400
@@ -508,16 +508,16 @@
 
     /*
      * Copy in group list and make pointers relative to space
-     * at the end of the buffer.  Note that the gids array must come
+     * at the end of the buffer.  Note that the groups array must come
      * immediately after struct group to guarantee proper alignment.
      */
     grlist = (struct group_list *)cp;
     zero_bytes(grlist, sizeof(struct group_list));
     cp += sizeof(struct group_list);
+    grlist->groups = (char **)cp;
+    cp += sizeof(char *) * ngids;
     grlist->gids = (gid_t *)cp;
     cp += sizeof(gid_t) * ngids;
-    grlist->groups = (char **)cp;
-    cp += sizeof(char *) * ngids;
 
     /* Set key and datum. */
     memcpy(cp, user, nsize);






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-10-12 18:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-12 18:50 [gentoo-commits] gentoo-x86 commit in app-admin/sudo/files: sudo-1.8.2-fix-pwutil-alignment.patch Sergei Trofimovich (slyfox)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox