#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)); } git Git repository'/>
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasami Hiramatsu <masami.hiramatsu@linaro.org>2016-08-06 19:29:48 +0900
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-08-09 10:47:43 -0300
commit8e34189b347d76acf48ce05831176582201b664d (patch)
treeffdc09cda5483e9124820d3fa46999e649a43558
parent887fa86d6fd7a45cee2d0f9d5f75026786d61df2 (diff)
perf probe: Adjust map->reloc offset when finding kernel symbol from map
Adjust map->reloc offset for the unmapped address when finding alternative symbol address from map, because KASLR can relocate the kernel symbol address. The same adjustment has been done when finding appropriate kernel symbol address from map which was introduced by commit f90acac75713 ("perf probe: Find given address from offline dwarf") Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org> Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org> Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/20160806192948.e366f3fbc4b194de600f8326@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>