Research, development and trades concerning the powerful Proxmark3 device.
Remember; sharing is caring. Bring something back to the community.
"Learn the tools of the trade the hard way." +Fravia
You are not logged in.
Time changes and with it the technology
Proxmark3 @ discord
Users of this forum, please be aware that information stored on this site is not private.
Hi,
I wanted to fix a simple issue, that quitting by CTRL-D caused a segfault when working offline, but the situation is more complex than I thought.
Current code is:
upon "quit" the client exits immediately without any cleaning: exit(0)
upon "CTRL-D" the main_loop() returns and main() continue with:
* uart_close()
* pthread_mutex_destroy(&print_lock);
Both methods (quit & CTRL-D) should lead to the same exit procedure IMHO.
But I don't know how to make "quit" returning from main_loop, replacing exit by return makes the client to be stalled.
Then once both end up into the final code of main(), one should protect uart_close() by this otherwise you get a segfault when working offline:
if (!offline) uart_close(sp);
Still I get the following error with CTRL-D:
GLib-CRITICAL **: g_main_context_pop_thread_default: assertion 'stack != NULL' failed
So to conclude I've two issues I don't know how to solve:
* get "quit" acting as "CTRL-D", so returning to main() instead of brutal exit(0)
* get rid of the g_main_context_pop_thread_default error
Phil
Offline
Hi Phil,
Here is an ugly quick fix. It was working quite well with the non-CDC version of the client.
Wil
diff --git a/client/proxmark3.c b/client/proxmark3.c
index 4b898d5..1b03fe9 100644
--- a/client/proxmark3.c
+++ b/client/proxmark3.c
@@ -137,9 +137,7 @@ static void *main_loop(void *targ)
script_file = NULL;
}
- ExitGraphics();
- pthread_exit(NULL);
- return NULL;
+ exit(0);
}
int main(int argc, char **argv)
Offline
That's again a kind of brutal ending :-)
If main() is willing to call uart_close(sp); before quitting I guess we should make sure this point is reached and avoid abrupt exits from anywhere...
Same thing for ExitGraphics(), pthread_exit() etc, we should better understand them, fix them if needed, rather than killing blindly the process.
IMHO
Phil
Offline
Sure
Here is the message you get with a QT lib compiled with debug flags (on Gentoo):
Never mind the use of /dev/null ...
% ./proxmark3 /dev/null
ERROR: invalid serial port
proxmark3> data load /tmp/proxif-17
loaded 16000 samples
proxmark3> data plot
proxmark3>
ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread 7f991c0130a0. Receiver '' (of type 'QWidget') was created in thread 1f2efa0", file kernel/qcoreapplication.cpp, line 535
zsh: abort ./proxmark3 /dev/null
%
Wil
Last edited by wil (2014-04-01 09:03:44)
Offline
I observe this ASSERT message while quitting with CTRL-D, but not with the "quit" command.
Wil
Offline