FreeBSD Bugzilla – Attachment 228388 Details for
Bug 220485
security.bsd.stack_guard_page can be set to a negative integer value
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Demonstration program for PR220485
stack_guard_page.c (text/plain), 1.56 KB, created by
Felix Johnson
on 2021-10-03 06:44:26 UTC
(
hide
)
Description:
Demonstration program for PR220485
Filename:
MIME Type:
Creator:
Felix Johnson
Created:
2021-10-03 06:44:26 UTC
Size:
1.56 KB
patch
obsolete
>/* > * stack_guard_page.c > * > * A demonstration program for PR220485 > * > * sysctl security.bsd.stack_guard_page can be set to a > * negative integer value. Doing so causes applications > * to crash with SIGABRT. > * > * All applications. Enjoy rebooting! > */ > >#include <sys/types.h> >#include <sys/sysctl.h> > >#include <stdio.h> >#include <errno.h> > >int main(int argc, char *argv[]) >{ > const char *name = "security.bsd.stack_guard_page"; > > int stack_guard_page_current_value = 0; > size_t oldlen = sizeof(stack_guard_page_current_value); > > int stack_guard_page_new_value = -3; > size_t newlen = sizeof(stack_guard_page_new_value); > > int returnValue = 0; > int printCount = 0; > > /* What is the current value? */ > returnValue = sysctlbyname(name, > &stack_guard_page_current_value, > &oldlen, > NULL, > 0); > printf("[%d] returnValue %d - stack guard page value %d - bytes written %zu\n", > printCount++, > returnValue, > stack_guard_page_current_value, > oldlen); > > /* write */ > returnValue = sysctlbyname(name, > NULL, > NULL, > &stack_guard_page_new_value, > newlen); > > if (returnValue == EINVAL) > printf("EINVAL returned for value %d\n", stack_guard_page_new_value); > else > printf("[%d] returnValue %d", > printCount++, > returnValue); > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 220485
: 228388