"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libhfcommon/ns.c" between
honggfuzz-2.1.tar.gz and honggfuzz-2.2.tar.gz

About: honggfuzz is a security oriented, feedback-driven, evolutionary, easy-to-use fuzzer with powerful analysis options.

ns.c  (honggfuzz-2.1):ns.c  (honggfuzz-2.2)
skipping to change at line 58 skipping to change at line 58
gid_t current_gid = getgid(); gid_t current_gid = getgid();
if (unshare(cloneFlags) == -1) { if (unshare(cloneFlags) == -1) {
PLOG_E("unshare(0x%tx)", cloneFlags); PLOG_E("unshare(0x%tx)", cloneFlags);
if (cloneFlags | CLONE_NEWUSER) { if (cloneFlags | CLONE_NEWUSER) {
LOG_W("Executing 'sysctl -w kernel.unprivileged_userns_clone=1' migh t help with this"); LOG_W("Executing 'sysctl -w kernel.unprivileged_userns_clone=1' migh t help with this");
} }
return false; return false;
} }
const char* deny_str = "deny"; if (!files_writeStrToFile("/proc/self/setgroups", "deny", O_WRONLY)) {
if (files_writeBufToFile("/proc/self/setgroups", (const uint8_t*)deny_str, s
trlen(deny_str),
O_WRONLY) == false) {
PLOG_E("Couldn't write to /proc/self/setgroups"); PLOG_E("Couldn't write to /proc/self/setgroups");
return false; return false;
} }
char gid_map[4096]; char gid_map[4096];
snprintf(gid_map, sizeof(gid_map), "%d %d 1", (int)current_gid, (int)current _gid); snprintf(gid_map, sizeof(gid_map), "%d %d 1", (int)current_gid, (int)current _gid);
if (files_writeBufToFile( if (!files_writeStrToFile("/proc/self/gid_map", gid_map, O_WRONLY)) {
"/proc/self/gid_map", (const uint8_t*)gid_map, strlen(gid_map), O_WR
ONLY) == false) {
PLOG_E("Couldn't write to /proc/self/gid_map"); PLOG_E("Couldn't write to /proc/self/gid_map");
return false; return false;
} }
char uid_map[4096]; char uid_map[4096];
snprintf(uid_map, sizeof(uid_map), "%d %d 1", (int)current_uid, (int)current _uid); snprintf(uid_map, sizeof(uid_map), "%d %d 1", (int)current_uid, (int)current _uid);
if (files_writeBufToFile( if (!files_writeStrToFile("/proc/self/uid_map", uid_map, O_WRONLY)) {
"/proc/self/uid_map", (const uint8_t*)uid_map, strlen(uid_map), O_WR
ONLY) == false) {
PLOG_E("Couldn't write to /proc/self/uid_map"); PLOG_E("Couldn't write to /proc/self/uid_map");
return false; return false;
} }
if (setresgid(current_gid, current_gid, current_gid) == -1) { if (setresgid(current_gid, current_gid, current_gid) == -1) {
PLOG_E("setresgid(%d)", (int)current_gid); PLOG_E("setresgid(%d)", (int)current_gid);
return false; return false;
} }
if (setresuid(current_uid, current_uid, current_uid) == -1) { if (setresuid(current_uid, current_uid, current_uid) == -1) {
PLOG_E("setresuid(%d)", (int)current_uid); PLOG_E("setresuid(%d)", (int)current_uid);
 End of changes. 3 change blocks. 
10 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)