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

Enhance context log #1390

Merged
merged 11 commits into from
Jan 7, 2024
Merged

Enhance context log #1390

merged 11 commits into from
Jan 7, 2024

Conversation

michaelortmann
Copy link
Member

@michaelortmann michaelortmann commented Jan 21, 2023

Found by:
Patch by: michaelortmann
Fixes:

One-line summary:

Additional description (if needed):

Test cases demonstrating functionality (if applicable):

cat scripts/crash.tcl
namespace delete ::
./eggdrop -t BotA.conf
[...]
.tcl source scripts/crash.tcl
[19:26:00] tcl: builtin dcc call: *dcc:tcl -HQ 1 source scripts/crash.tcl
[19:26:00] tcl: evaluate (.tcl): source scripts/crash.tcl
[19:26:00] * Please REPORT this BUG!
[19:26:00] * Check doc/BUG-REPORT on how to do so.
[19:26:00] * Last server read: :BotA MODE BotA :-w

[19:26:00] * Last bind called: evnt:init_server
[19:26:00] * Wrote DEBUG
[19:26:00] * SEGMENT VIOLATION -- CRASHING!
Segmentation fault (core dumped)

@vanosg vanosg added this to the v1.10 milestone Apr 5, 2023
@vanosg
Copy link
Member

vanosg commented Apr 5, 2023

Please resolve conflicts, and add a short summary of changes this makes in the PR description? Thanks

@michaelortmann
Copy link
Member Author

michaelortmann commented Apr 6, 2023

before the patch the output of a crash looks like:

.tcl source scripts/crash.tcl
[03:59:20] tcl: builtin dcc call: *dcc:tcl -HQ 1 source scripts/crash.tcl
[03:59:20] tcl: evaluate (.tcl): source scripts/crash.tcl
[03:59:20] * Last context: tclhash.c/728 [Tcl proc: *dcc:tcl, param:  $_dcc1 $_dcc2 $_dcc3]
[03:59:20] * Please REPORT this BUG!
[03:59:20] * Check doc/BUG-REPORT on how to do so.
[03:59:19] * Wrote DEBUG
[03:59:19] * SEGMENT VIOLATION -- CRASHING!
Segmentation fault (core dumped)

tested with eggdrop version 2a6a368, which would crash on the test-crash-tcl.

so, this patch adds the following output lines when crash:
[19:26:00] * Last server read: :BotA MODE BotA :-w

[19:26:00] * Last bind called: evnt:init_server

this could make debugging problems in the future easier as it supplies more context/data/information about what happened before the crash.

at the same time, old Context-stuff has been cleanup up and removed. Most of the stuff was already removed. But lots of unuseful cruft remained.

@michaelortmann
Copy link
Member Author

Conflict resolved.

New test:
to test this PR, eggdrop has to crash, so i inserted
*(char *) 0xc0ffee = 1;
into cmd_die() to make it crash on .die
Before:
.die

[14:59:18] tcl: builtin dcc call: *dcc:die -HQ 1 
[14:59:18] * Last context: tclhash.c/728 [Tcl proc: *dcc:die, param:  $_dcc1 $_dcc2 $_dcc3]
[14:59:18] * Please REPORT this BUG!
[14:59:18] * Check doc/BUG-REPORT on how to do so.
[14:59:18] * Wrote DEBUG
[14:59:18] * SEGMENT VIOLATION -- CRASHING!
Segmentation fault (core dumped)

After:
.die

[15:03:07] tcl: builtin dcc call: *dcc:die -HQ 1 
[15:03:07] * Please report problem to https://github.com/eggheads/eggdrop/issues
[15:03:07] * Check doc/BUG-REPORT on how to do so.
[15:03:07] * Last server read: :zen.home.arpa 311 BotA BotA BotA Clk-6A497918 * :/msg BotA hello
:zen.home.arpa 379 BotA BotA :is using modes +ix 
:zen.home.arpa 378 BotA BotA :is connecting from *@localhost 127.0.0.1
:zen.home.arpa 319 BotA BotA :@##test @#test 
:zen.home.arpa 312 BotA BotA zen.home.arpa :ExampleNET Server
:zen.home.arpa 317 BotA BotA 37 1680786141 :seconds idle, signon time
:zen.home.arpa 318 BotA BotA :End of /WHOIS list.

[15:03:07] * Last bind called: evnt:init_server
[15:03:07] * Wrote DEBUG
[15:03:07] * SEGMENT VIOLATION -- CRASHING!
Segmentation fault (core dumped)

@thommey
Copy link
Member

thommey commented Dec 2, 2023

I agree with a lot in this and it's going to make it a lot easier to analyze crashes.
Last Tcl bind triggered is a great idea!

I don't think I see value in the last raw IRC line received though - crashes can come from the botnet, too. I would suggest removing that bit.

@michaelortmann
Copy link
Member Author

michaelortmann commented Jan 3, 2024

I agree with a lot in this and it's going to make it a lot easier to analyze crashes. Last Tcl bind triggered is a great idea!

I don't think I see value in the last raw IRC line received though - crashes can come from the botnet, too. I would suggest removing that bit.

done.

new crash-test with that bit removed:

.die
[00:43:35] tcl: builtin dcc call: *dcc:die -HQ 1 
[00:43:35] * Please report problem to https://github.com/eggheads/eggdrop/issues
[00:43:35] * Check doc/BUG-REPORT on how to do so.
[00:43:35] * Last bind called: quotepong_bind
[00:43:35] * Wrote DEBUG
[00:43:35] * SEGMENT VIOLATION -- CRASHING!
Segmentation fault (core dumped)

@vanosg vanosg merged commit bf2c80b into eggheads:develop Jan 7, 2024
2 checks passed
@michaelortmann michaelortmann deleted the context.rip branch January 7, 2024 20:25
@michaelortmann michaelortmann mentioned this pull request Jan 7, 2024
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

Successfully merging this pull request may close these issues.

3 participants