This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Trying not call elfutils functions in ABRT under root
- From: Adam Sulc <xmineral at seznam dot cz>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Wed, 30 Nov 2016 08:00:44 +0000
- Subject: Trying not call elfutils functions in ABRT under root
Hello,
im using elfutils in ABRT program specifically when generating core_backtrace. According to this https://github.com/abrt/abrt/issues/890 post, it is not a good idea using elfutils under root. So I have tried moving as much elfutils function calls to non-root process as possible. That means the parent process is forked and in child process there are opened necessary files:
https://github.com/xsulca00/abrt/blob/iss%23890/src/hooks/abrt-hook-ccpp.c#L1321
https://github.com/xsulca00/satyr/blob/iss%23890/lib/core_unwind_elfutils.c#L242
and then UID and GID of child is changed and then I can call elfutils in this function:
https://github.com/xsulca00/abrt/blob/iss%23890/src/hooks/abrt-hook-ccpp.c#L1361
https://github.com/xsulca00/satyr/blob/iss%23890/lib/core_unwind_elfutils.c#L392
Is there any way how I can pass the opened files to elfutils functions? Especially for "/etc/[tid]/mem" which is needed in dwfl_linux_proc_find_elf that is part of Dwfl_Callbacks proc_cb ?
Current problem im solving is
int dwfl_linux_proc_find_elf function:
https://github.com/xsulca00/elfutils-for-satyr/blob/satyr_dwfl_linux_proc_report/libdwfl/linux-proc-maps.c#L372
where :
https://github.com/xsulca00/elfutils-for-satyr/blob/satyr_dwfl_linux_proc_report/libdwfl/linux-proc-maps.c#L429#L439
s hard-coded opening "/proc/%d/mem" file. Is there any way, how to open this file "/proc/%d/mem" under root and then pass the opened file to this function in order to avoid running "dwfl_linux_proc_find_elf" function under root?
Thank you