Skip to content

Reverting to when we add auto selection tests #2

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 10 additions & 33 deletions poc/poc.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,17 @@ struct norand {
struct mystruct {
char *first;
char *second;
char *third;
}__attribute__((no_randomize_layout)) __attribute__((randomize_layout));
struct autoselecttest {
int (*test1)();
int (*test2)();
};
struct autotestfail {
int (*test1)();
int test2;
};
struct notautoselect {
int (*test1)();
int (*test2)();
}__attribute__((no_randomize_layout));
int distance(void *a, void *b)
{
return a - b;
}

struct perf {
int a;
char b;
int c[6];
struct mystruct m;
unsigned potato : 1;
int (* hi)();
}__attribute__((randomize_layout));

int main(void)
{
Expand Down Expand Up @@ -107,22 +101,5 @@ int main(void)
PRINT_FIELD_LOC(r, lettuce);
PRINT_FIELD_LOC(r, computer);

struct autoselecttest a;
struct notautoselect n;
struct autotestfail f;
f.test1 = NULL;
f.test2 = 1;
a.test1 = NULL;
a.test2 = NULL;
n.test1 = NULL;
n.test2 = NULL;
m.first = "I'm the first!";
m.second = "and I'm the second!";
printf("Autofail test: %i\n", &f.test1);
printf("Autofail test: %i\n", &f.test2);
printf("Auto test: %i\n", &a.test1);
printf("Auto test: %i\n", &a.test2);
printf("%d first\n", distance((void*)&m.first, (void*)&m));
printf("%d second\n", distance((void*)&m.second, (void*)&m));
return 0;
}