Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buffer overflow on too many break-points #32

Open
pruzko opened this issue Oct 13, 2020 · 2 comments
Open

Buffer overflow on too many break-points #32

pruzko opened this issue Oct 13, 2020 · 2 comments

Comments

@pruzko
Copy link

pruzko commented Oct 13, 2020

If you set a break-point on the same address numerous times the python process crashes. This happens e.g. when you set a bp from a callback function:

addr_1 = 0x...
addr_2 = 0x...

def cb_1(): print('1')

def cb_2():
    with vm.break_on_physical(addr_1, cb_1)
        ...

with vm.break_on_physical(addr_2, cb_2)
    ...

# guest is calling addr_2 and addr_1 fiercely

The solution is rather obvious - one must keep track of addresses that already have a bp set and prevent duplicate bps. However, I thought SIGSEGV is not intended behavior so I did a little investigation.

Long story short, the buffer in struct Worker gets overflown and the co_thread pointer gets malformed. A following call to co_switch is going to kill the python process.

@bamiaux
Copy link
Contributor

bamiaux commented Oct 14, 2020

I will look into it, meanwhile, can you test with a bigger stacksize ?

constexpr auto g_stack_size = 0x400000; // 4mb stack size

@bamiaux
Copy link
Contributor

bamiaux commented Oct 14, 2020

The coroutine stuff is not really required anymore since we do not use page faults anymore. I should probably remove it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants