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

SEGFAULT in some plugin deletion contexts #1527

Open
lacraig2 opened this issue Sep 2, 2024 · 0 comments · May be fixed by #1528
Open

SEGFAULT in some plugin deletion contexts #1527

lacraig2 opened this issue Sep 2, 2024 · 0 comments · May be fixed by #1528
Labels

Comments

@lacraig2
Copy link
Member

lacraig2 commented Sep 2, 2024

When deleting a callback under very specific conditions we can get ugly errors.

In particular, when deleting a callback that is the last of its kind from within that callback we see a segfault in the following code:

#define MAKE_CALLBACK_NO_ARGS_void(name_upper, name) \
void panda_callbacks_ ## name(void) { \
panda_cb_list *plist; \
for (plist = panda_cbs[PANDA_CB_ ## name_upper]; \
plist != NULL; \
plist = panda_cb_list_next(plist)) { \
if (plist->enabled) \
plist->entry. ENTRY_NAME(name, plist->context); \
} \
} \
void panda_cb_trampoline_ ## name(void* context) {\
(*(panda_cb*)context) . ENTRY_NAME(name); \
}

A minimal example of this behavior for reproducing:

#!/usr/bin/env python3
from pandare import Panda

panda = Panda(generic="i386")

@panda.queue_blocking
def run_cmd():
    panda.revert_sync("root")
    print(panda.run_serial_cmd("uname -a"))
    print(panda.run_serial_cmd("uname -a"))
    print(panda.run_serial_cmd("uname -a"))
    panda.end_analysis()

@panda.cb_main_loop_wait
def asidchange():
    panda.delete_callbacks()

panda.run()
@lacraig2 lacraig2 added the bug label Sep 2, 2024
@lacraig2 lacraig2 linked a pull request Sep 2, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant