Skip to content

Instantly share code, notes, and snippets.

@nickdesaulniers
Created January 27, 2019 22:16
Show Gist options
  • Save nickdesaulniers/9f25458e4044964c627d5b9575675a60 to your computer and use it in GitHub Desktop.
Save nickdesaulniers/9f25458e4044964c627d5b9575675a60 to your computer and use it in GitHub Desktop.
// clang -no-integrated-as -O2 -fstack-protector-strong \
// -fsanitize=kernel-address -mllvm -asan-instrumentation-with-call-threshold=0 \
// -mllvm -asan-use-after-scope=1 -fsanitize-coverage=trace-pc
// -c rndis.i -o rndis.o
// tools/objtool/objtool orc generate --no-fp --no-unreachable --retpoline rndis.o 2>&1 \
// | grep "gen_ndis_set_resp()+0x0: stack state mismatch:"
enum { a } b(char);
d;
*e;
c(*);
static gen_ndis_set_resp() {
asm goto("" : : : : l_yes);
l_yes:;
}
f() {
int *g;
int h;
g = e[1];
c(&h);
switch (d) {
case 2: {
__label__ l_yes;
asm goto("1:.byte 15,31,8,0x000" : : : : l_yes);
l_yes:;
}
*g = 0;
break;
case 3:
asm goto(".pushsection __jump_table, \"aw\" \n\t.long 1b - ., %l[l_yes] - "
". \n\t.quad %c0 + %c1 - .\n\t.popsection \n\t"
:
: "i"(a)
:
: l_yes);
l_yes:
*g = 0;
break;
default:
b(d);
}
gen_ndis_set_resp();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment