int3resting27 <int3restin...@cock.li> wrote: > Example program: > > #include <unistd.h> > #include <stdio.h> > int main(int argc, char **argv) { > char *const args[] = { "Z", NULL, }; > char *const env[] = { NULL, }; > > if (argv[0][0] == 'Z') { > printf("success\n"); > return (0); > } > > unveil(argv[0], "x"); > pledge("exec", "stdio rpath"); > execve(argv[0], args, env); > } > > Expected behavior: execve's itself then prints "success" and exits
You are making quite a big an assumption, and it is wrong.