I'm going to be more anal retentive with this review than I was previously.
On Fri, Feb 25, 2011 at 2:36 AM, Han Pingtian <[email protected]> wrote: > This is a reproducer of CVE-2011-0999, which fixed by mainline commit > a7d6e4ecdb7648478ddec76d30d87d03d6e22b31: > > "Transparent hugepages can only be created if rmap is fully > functional. So we must prevent hugepages to be created while > is_vma_temporary_stack() is true." > > When running in a loop, it can trigger panic like this, if kernel > unpatched: > > kernel BUG at mm/huge_memory.c:1260! > invalid opcode: 0000 [#1] SMP > last sysfs file: /sys/devices/system/cpu/cpu23/cache/index2/shared_cpu_map ... > > So I recommend to run it as 'thp01 -I xxx'. > +static option_t options[] = { > + {NULL, NULL, NULL} > +}; > + > +static void usage(void) > +{ > + return; > +} > + > +int main(int argc, char **argv) { > + int i, lc, st; > + pid_t pid; > + char *msg; > + char *c[257]; > + char cc[32*4096]; > + struct rlimit rl = { > + .rlim_cur =RLIM_INFINITY, > + .rlim_max=RLIM_INFINITY, > + }; > + > + msg = parse_opts(argc, argv, options, usage); > + if (msg != NULL) > + tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); > + > + for (lc = 0; TEST_LOOPING(lc); lc++) { > + switch (pid = fork()) { > + case -1: > + tst_brkm(TBROK|TERRNO, NULL, "fork"); > + case 0: > + memset(cc, 'c', 32*4096-1); > + for (i=0;i<256;i++) > + c[i] = cc; > + if (setrlimit(RLIMIT_STACK, &rl) == -1) > + tst_brkm(TBROK|TERRNO, NULL, > "setrlimit"); > + if (execve("/bin/true", c, c) == -1) > + tst_brkm(TBROK|TERRNO, NULL, > "execve"); I would just do perror("execve"), etc, because this is a child process and according to the style guide you shouldn't use tst_resm in child processes (I recommended that in the style guide for a very good reason that you should understand). > + default: > + if (waitpid(pid, &st, 0) == -1) > + tst_brkm(TBROK|TERRNO, NULL, > "waitpid"); > + > + if (! WIFEXITED(st)) > + tst_brkm(TBROK, NULL, "child exit > status is %d", WEXITSTATUS(st)); I agree with what Cyril said before about whitespace. ... -Garrett ------------------------------------------------------------------------------ Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
