Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Nice stack smashing postmortem message#8670

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mcspr merged 2 commits intoesp8266:masterfrommcspr:stack-smashing-morty
Oct 31, 2022

Conversation

@mcspr
Copy link
Collaborator

Wire everything that relies on stack smashing detection to call__stack_chk_fail() (aka what libssp / ssp / stack-protector uses) Expose it in our debugging header

Rename overflow -> smashing, as these are different things we are trying to detect (meaning, that we check for things writing there, not some kind ofalloca issue or the way-fstack-check would have worked) ref.#8666

-fstack-protector continues to work as it always did CONT replacesabort(), also moves its check to the loop wrapper to avoid dumping otherwise useless SYS context memory StackThunk replaces a similarabort() call

Wire everything that relies on stack smashing detection to call`__stack_chk_fail()` (aka what libssp / ssp / stack-protector uses)Expose it in our debugging headerRename overflow -> smashing, as these are different things we are tryingto detect (meaning, that we check for things writing there, not somekind of `alloca` issue or the way `-fstack-check` would have worked)ref.esp8266#8666`-fstack-protector` continues to work as it always didCONT replaces `abort()`, also moves its check to the loop wrapper toavoid dumping otherwise useless SYS context memoryStackThunk replaces a similar `abort()` call
@d-a-vd-a-v added the alphaincluded in alpha release labelSep 13, 2022
@d-a-vd-a-v added this to the3.1 milestoneSep 13, 2022
@mcspr
Copy link
CollaboratorAuthor

btw, something to reproduce failures

#include<Arduino.h>#include<StackThunk.h>#include<umm_malloc/umm_malloc.h>#include<cont.h>#include<user_interface.h>#include<array>// reproduce crash for all three methods, in sequenceconstexpruintptr_t RtcMem {0x60001200 +128 };auto* count =reinterpret_cast<volatileuint32_t*>(RtcMem);extern"C" rst_info resetInfo;// there is only a single thunk in the appextern"C"voidthunk_failme();extern"C"voidfailme() {printf("will ravage %p\n", stack_thunk_ptr);    *stack_thunk_ptr =0xfafafafa;}make_stack_thunk(failme)// needs -fstack-protector to workvoid ssp_failme() __attribute__((stack_protect));voidssp_failme() {char buf[4];strcpy(buf,"ABCDE");puts(buf);}voidsetup() {    Serial.begin(115200);switch (resetInfo.reason) {case REASON_DEFAULT_RST:case REASON_EXT_SYS_RST:        *count =0;break;    }}voidloop() {constauto last = *count;    *count = ((last +1) %3);puts("");printf("%u - wait for it...\n", last);delay(3000);switch (last) {case0:        g_pcont->stack_guard1 =0xfafafafa;        g_pcont->stack_guard2 =0xfafafafa;break;case1:stack_thunk_add_ref();thunk_failme();break;case2:ssp_failme();break;    }}

@mcsprmcspr merged commitbde8ef7 intoesp8266:masterOct 31, 2022
@mcsprmcspr deleted the stack-smashing-morty branchOctober 31, 2022 04:15
hasenradball pushed a commit to hasenradball/Arduino that referenced this pull requestNov 18, 2024
Wire everything that relies on stack smashing detection to call`__stack_chk_fail()` (aka what libssp / ssp / stack-protector uses)Expose it in our debugging headerRename overflow -> smashing, as these are different things we are tryingto detect (meaning, that we check for things writing there, not somekind of `alloca` issue or the way `-fstack-check` would have worked)ref.esp8266#8666`-fstack-protector` continues to work as it always didCONT replaces `abort()`, also moves its check to the loop wrapper toavoid dumping otherwise useless SYS context memoryStackThunk replaces a similar `abort()` call
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

alphaincluded in alpha release

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@mcspr@d-a-v

[8]ページ先頭

©2009-2025 Movatter.jp