Print this page
11530 badseg test creates cores

*** 8,25 **** * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* ! * Copyright 2018 Joyent, Inc. */ #include <stdlib.h> #include <ucontext.h> #include <sys/wait.h> #include <unistd.h> #include <sys/regset.h> /* * Load a bunch of bad selectors into the seg regs: this will typically cause * the child process to core dump, but it shouldn't panic the kernel... * --- 8,27 ---- * source. A copy of the CDDL is also available via the Internet at * http://www.illumos.org/license/CDDL. */ /* ! * Copyright 2019 Joyent, Inc. */ #include <stdlib.h> #include <ucontext.h> #include <sys/wait.h> #include <unistd.h> #include <sys/regset.h> + #include <sys/resource.h> + #include <err.h> /* * Load a bunch of bad selectors into the seg regs: this will typically cause * the child process to core dump, but it shouldn't panic the kernel... *
*** 115,127 **** pid_t pid; switch ((pid = fork())) { case 0: func(); ! exit(0); case -1: ! exit(1); default: (void) waitpid(pid, NULL, 0); return; } --- 117,129 ---- pid_t pid; switch ((pid = fork())) { case 0: func(); ! exit(EXIT_SUCCESS); case -1: ! exit(EXIT_FAILURE); default: (void) waitpid(pid, NULL, 0); return; }
*** 128,137 **** --- 130,145 ---- } int main(int argc, char *argv[]) { + struct rlimit rl = { 0, }; + + if (setrlimit(RLIMIT_CORE, &rl) != 0) { + err(EXIT_FAILURE, "failed to disable cores"); + } + for (selector = 0; selector < 8194; selector++) { inchild(resetcs); inchild(resetds); inchild(resetes); inchild(resetfs);
*** 142,148 **** inchild(badfs); inchild(badgs); inchild(badss); } ! exit(0); } --- 150,156 ---- inchild(badfs); inchild(badgs); inchild(badss); } ! exit(EXIT_SUCCESS); }