std::memset(&cred1, 250, sizeof(cred1));
- // needs to be root to work correctly
- ret = setcred(flags1, &cred1, size1);
- assert(ret == -1);
- assert(errno == EPERM);
-
- // not accessible
- ret = setcred(flags1, nullptr, size1);
- assert(ret == -1);
- assert(errno == EFAULT);
-
// uninit
ret = setcred(flags2+x0, (struct setcred*)x0, size1+x0);
assert(ret == -1);
assert(errno == EFAULT);
+ errno = 0;
// invalid flags
ret = setcred(9999+x0, &cred1, sizeof(cred1));
assert(ret == -1);
assert(errno == EINVAL);
+ errno = 0;
// invalid size
ret = setcred(flags1, &cred1, 3+x0);
assert(ret == -1);
assert(errno == EINVAL);
+ errno = 0;
cred2 = new struct setcred;
ret = setcred(flags1, cred2, size1);
assert(ret == -1);
assert(errno == EPERM);
+ errno = 0;
+
+ // PJF these two calls to setcred were before the
+ // uninit one that is now first
+ // that was fine on arm64 but on amd64 the uninit
+ // call generated an extre Conditional jump ... error
+
+ // fairly mysterious, and usually that means that there
+ // is something wrong with the syscall wrapper
+
+ // needs to be root to work correctly
+ ret = setcred(flags1, &cred1, size1);
+ assert(ret == -1);
+ assert(errno == EPERM);
+ errno = 0;
+
+ // not accessible
+ ret = setcred(flags1, nullptr, size1);
+ assert(ret == -1);
+ assert(errno == EFAULT);
delete cred2;
free(px);
-Syscall param setcred(wcred) points to unaddressable byte(s)
- at 0x........: setcred (in /...libc...)
- by 0x........: main (setcred.cpp:28)
- Address 0x........ is not stack'd, malloc'd or (recently) free'd
-
Syscall param setcred(flags) contains uninitialised byte(s)
at 0x........: setcred (in /...libc...)
- by 0x........: main (setcred.cpp:33)
+ by 0x........: main (setcred.cpp:23)
Syscall param setcred(wcred) contains uninitialised byte(s)
at 0x........: setcred (in /...libc...)
- by 0x........: main (setcred.cpp:33)
+ by 0x........: main (setcred.cpp:23)
Syscall param setcred(size) contains uninitialised byte(s)
at 0x........: setcred (in /...libc...)
- by 0x........: main (setcred.cpp:33)
+ by 0x........: main (setcred.cpp:23)
Syscall param setcred(wcred) points to unaddressable byte(s)
at 0x........: setcred (in /...libc...)
- by 0x........: main (setcred.cpp:33)
+ by 0x........: main (setcred.cpp:23)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
Syscall param setcred(flags) contains uninitialised byte(s)
at 0x........: setcred (in /...libc...)
- by 0x........: main (setcred.cpp:38)
+ by 0x........: main (setcred.cpp:29)
Syscall param setcred(size) contains uninitialised byte(s)
at 0x........: setcred (in /...libc...)
- by 0x........: main (setcred.cpp:43)
+ by 0x........: main (setcred.cpp:35)
Syscall param setcred(wcred) points to uninitialised byte(s)
at 0x........: setcred (in /...libc...)
- by 0x........: main (setcred.cpp:50)
+ by 0x........: main (setcred.cpp:43)
Address 0x........ is 0 bytes inside a block of size 48 alloc'd
at 0x........: ...operator new... (vg_replace_malloc.c:...)
- by 0x........: main (setcred.cpp:47)
+ by 0x........: main (setcred.cpp:40)
+
+Syscall param setcred(wcred) points to unaddressable byte(s)
+ at 0x........: setcred (in /...libc...)
+ by 0x........: main (setcred.cpp:63)
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd