#include #include #include "privs.h" #include "die.h" void drop_privileges(bool enforce, uid_t uid, gid_t gid) { if (enforce) { if (uid == getuid()) panic("Uid cannot be the same as the current user!\n"); if (gid == getgid()) panic("Gid cannot be the same as the current user!\n"); } if (setgid(gid) != 0) panic("Unable to drop group privileges: %s!\n", strerror(errno)); if (setuid(uid) != 0) panic("Unable to drop user privileges: %s!\n", strerror(errno)); } epository'/>
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2016-07-08 15:55:43 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2016-08-09 19:51:47 +1000
commit5958d19a143eb229e9ece20bd4c781ad41cb7d24 (patch)
treee75a9e3cebf119ca9987b05a0e5396044c27cd1c
parentc74dd88e77d3ecbc9e55c78796d82c9aa21cabad (diff)
powerpc/pnv/pci: Fix incorrect PE reservation attempt on some 64-bit BARs
The generic allocation code may sometimes decide to assign a prefetchable 64-bit BAR to the M32 window. In fact it may also decide to allocate a 64-bit non-prefetchable BAR to the M64 one ! So using the resource flags as a test to decide which window was used for PE allocation is just wrong and leads to insane PE numbers. Instead, compare the addresses to figure it out. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> [mpe: Rename the function as agreed by Ben & Gavin] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>