linux-user: Correct DLINFO_ITEMS
PATCH 1/1 linux-user: Correct DLINFO_ITEMS
Commit a07c67dfccb1 (Implement AT_CLKTCK.) back in March 2008 added a new auxvec entry but didn't increment DLINFO_ITEMS, so it's been out of sync ever since.
Bump it up to 14 so that it matches the number of NEW_AUX_ENT's that need to be counted in create_elf_tables().
--- linux-user/elfload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/elfload.c +1 -1
@@ -1076,7 +1076,7 @@ struct exec#define TARGET_ELF_PAGESTART (_v) ((_v) & ~(unsigned long)(TARGET_ELF_EXEC_PAGESIZE-1))#define TARGET_ELF_PAGEOFFSET (_v) ((_v) & (TARGET_ELF_EXEC_PAGESIZE-1)) -#define DLINFO_ITEMS 13 +#define DLINFO_ITEMS 14static inline void memcpy_fromfs (void * to,const void * from,unsigned long n) {
Signature · 1 line
1.8.3.2
Quoted 6 lines · James Hogan
Commit
a07c67dfccb1(ImplementAT_CLKTCK.) back in March 2008 added a new auxvec entry but didn't incrementDLINFO_ITEMS, so it's been out of sync ever since.Bump it up to 14 so that it matches the number of NEW_AUX_ENT's that need to be counted in
create_elf_tables().
This code could clearly use at least an assert that we've not written more entries than we should, or ideally restructuring somehow so that we don't have to set DLINFO_ITEMS by hand in the first place...
for the immediate fix, though.
thanks
-- PMM
Quoted 11 lines · On Tuesday 25 March 2014 22:20:04 Peter Maydell wrote:
Quoted 6 lines · James Hogan
Commit
a07c67dfccb1(ImplementAT_CLKTCK.) back in March 2008 added a new auxvec entry but didn't incrementDLINFO_ITEMS, so it's been out of sync ever since.Bump it up to 14 so that it matches the number of NEW_AUX_ENT's that need to be counted in
create_elf_tables().This code could clearly use at least an assert that we've not written more entries than we should, or ideally restructuring somehow so that we don't have to set
DLINFO_ITEMSby hand in the first place...
Good idea. I've just submitted a patch to add an assert that the allocated stack for auxvec/envp/argv matches the amount used.
I've already re-factored a bunch of this code to handle stacks which grow upwards (as used for HPPA and Meta arches), which would make it even more awkward to avoid DLINFO_ITEMS since it still builds the auxvec, envp and argv downwards within a new stack frame (grown upwards), so it also needs to know how much stack frame to allocate in advance to be sure it doesn't clobber other stuff lower on the stack.
Quoted 2 lines
Reviewed-by Peter Maydell <[email protected]>for the immediate fix, though.
Thanks for reviewing,
Cheers
James
Quoted 2 lines · James Hogan
I've already re-factored a bunch of this code to handle stacks which grow upwards (as used for HPPA and Meta arches)
...we don't support either of those currently, do you plan to submit something?
thanks
-- PMM
Quoted 6 lines · On Tuesday 25 March 2014 23:51:39 Peter Maydell wrote:
Quoted 2 lines · James Hogan
I've already re-factored a bunch of this code to handle stacks which grow upwards (as used for HPPA and Meta arches)
...we don't support either of those currently, do you plan to submit something?
I'm not sure yet. I have the okay to mainline our Meta QEMU fork[1], but it's fallen a little behind (v1.3.1 - and in my experiencing updating an out of tree QEMU fork is painful), so I've just been taking another look in my own time to see what it would take.
Cheers
James
[1] https://github.com/img-meta/qemu/commit/9355e4b1929c7f05a103dc0e76fe44b54d12b2a7
Riku Voipio
AppliedHi,
Quoted 8 lines · Peter Maydell
Quoted 6 lines · James Hogan
Commit
a07c67dfccb1(ImplementAT_CLKTCK.) back in March 2008 added a new auxvec entry but didn't incrementDLINFO_ITEMS, so it's been out of sync ever since.Bump it up to 14 so that it matches the number of NEW_AUX_ENT's that need to be counted in
create_elf_tables().
Quoted 6 lines
This code could clearly use at least an assert that we've not written more entries than we should, or ideally restructuring somehow so that we don't have to set
DLINFO_ITEMSby hand in the first place...Reviewed-by Peter Maydell <[email protected]>for the immediate fix, though.
I've applied this and the other paches from you to my tree:
https://git.linaro.org/people/riku.voipio/qemu.git/shortlog/refs/heads/linux-user-for-upstream
I think others are ok to be applied post-2.0 release, but I'll send this for 2.0
Riku
Riku