Issue created by Chris Johns: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5635

Assignee: Chris Johns

## Summary

If more than 32 threads are active the `thread->register` pointer may end up 
referencing an old block pointer depending on the value returned by a `realloc` 
call. This has not been a problem on ARM or AARCH64 builds but is a problem on 
PowerPC although it is a definite issue on all architectures. 

I suspect a key difference is PowerPC has a 412 byte register buffer per 
thread, significantly more than ARM and AARCH64, so a block resize using 
`realloc` is more likely to results in the pointer returned having a different 
address. The corruption is each thread has taken a pointer to the registers 
from the original block for each thread and it is not re-based after the 
`realloc` moves the pointer.

## Solution

Add a rebase handler to the block code that is called if the base pointer of a 
block moves so the pointer can be remapped.

_Note_, only the `registers` is effected as all other blocks do not have 
references taken.

## Steps to reproduce

Run a simple EPICS IOC application on PowerPC, connect then list the threads 
and then print thread's registers. The values are garbage.

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5635
You're receiving this email because of your account on gitlab.rtems.org. 
Unsubscribe from this thread: 
https://gitlab.rtems.org/-/sent_notifications/4-0vgyb9s00vslwnjw2kzakdxnj-1d/unsubscribe
 | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | 
Help: https://gitlab.rtems.org/help


_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to