Skip to contentSkip to conversation

linux-user: fix multi-threaded /proc/self/maps

PATCH Alexander Graf 1 participant 1 message Jun 1, 2012 6 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): CAFEAcA-caVgBY3if2kVeLuwekiuFF0YLqHsuvBq=f6vWpBdW=g@mail.gmail.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): CAFEAcA8toSYefdtDz4m0O_RpMX7JVcszXN_hRn08wHH-dxt73g@mail.gmail.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): CAFEAcA8epaEQLpqHMM+D6wXxDOCxDoY0YPmJ=qHiVFDja44ewA@mail.gmail.com

#6 lore raw
Quoted 24 lines · Peter Maydell
Quoted 7 lines · Alexander Graf
Quoted 6 lines · Peter Maydell
Quoted 5 lines · Alexander Graf
Quoted 3 lines · Peter Maydell

So in the multithreaded case do all the thread stacks live in this one mapping, or do the non-primary thread stacks live in a standard mmap'd mapping?

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

I thought /proc/self/maps always shows the initial stack map as [stack]?

I dunno, I asked because I'm too lazy to check myself :-)

Same here. Mind to check? Your time zone fits this better atm ;)

So none of the processes on my system have more than one [stack] mapping, even the multithreaded ones. OTOH the kernel sources:
http://lxr.free-electrons.com/source/fs/proc/task_mmu.c#L262
indicate that it is possible for them to print [stack:TID] for a thread stack in some cases...

However, I think your change is right, because the secondary threads ought to see the main process /proc/self/maps and that should show the main stack.

Quoted 8 lines

Q: I think the reason for the
#if defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_UNICORE32) is because linux-user/main.c only sets up ts->stack_base
on those targets. If we're not using ts->stack_base
any more can we drop the #if here?

(more generally I wonder if we can drop ts->stack_base completely in favour of ts->info->start_stack...)

Good point. Maybe?

Alex