* [Qemu-devel] [patch] Incorrect AUX vector entries
@ 2005-08-13 16:18 Paul Brook
0 siblings, 0 replies; only message in thread
From: Paul Brook @ 2005-08-13 16:18 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 555 bytes --]
The DLINFO AUX vector setup code in elfload.c has a typo in the entry for
AT_EGID (11 should be 10). The smallest fix would be to just correct this
typo.
However I can't see any reason for the "nr" argument to NEW_AUX_ENT.
The attached patch removes it, and includes the stack adjustment in
NEW_AUX_ENT. A side-effect of this patch is that the entries in the aux
table are reversed, but this seems harmless and the target specific entries
were already out of order. If this is important it's easy enough to just
reorder them in the code.
Paul
[-- Attachment #2: patch.qemu_dlinfo --]
[-- Type: text/x-diff, Size: 3829 bytes --]
Index: elfload.c
===================================================================
RCS file: /cvsroot/qemu/qemu/linux-user/elfload.c,v
retrieving revision 1.26
diff -u -p -r1.26 elfload.c
--- elfload.c 10 Feb 2005 22:00:52 -0000 1.26
+++ elfload.c 13 Aug 2005 16:09:13 -0000
@@ -186,19 +186,17 @@ do {
* - for compatibility with glibc ARCH_DLINFO must always be defined on PPC,
* even if DLINFO_ARCH_ITEMS goes to zero or is undefined.
*/
-#define DLINFO_ARCH_ITEMS 3
+#define DLINFO_ARCH_ITEMS 5
#define ARCH_DLINFO \
do { \
- sp -= DLINFO_ARCH_ITEMS * 2; \
- NEW_AUX_ENT(0, AT_DCACHEBSIZE, 0x20); \
- NEW_AUX_ENT(1, AT_ICACHEBSIZE, 0x20); \
- NEW_AUX_ENT(2, AT_UCACHEBSIZE, 0); \
+ NEW_AUX_ENT(AT_DCACHEBSIZE, 0x20); \
+ NEW_AUX_ENT(AT_ICACHEBSIZE, 0x20); \
+ NEW_AUX_ENT(AT_UCACHEBSIZE, 0); \
/* \
* Now handle glibc compatibility. \
*/ \
- sp -= 2*2; \
- NEW_AUX_ENT(0, AT_IGNOREPPC, AT_IGNOREPPC); \
- NEW_AUX_ENT(1, AT_IGNOREPPC, AT_IGNOREPPC); \
+ NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC); \
+ NEW_AUX_ENT(AT_IGNOREPPC, AT_IGNOREPPC); \
} while (0)
static inline void init_thread(struct target_pt_regs *_regs, struct image_info *infop)
@@ -643,24 +641,24 @@ static unsigned int * create_elf_tables(
if ((unsigned long)csp & 15UL)
sp -= ((unsigned long)csp & 15UL) / sizeof(*sp);
-#define NEW_AUX_ENT(nr, id, val) \
- put_user (id, sp + (nr * 2)); \
- put_user (val, sp + (nr * 2 + 1))
- sp -= 2;
- NEW_AUX_ENT (0, AT_NULL, 0);
-
- sp -= DLINFO_ITEMS*2;
- NEW_AUX_ENT( 0, AT_PHDR, (target_ulong)(load_addr + exec->e_phoff));
- NEW_AUX_ENT( 1, AT_PHENT, (target_ulong)(sizeof (struct elf_phdr)));
- NEW_AUX_ENT( 2, AT_PHNUM, (target_ulong)(exec->e_phnum));
- NEW_AUX_ENT( 3, AT_PAGESZ, (target_ulong)(TARGET_PAGE_SIZE));
- NEW_AUX_ENT( 4, AT_BASE, (target_ulong)(interp_load_addr));
- NEW_AUX_ENT( 5, AT_FLAGS, (target_ulong)0);
- NEW_AUX_ENT( 6, AT_ENTRY, load_bias + exec->e_entry);
- NEW_AUX_ENT( 7, AT_UID, (target_ulong) getuid());
- NEW_AUX_ENT( 8, AT_EUID, (target_ulong) geteuid());
- NEW_AUX_ENT( 9, AT_GID, (target_ulong) getgid());
- NEW_AUX_ENT(11, AT_EGID, (target_ulong) getegid());
+#define NEW_AUX_ENT(id, val) \
+ sp -= 2; \
+ put_user (id, sp); \
+ put_user (val, sp + 1)
+ NEW_AUX_ENT (AT_NULL, 0);
+
+ /* There must be exactly DLINFO_ITEMS entries here. */
+ NEW_AUX_ENT(AT_PHDR, (target_ulong)(load_addr + exec->e_phoff));
+ NEW_AUX_ENT(AT_PHENT, (target_ulong)(sizeof (struct elf_phdr)));
+ NEW_AUX_ENT(AT_PHNUM, (target_ulong)(exec->e_phnum));
+ NEW_AUX_ENT(AT_PAGESZ, (target_ulong)(TARGET_PAGE_SIZE));
+ NEW_AUX_ENT(AT_BASE, (target_ulong)(interp_load_addr));
+ NEW_AUX_ENT(AT_FLAGS, (target_ulong)0);
+ NEW_AUX_ENT(AT_ENTRY, load_bias + exec->e_entry);
+ NEW_AUX_ENT(AT_UID, (target_ulong) getuid());
+ NEW_AUX_ENT(AT_EUID, (target_ulong) geteuid());
+ NEW_AUX_ENT(AT_GID, (target_ulong) getgid());
+ NEW_AUX_ENT(AT_EGID, (target_ulong) getegid());
#ifdef ARCH_DLINFO
/*
* ARCH_DLINFO must come last so platform specific code can enforce
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-08-13 16:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-13 16:18 [Qemu-devel] [patch] Incorrect AUX vector entries Paul Brook
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 NNTP newsgroup(s).