-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Polkitd: The utils_spawn_data_free reap timeout subprocess did not work resulting in a large number of zombie processes #12
Comments
In gitlab.freedesktop.org by bugzilla-migration on Apr 13, 2018, 10:28 🛠️ [email protected] submitted a patch:
|
In gitlab.freedesktop.org by bugzilla-migration on Apr 13, 2018, 10:34 💬 [email protected] said: I made a patch to fix this issue. The root cause is : static void if (data->child_pid != 0) |
In gitlab.freedesktop.org by bugzilla-migration on Apr 13, 2018, 10:38 💬 [email protected] said: The GChildWatch in utils_spawn_data_free didn't work due to the release of main_loop and main context outside. |
In gitlab.freedesktop.org by bugzilla-migration on May 3, 2018, 18:42 💬 David Herrmann Why not simply turn SIGTERM into SIGKILL and use waitid(2)? I mean, we are dealing with a timeout here, no reason to try to be graceful. |
In gitlab.freedesktop.org by bugzilla-migration on May 5, 2018, 14:10 💬 [email protected] said: (In reply to David Herrmann from comment 4)
Hi,I made a better patch to fix this. I will send out next Monday. :) |
In gitlab.freedesktop.org by bugzilla-migration on May 8, 2018, 04:14 📎 [email protected] uploaded an attachment:
|
In gitlab.freedesktop.org by bugzilla-migration on May 8, 2018, 04:28 💬 [email protected] said: Hi,I made a better patch to make sure child process exits will be processed. I made 3 timeout source. Timer1: 10s send SIGTERM. 0 ~ 10s: child exit normally Please give me some comments or suggestions on fixing the issue. : ) |
In gitlab.freedesktop.org by bugzilla-migration on May 9, 2018, 12:35 💬 David Herrmann I would prefer to send SIGKILL straight away and use waitid(2) to guarantee it is collected. Anyway, your patch looks fine. Lets see whether a polkit maintainer can apply it. |
In gitlab.freedesktop.org by bugzilla-migration on May 10, 2018, 11:14 🛠️ [email protected] submitted a patch: This patch seems to be much simpler and better. Patch 139459, "polkitd-fix-zombie-not-reaped-when-js-spawned-proces.patch": |
In gitlab.freedesktop.org by bugzilla-migration on May 14, 2018, 10:01 💬 [email protected] said: (In reply to David Herrmann from comment 8)
Hi,I post a new patch, this one seems mucher simpler. This patch attaches source to global default main context and can work. Change:
|
In gitlab.freedesktop.org by bugzilla-migration on Aug 15, 2018, 13:02 💬 David Herrmann (In reply to lining916740672 from comment 10)
According to glib docs g_source_attach() is safe to attach to other threads. The callback we use is localized to the source itself, so I see no harm in doing that. Furthermore, no threading should be involved here, since the js-authority is executed inline, but I am not entirely sure it is invoked in the main-thread. Regardless: I think this is safe. I still believe sending SIGKILL is the right thing to do. But I also think this patch is also the right thing to do to reap children correctly.
Not sure who to ping to pick this up and merge upstream, though. |
In gitlab.freedesktop.org by jcpunk on Dec 1, 2020, 20:54 Any chance to get this revived and finished? |
duk_error() never returns, so the error string gets leaked every time an error is thrown. Let's avoid this by creating the error object first without throwing it, freeing the original error string (we don't need it anymore since it gets sprintf-ed into the error object), and then throwing the error object from top of the current context stack. ================================================================= ==1270==ERROR: LeakSanitizer: detected memory leaks Direct leak of 231 byte(s) in 2 object(s) allocated from: #0 0x7f3a489258b7 in malloc (/lib64/libasan.so.8+0xf68b7) (BuildId: 388cbb99455c2e2eaec79bd8db6d9a78eb39f80d) #1 0x7f3a47b27487 in __vasprintf_internal (/lib64/libc.so.6+0x8a487) (BuildId: 4a92fcedbba6d6d2629ce066a2970017faa9995e) #2 0x7f3a484b06a2 in g_vasprintf (/lib64/libglib-2.0.so.0+0xb16a2) (BuildId: 795136df3faa85587229ddc59d709f81d6f697df) #3 0x7f3a48480a92 in g_strdup_vprintf (/lib64/libglib-2.0.so.0+0x81a92) (BuildId: 795136df3faa85587229ddc59d709f81d6f697df) polkit-org#4 0x7f3a48480b50 in g_strdup_printf (/lib64/libglib-2.0.so.0+0x81b50) (BuildId: 795136df3faa85587229ddc59d709f81d6f697df) polkit-org#5 0x41fcec in js_polkit_spawn ../src/polkitbackend/polkitbackendduktapeauthority.c:1090 polkit-org#6 0x7f3a483b31b8 in duk__handle_call_raw.lto_priv.0 (/lib64/libduktape.so.207+0x2a1b8) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#7 0x7f3a483962e1 in duk__js_execute_bytecode_inner.lto_priv.0 (/lib64/libduktape.so.207+0xd2e1) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#8 0x7f3a483b33eb in duk_js_execute_bytecode (/lib64/libduktape.so.207+0x2a3eb) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#9 0x7f3a483b319d in duk__handle_call_raw.lto_priv.0 (/lib64/libduktape.so.207+0x2a19d) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#10 0x7f3a48399ab0 in duk__pcall_prop_raw (/lib64/libduktape.so.207+0x10ab0) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#11 0x7f3a483b23cc in duk_handle_safe_call.lto_priv.0 (/lib64/libduktape.so.207+0x293cc) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#12 0x7f3a483972e8 in duk_pcall_prop (/lib64/libduktape.so.207+0xe2e8) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#13 0x41d048 in runaway_killer_thread_call_js ../src/polkitbackend/polkitbackendduktapeauthority.c:682 polkit-org#14 0x7f3a4888cb45 in asan_thread_start(void*) (/lib64/libasan.so.8+0x5db45) (BuildId: 388cbb99455c2e2eaec79bd8db6d9a78eb39f80d) Direct leak of 128 byte(s) in 1 object(s) allocated from: #0 0x7f3a489247b8 in realloc.part.0 (/lib64/libasan.so.8+0xf57b8) (BuildId: 388cbb99455c2e2eaec79bd8db6d9a78eb39f80d) #1 0x7f3a4846304a in g_realloc (/lib64/libglib-2.0.so.0+0x6404a) (BuildId: 795136df3faa85587229ddc59d709f81d6f697df) #2 0x7f3a48481b19 in g_string_expand (/lib64/libglib-2.0.so.0+0x82b19) (BuildId: 795136df3faa85587229ddc59d709f81d6f697df) #3 0x7f3a48481b90 in g_string_sized_new (/lib64/libglib-2.0.so.0+0x82b90) (BuildId: 795136df3faa85587229ddc59d709f81d6f697df) polkit-org#4 0x41fb0f in js_polkit_spawn ../src/polkitbackend/polkitbackendduktapeauthority.c:1099 polkit-org#5 0x7f3a483b31b8 in duk__handle_call_raw.lto_priv.0 (/lib64/libduktape.so.207+0x2a1b8) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#6 0x7f3a483962e1 in duk__js_execute_bytecode_inner.lto_priv.0 (/lib64/libduktape.so.207+0xd2e1) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#7 0x7f3a483b33eb in duk_js_execute_bytecode (/lib64/libduktape.so.207+0x2a3eb) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#8 0x7f3a483b319d in duk__handle_call_raw.lto_priv.0 (/lib64/libduktape.so.207+0x2a19d) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#9 0x7f3a48399ab0 in duk__pcall_prop_raw (/lib64/libduktape.so.207+0x10ab0) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#10 0x7f3a483b23cc in duk_handle_safe_call.lto_priv.0 (/lib64/libduktape.so.207+0x293cc) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#11 0x7f3a483972e8 in duk_pcall_prop (/lib64/libduktape.so.207+0xe2e8) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#12 0x41d048 in runaway_killer_thread_call_js ../src/polkitbackend/polkitbackendduktapeauthority.c:682 polkit-org#13 0x7f3a4888cb45 in asan_thread_start(void*) (/lib64/libasan.so.8+0x5db45) (BuildId: 388cbb99455c2e2eaec79bd8db6d9a78eb39f80d) SUMMARY: AddressSanitizer: 359 byte(s) leaked in 3 allocation(s).
Will this patch be accepted by the upstream community? |
duk_error() never returns, so the error string gets leaked every time an error is thrown. Let's avoid this by creating the error object first without throwing it, freeing the original error string (we don't need it anymore since it gets sprintf-ed into the error object), and then throwing the error object from top of the current context stack. ================================================================= ==1270==ERROR: LeakSanitizer: detected memory leaks Direct leak of 231 byte(s) in 2 object(s) allocated from: #0 0x7f3a489258b7 in malloc (/lib64/libasan.so.8+0xf68b7) (BuildId: 388cbb99455c2e2eaec79bd8db6d9a78eb39f80d) #1 0x7f3a47b27487 in __vasprintf_internal (/lib64/libc.so.6+0x8a487) (BuildId: 4a92fcedbba6d6d2629ce066a2970017faa9995e) #2 0x7f3a484b06a2 in g_vasprintf (/lib64/libglib-2.0.so.0+0xb16a2) (BuildId: 795136df3faa85587229ddc59d709f81d6f697df) #3 0x7f3a48480a92 in g_strdup_vprintf (/lib64/libglib-2.0.so.0+0x81a92) (BuildId: 795136df3faa85587229ddc59d709f81d6f697df) polkit-org#4 0x7f3a48480b50 in g_strdup_printf (/lib64/libglib-2.0.so.0+0x81b50) (BuildId: 795136df3faa85587229ddc59d709f81d6f697df) polkit-org#5 0x41fcec in js_polkit_spawn ../src/polkitbackend/polkitbackendduktapeauthority.c:1090 polkit-org#6 0x7f3a483b31b8 in duk__handle_call_raw.lto_priv.0 (/lib64/libduktape.so.207+0x2a1b8) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#7 0x7f3a483962e1 in duk__js_execute_bytecode_inner.lto_priv.0 (/lib64/libduktape.so.207+0xd2e1) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#8 0x7f3a483b33eb in duk_js_execute_bytecode (/lib64/libduktape.so.207+0x2a3eb) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#9 0x7f3a483b319d in duk__handle_call_raw.lto_priv.0 (/lib64/libduktape.so.207+0x2a19d) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#10 0x7f3a48399ab0 in duk__pcall_prop_raw (/lib64/libduktape.so.207+0x10ab0) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#11 0x7f3a483b23cc in duk_handle_safe_call.lto_priv.0 (/lib64/libduktape.so.207+0x293cc) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#12 0x7f3a483972e8 in duk_pcall_prop (/lib64/libduktape.so.207+0xe2e8) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#13 0x41d048 in runaway_killer_thread_call_js ../src/polkitbackend/polkitbackendduktapeauthority.c:682 polkit-org#14 0x7f3a4888cb45 in asan_thread_start(void*) (/lib64/libasan.so.8+0x5db45) (BuildId: 388cbb99455c2e2eaec79bd8db6d9a78eb39f80d) Direct leak of 128 byte(s) in 1 object(s) allocated from: #0 0x7f3a489247b8 in realloc.part.0 (/lib64/libasan.so.8+0xf57b8) (BuildId: 388cbb99455c2e2eaec79bd8db6d9a78eb39f80d) #1 0x7f3a4846304a in g_realloc (/lib64/libglib-2.0.so.0+0x6404a) (BuildId: 795136df3faa85587229ddc59d709f81d6f697df) #2 0x7f3a48481b19 in g_string_expand (/lib64/libglib-2.0.so.0+0x82b19) (BuildId: 795136df3faa85587229ddc59d709f81d6f697df) #3 0x7f3a48481b90 in g_string_sized_new (/lib64/libglib-2.0.so.0+0x82b90) (BuildId: 795136df3faa85587229ddc59d709f81d6f697df) polkit-org#4 0x41fb0f in js_polkit_spawn ../src/polkitbackend/polkitbackendduktapeauthority.c:1099 polkit-org#5 0x7f3a483b31b8 in duk__handle_call_raw.lto_priv.0 (/lib64/libduktape.so.207+0x2a1b8) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#6 0x7f3a483962e1 in duk__js_execute_bytecode_inner.lto_priv.0 (/lib64/libduktape.so.207+0xd2e1) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#7 0x7f3a483b33eb in duk_js_execute_bytecode (/lib64/libduktape.so.207+0x2a3eb) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#8 0x7f3a483b319d in duk__handle_call_raw.lto_priv.0 (/lib64/libduktape.so.207+0x2a19d) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#9 0x7f3a48399ab0 in duk__pcall_prop_raw (/lib64/libduktape.so.207+0x10ab0) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#10 0x7f3a483b23cc in duk_handle_safe_call.lto_priv.0 (/lib64/libduktape.so.207+0x293cc) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#11 0x7f3a483972e8 in duk_pcall_prop (/lib64/libduktape.so.207+0xe2e8) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) polkit-org#12 0x41d048 in runaway_killer_thread_call_js ../src/polkitbackend/polkitbackendduktapeauthority.c:682 polkit-org#13 0x7f3a4888cb45 in asan_thread_start(void*) (/lib64/libasan.so.8+0x5db45) (BuildId: 388cbb99455c2e2eaec79bd8db6d9a78eb39f80d) SUMMARY: AddressSanitizer: 359 byte(s) leaked in 3 allocation(s).
* test: drop mocklibc Let's get rid of mocklibc and replace it with a simple combination of mount & user namespaces + bind mount to replace the host's /etc with our own version. This means we don't $LD_PRELOAD the mocklibc DSO, but instead run each unit test through a very simple python wrapper that sets up a temporary user & mount namespace through the unshare() syscall, gains "fake" root using uid_map and gid_map, overmounts /etc in this new namespace (with our own custom test files), and then executes the test binary itself. Check user_namespaces(7) for more information about the namespace shenanigans. * Replace duk_error() with duk_push_error_object() + duk_throw() duk_error() never returns, so the error string gets leaked every time an error is thrown. Let's avoid this by creating the error object first without throwing it, freeing the original error string (we don't need it anymore since it gets sprintf-ed into the error object), and then throwing the error object from top of the current context stack. ================================================================= ==1270==ERROR: LeakSanitizer: detected memory leaks Direct leak of 231 byte(s) in 2 object(s) allocated from: #0 0x7f3a489258b7 in malloc (/lib64/libasan.so.8+0xf68b7) (BuildId: 388cbb99455c2e2eaec79bd8db6d9a78eb39f80d) #1 0x7f3a47b27487 in __vasprintf_internal (/lib64/libc.so.6+0x8a487) (BuildId: 4a92fcedbba6d6d2629ce066a2970017faa9995e) #2 0x7f3a484b06a2 in g_vasprintf (/lib64/libglib-2.0.so.0+0xb16a2) (BuildId: 795136df3faa85587229ddc59d709f81d6f697df) #3 0x7f3a48480a92 in g_strdup_vprintf (/lib64/libglib-2.0.so.0+0x81a92) (BuildId: 795136df3faa85587229ddc59d709f81d6f697df) #4 0x7f3a48480b50 in g_strdup_printf (/lib64/libglib-2.0.so.0+0x81b50) (BuildId: 795136df3faa85587229ddc59d709f81d6f697df) #5 0x41fcec in js_polkit_spawn ../src/polkitbackend/polkitbackendduktapeauthority.c:1090 #6 0x7f3a483b31b8 in duk__handle_call_raw.lto_priv.0 (/lib64/libduktape.so.207+0x2a1b8) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) #7 0x7f3a483962e1 in duk__js_execute_bytecode_inner.lto_priv.0 (/lib64/libduktape.so.207+0xd2e1) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) #8 0x7f3a483b33eb in duk_js_execute_bytecode (/lib64/libduktape.so.207+0x2a3eb) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) #9 0x7f3a483b319d in duk__handle_call_raw.lto_priv.0 (/lib64/libduktape.so.207+0x2a19d) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) #10 0x7f3a48399ab0 in duk__pcall_prop_raw (/lib64/libduktape.so.207+0x10ab0) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) #11 0x7f3a483b23cc in duk_handle_safe_call.lto_priv.0 (/lib64/libduktape.so.207+0x293cc) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) #12 0x7f3a483972e8 in duk_pcall_prop (/lib64/libduktape.so.207+0xe2e8) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) #13 0x41d048 in runaway_killer_thread_call_js ../src/polkitbackend/polkitbackendduktapeauthority.c:682 #14 0x7f3a4888cb45 in asan_thread_start(void*) (/lib64/libasan.so.8+0x5db45) (BuildId: 388cbb99455c2e2eaec79bd8db6d9a78eb39f80d) Direct leak of 128 byte(s) in 1 object(s) allocated from: #0 0x7f3a489247b8 in realloc.part.0 (/lib64/libasan.so.8+0xf57b8) (BuildId: 388cbb99455c2e2eaec79bd8db6d9a78eb39f80d) #1 0x7f3a4846304a in g_realloc (/lib64/libglib-2.0.so.0+0x6404a) (BuildId: 795136df3faa85587229ddc59d709f81d6f697df) #2 0x7f3a48481b19 in g_string_expand (/lib64/libglib-2.0.so.0+0x82b19) (BuildId: 795136df3faa85587229ddc59d709f81d6f697df) #3 0x7f3a48481b90 in g_string_sized_new (/lib64/libglib-2.0.so.0+0x82b90) (BuildId: 795136df3faa85587229ddc59d709f81d6f697df) #4 0x41fb0f in js_polkit_spawn ../src/polkitbackend/polkitbackendduktapeauthority.c:1099 #5 0x7f3a483b31b8 in duk__handle_call_raw.lto_priv.0 (/lib64/libduktape.so.207+0x2a1b8) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) #6 0x7f3a483962e1 in duk__js_execute_bytecode_inner.lto_priv.0 (/lib64/libduktape.so.207+0xd2e1) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) #7 0x7f3a483b33eb in duk_js_execute_bytecode (/lib64/libduktape.so.207+0x2a3eb) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) #8 0x7f3a483b319d in duk__handle_call_raw.lto_priv.0 (/lib64/libduktape.so.207+0x2a19d) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) #9 0x7f3a48399ab0 in duk__pcall_prop_raw (/lib64/libduktape.so.207+0x10ab0) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) #10 0x7f3a483b23cc in duk_handle_safe_call.lto_priv.0 (/lib64/libduktape.so.207+0x293cc) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) #11 0x7f3a483972e8 in duk_pcall_prop (/lib64/libduktape.so.207+0xe2e8) (BuildId: a9f661ee1766489794e9ece7cfd0d6a7fb420ccb) #12 0x41d048 in runaway_killer_thread_call_js ../src/polkitbackend/polkitbackendduktapeauthority.c:682 #13 0x7f3a4888cb45 in asan_thread_start(void*) (/lib64/libasan.so.8+0x5db45) (BuildId: 388cbb99455c2e2eaec79bd8db6d9a78eb39f80d) SUMMARY: AddressSanitizer: 359 byte(s) leaked in 3 allocation(s). * packit: run unit tests during package build
Will this patch be accepted by the upstream community?@jrybar-rh @mrc0mmand @Peelz |
who can ping to pick this up and merge upstream?@mrc0mmand @notpeelz @jrybar-rh |
Hello, if you prepare a PR, it will definitely be reviewed. Regarding Issues, we try to proceed systematically or sort issues by their urgency status. |
BTW killing lingering processes has been solved in polkitbackendduktapeauthority.c. The same logic is implemented in the mozjs counterpart. Checking reproducer. |
|
No, I'm referring to this line:
I've checked the reproducer and it doesn't work with duktape. Checking mozjs. If that fails, I'll close this issue. |
|
Still reproducible with mozjs. |
Support for mozjs has been dropped from polkit. Closing. Many thanks to everyone involved! |
Otherwise it gets leaked: [356645.511913] systemd[1]: Stopping polkit.service - Authorization Manager... [356645.514024] polkitd[15468]: Handling SIGTERM [356645.514024] polkitd[15468]: Shutting down [356645.519238] polkitd[15468]: Exiting with code 0 [356645.618456] polkitd[15468]: ================================================================= [356645.618456] polkitd[15468]: ==15468==ERROR: LeakSanitizer: detected memory leaks [356645.618456] polkitd[15468]: Direct leak of 4000 byte(s) in 50 object(s) allocated from: [356645.619128] polkitd[15468]: #0 0x0000004a1a33 in malloc (/usr/lib/polkit-1/polkitd+0x4a1a33) (BuildId: a927b98f2ddc1b57773bec4e0f8a537fe46632b1) [356645.619128] polkitd[15468]: #1 0x7f1b20324039 in g_malloc (/lib64/libglib-2.0.so.0+0x47039) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: #2 0x7f1b2033d4d4 in g_slice_alloc (/lib64/libglib-2.0.so.0+0x604d4) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: #3 0x7f1b2036b547 in g_variant_iter_new (/lib64/libglib-2.0.so.0+0x8e547) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: polkit-org#4 0x7f1b2036dc5d (/lib64/libglib-2.0.so.0+0x90c5d) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: polkit-org#5 0x7f1b2036d8b7 (/lib64/libglib-2.0.so.0+0x908b7) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: polkit-org#6 0x7f1b2036de0f in g_variant_get_va (/lib64/libglib-2.0.so.0+0x90e0f) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: polkit-org#7 0x7f1b2036df88 in g_variant_get (/lib64/libglib-2.0.so.0+0x90f88) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: polkit-org#8 0x7f1b2067ce85 in polkit_system_bus_name_get_creds_sync /root/polkit/build/../src/polkit/polkitsystembusname.c:542:3 [356645.619128] polkitd[15468]: polkit-org#9 0x7f1b2067c997 in polkit_system_bus_name_get_process_sync /root/polkit/build/../src/polkit/polkitsystembusname.c:629:8 [356645.619128] polkitd[15468]: polkit-org#10 0x0000005069af in polkit_backend_session_monitor_get_session_for_subject /root/polkit/build/../src/polkitbackend/polkitbackendsessionmonitor-systemd.c:365:41 [356645.619128] polkitd[15468]: polkit-org#11 0x0000004f11b5 in polkit_backend_interactive_authority_revoke_temporary_authorization_by_id /root/polkit/build/../src/polkitbackend/polkitbackendinteractiveauthority.c:3567:24 [356645.619128] polkitd[15468]: polkit-org#12 0x0000004ea2c8 in server_handle_revoke_temporary_authorization_by_id /root/polkit/build/../src/polkitbackend/polkitbackendauthority.c:1292:8 [356645.619128] polkitd[15468]: polkit-org#13 0x0000004e805c in server_handle_method_call /root/polkit/build/../src/polkitbackend/polkitbackendauthority.c:1346:5 [356645.619128] polkitd[15468]: polkit-org#14 0x7f1b20565195 (/lib64/libgio-2.0.so.0+0xd9195) (BuildId: d06dc1cc6f8ddbb3cda89ef05ecf83d6fe037ae7) [356645.619332] polkitd[15468]: polkit-org#15 0x7f1b20323e5c (/lib64/libglib-2.0.so.0+0x46e5c) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619332] polkitd[15468]: polkit-org#16 0x7f1b2031d60b (/lib64/libglib-2.0.so.0+0x4060b) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619332] polkitd[15468]: polkit-org#17 0x7f1b2037db37 (/lib64/libglib-2.0.so.0+0xa0b37) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619332] polkitd[15468]: polkit-org#18 0x7f1b203236f6 in g_main_loop_run (/lib64/libglib-2.0.so.0+0x466f6) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619332] polkitd[15468]: polkit-org#19 0x0000004e3619 in main /root/polkit/build/../src/polkitbackend/polkitd.c:298:3 [356645.619332] polkitd[15468]: polkit-org#20 0x7f1b1fe59447 in __libc_start_call_main (/lib64/libc.so.6+0x3447) (BuildId: f3ac204eaa4ceed81438c80e80998209f828bb1a) [356645.619332] polkitd[15468]: polkit-org#21 0x7f1b1fe5950a in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x350a) (BuildId: f3ac204eaa4ceed81438c80e80998209f828bb1a) [356645.619332] polkitd[15468]: polkit-org#22 0x000000401c04 in _start (/usr/lib/polkit-1/polkitd+0x401c04) (BuildId: a927b98f2ddc1b57773bec4e0f8a537fe46632b1) ... Follow-up for 8cabb11.
[357268.621800] systemd[1]: Stopping polkit.service - Authorization Manager... [357268.623321] polkitd[15601]: Handling SIGTERM [357268.623321] polkitd[15601]: Shutting down [357268.629022] polkitd[15601]: Exiting with code 0 [357268.748206] polkitd[15601]: ================================================================= [357268.748455] polkitd[15601]: ==15601==ERROR: LeakSanitizer: detected memory leaks [357268.748455] polkitd[15601]: Direct leak of 48 byte(s) in 3 object(s) allocated from: [357268.749382] polkitd[15601]: #0 0x0000004a1a33 in malloc (/usr/lib/polkit-1/polkitd+0x4a1a33) (BuildId: a927b98f2ddc1b57773bec4e0f8a537fe46632b1) [357268.749382] polkitd[15601]: #1 0x7fe21ebe5039 in g_malloc (/lib64/libglib-2.0.so.0+0x47039) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [357268.749382] polkitd[15601]: #2 0x7fe21ebfe4d4 in g_slice_alloc (/lib64/libglib-2.0.so.0+0x604d4) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [357268.749382] polkitd[15601]: #3 0x7fe21ebfe5c4 in g_slice_alloc0 (/lib64/libglib-2.0.so.0+0x605c4) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [357268.749382] polkitd[15601]: polkit-org#4 0x7fe21ebc6910 (/lib64/libglib-2.0.so.0+0x28910) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [357268.749382] polkitd[15601]: polkit-org#5 0x7fe21ebc70a4 in g_error_new_valist (/lib64/libglib-2.0.so.0+0x290a4) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [357268.749382] polkitd[15601]: polkit-org#6 0x7fe21ebc72e0 in g_set_error (/lib64/libglib-2.0.so.0+0x292e0) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [357268.749382] polkitd[15601]: polkit-org#7 0x7fe21ee50b52 (/lib64/libgio-2.0.so.0+0x103b52) (BuildId: d06dc1cc6f8ddbb3cda89ef05ecf83d6fe037ae7) [357268.749382] polkitd[15601]: polkit-org#8 0x000000508a88 in ensure_all_files /root/polkit/build/../src/polkitbackend/polkitbackendactionpool.c:572:18 [357268.749382] polkitd[15601]: polkit-org#9 0x0000005097c1 in polkit_backend_action_pool_get_all_actions /root/polkit/build/../src/polkitbackend/polkitbackendactionpool.c:456:3 [357268.749382] polkitd[15601]: polkit-org#10 0x0000004e80fd in server_handle_enumerate_actions /root/polkit/build/../src/polkitbackend/polkitbackendauthority.c:689:13 [357268.749382] polkitd[15601]: polkit-org#11 0x0000004e80fd in server_handle_method_call /root/polkit/build/../src/polkitbackend/polkitbackendauthority.c:1326:5 [357268.749382] polkitd[15601]: polkit-org#12 0x7fe21ee26195 (/lib64/libgio-2.0.so.0+0xd9195) (BuildId: d06dc1cc6f8ddbb3cda89ef05ecf83d6fe037ae7) [357268.749382] polkitd[15601]: polkit-org#13 0x7fe21ebe4e5c (/lib64/libglib-2.0.so.0+0x46e5c) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [357268.749382] polkitd[15601]: polkit-org#14 0x7fe21ebde60b (/lib64/libglib-2.0.so.0+0x4060b) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [357268.749382] polkitd[15601]: polkit-org#15 0x7fe21ec3eb37 (/lib64/libglib-2.0.so.0+0xa0b37) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [357268.749382] polkitd[15601]: polkit-org#16 0x7fe21ebe46f6 in g_main_loop_run (/lib64/libglib-2.0.so.0+0x466f6) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [357268.749797] polkitd[15601]: polkit-org#17 0x0000004e3619 in main /root/polkit/build/../src/polkitbackend/polkitd.c:298:3 [357268.749797] polkitd[15601]: polkit-org#18 0x7fe21e71a447 in __libc_start_call_main (/lib64/libc.so.6+0x3447) (BuildId: f3ac204eaa4ceed81438c80e80998209f828bb1a) [357268.749797] polkitd[15601]: polkit-org#19 0x7fe21e71a50a in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x350a) (BuildId: f3ac204eaa4ceed81438c80e80998209f828bb1a) [357268.749797] polkitd[15601]: polkit-org#20 0x000000401c04 in _start (/usr/lib/polkit-1/polkitd+0x401c04) (BuildId: a927b98f2ddc1b57773bec4e0f8a537fe46632b1) Follow-up for 9958c25.
Otherwise it gets leaked: [356645.511913] systemd[1]: Stopping polkit.service - Authorization Manager... [356645.514024] polkitd[15468]: Handling SIGTERM [356645.514024] polkitd[15468]: Shutting down [356645.519238] polkitd[15468]: Exiting with code 0 [356645.618456] polkitd[15468]: ================================================================= [356645.618456] polkitd[15468]: ==15468==ERROR: LeakSanitizer: detected memory leaks [356645.618456] polkitd[15468]: Direct leak of 4000 byte(s) in 50 object(s) allocated from: [356645.619128] polkitd[15468]: #0 0x0000004a1a33 in malloc (/usr/lib/polkit-1/polkitd+0x4a1a33) (BuildId: a927b98f2ddc1b57773bec4e0f8a537fe46632b1) [356645.619128] polkitd[15468]: #1 0x7f1b20324039 in g_malloc (/lib64/libglib-2.0.so.0+0x47039) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: #2 0x7f1b2033d4d4 in g_slice_alloc (/lib64/libglib-2.0.so.0+0x604d4) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: #3 0x7f1b2036b547 in g_variant_iter_new (/lib64/libglib-2.0.so.0+0x8e547) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: #4 0x7f1b2036dc5d (/lib64/libglib-2.0.so.0+0x90c5d) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: #5 0x7f1b2036d8b7 (/lib64/libglib-2.0.so.0+0x908b7) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: #6 0x7f1b2036de0f in g_variant_get_va (/lib64/libglib-2.0.so.0+0x90e0f) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: #7 0x7f1b2036df88 in g_variant_get (/lib64/libglib-2.0.so.0+0x90f88) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: #8 0x7f1b2067ce85 in polkit_system_bus_name_get_creds_sync /root/polkit/build/../src/polkit/polkitsystembusname.c:542:3 [356645.619128] polkitd[15468]: #9 0x7f1b2067c997 in polkit_system_bus_name_get_process_sync /root/polkit/build/../src/polkit/polkitsystembusname.c:629:8 [356645.619128] polkitd[15468]: #10 0x0000005069af in polkit_backend_session_monitor_get_session_for_subject /root/polkit/build/../src/polkitbackend/polkitbackendsessionmonitor-systemd.c:365:41 [356645.619128] polkitd[15468]: #11 0x0000004f11b5 in polkit_backend_interactive_authority_revoke_temporary_authorization_by_id /root/polkit/build/../src/polkitbackend/polkitbackendinteractiveauthority.c:3567:24 [356645.619128] polkitd[15468]: #12 0x0000004ea2c8 in server_handle_revoke_temporary_authorization_by_id /root/polkit/build/../src/polkitbackend/polkitbackendauthority.c:1292:8 [356645.619128] polkitd[15468]: #13 0x0000004e805c in server_handle_method_call /root/polkit/build/../src/polkitbackend/polkitbackendauthority.c:1346:5 [356645.619128] polkitd[15468]: #14 0x7f1b20565195 (/lib64/libgio-2.0.so.0+0xd9195) (BuildId: d06dc1cc6f8ddbb3cda89ef05ecf83d6fe037ae7) [356645.619332] polkitd[15468]: #15 0x7f1b20323e5c (/lib64/libglib-2.0.so.0+0x46e5c) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619332] polkitd[15468]: #16 0x7f1b2031d60b (/lib64/libglib-2.0.so.0+0x4060b) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619332] polkitd[15468]: #17 0x7f1b2037db37 (/lib64/libglib-2.0.so.0+0xa0b37) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619332] polkitd[15468]: #18 0x7f1b203236f6 in g_main_loop_run (/lib64/libglib-2.0.so.0+0x466f6) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619332] polkitd[15468]: #19 0x0000004e3619 in main /root/polkit/build/../src/polkitbackend/polkitd.c:298:3 [356645.619332] polkitd[15468]: #20 0x7f1b1fe59447 in __libc_start_call_main (/lib64/libc.so.6+0x3447) (BuildId: f3ac204eaa4ceed81438c80e80998209f828bb1a) [356645.619332] polkitd[15468]: #21 0x7f1b1fe5950a in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x350a) (BuildId: f3ac204eaa4ceed81438c80e80998209f828bb1a) [356645.619332] polkitd[15468]: #22 0x000000401c04 in _start (/usr/lib/polkit-1/polkitd+0x401c04) (BuildId: a927b98f2ddc1b57773bec4e0f8a537fe46632b1) ... Follow-up for 8cabb11.
[357268.621800] systemd[1]: Stopping polkit.service - Authorization Manager... [357268.623321] polkitd[15601]: Handling SIGTERM [357268.623321] polkitd[15601]: Shutting down [357268.629022] polkitd[15601]: Exiting with code 0 [357268.748206] polkitd[15601]: ================================================================= [357268.748455] polkitd[15601]: ==15601==ERROR: LeakSanitizer: detected memory leaks [357268.748455] polkitd[15601]: Direct leak of 48 byte(s) in 3 object(s) allocated from: [357268.749382] polkitd[15601]: #0 0x0000004a1a33 in malloc (/usr/lib/polkit-1/polkitd+0x4a1a33) (BuildId: a927b98f2ddc1b57773bec4e0f8a537fe46632b1) [357268.749382] polkitd[15601]: #1 0x7fe21ebe5039 in g_malloc (/lib64/libglib-2.0.so.0+0x47039) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [357268.749382] polkitd[15601]: #2 0x7fe21ebfe4d4 in g_slice_alloc (/lib64/libglib-2.0.so.0+0x604d4) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [357268.749382] polkitd[15601]: #3 0x7fe21ebfe5c4 in g_slice_alloc0 (/lib64/libglib-2.0.so.0+0x605c4) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [357268.749382] polkitd[15601]: #4 0x7fe21ebc6910 (/lib64/libglib-2.0.so.0+0x28910) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [357268.749382] polkitd[15601]: #5 0x7fe21ebc70a4 in g_error_new_valist (/lib64/libglib-2.0.so.0+0x290a4) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [357268.749382] polkitd[15601]: #6 0x7fe21ebc72e0 in g_set_error (/lib64/libglib-2.0.so.0+0x292e0) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [357268.749382] polkitd[15601]: #7 0x7fe21ee50b52 (/lib64/libgio-2.0.so.0+0x103b52) (BuildId: d06dc1cc6f8ddbb3cda89ef05ecf83d6fe037ae7) [357268.749382] polkitd[15601]: #8 0x000000508a88 in ensure_all_files /root/polkit/build/../src/polkitbackend/polkitbackendactionpool.c:572:18 [357268.749382] polkitd[15601]: #9 0x0000005097c1 in polkit_backend_action_pool_get_all_actions /root/polkit/build/../src/polkitbackend/polkitbackendactionpool.c:456:3 [357268.749382] polkitd[15601]: #10 0x0000004e80fd in server_handle_enumerate_actions /root/polkit/build/../src/polkitbackend/polkitbackendauthority.c:689:13 [357268.749382] polkitd[15601]: #11 0x0000004e80fd in server_handle_method_call /root/polkit/build/../src/polkitbackend/polkitbackendauthority.c:1326:5 [357268.749382] polkitd[15601]: #12 0x7fe21ee26195 (/lib64/libgio-2.0.so.0+0xd9195) (BuildId: d06dc1cc6f8ddbb3cda89ef05ecf83d6fe037ae7) [357268.749382] polkitd[15601]: #13 0x7fe21ebe4e5c (/lib64/libglib-2.0.so.0+0x46e5c) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [357268.749382] polkitd[15601]: #14 0x7fe21ebde60b (/lib64/libglib-2.0.so.0+0x4060b) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [357268.749382] polkitd[15601]: #15 0x7fe21ec3eb37 (/lib64/libglib-2.0.so.0+0xa0b37) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [357268.749382] polkitd[15601]: #16 0x7fe21ebe46f6 in g_main_loop_run (/lib64/libglib-2.0.so.0+0x466f6) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [357268.749797] polkitd[15601]: #17 0x0000004e3619 in main /root/polkit/build/../src/polkitbackend/polkitd.c:298:3 [357268.749797] polkitd[15601]: #18 0x7fe21e71a447 in __libc_start_call_main (/lib64/libc.so.6+0x3447) (BuildId: f3ac204eaa4ceed81438c80e80998209f828bb1a) [357268.749797] polkitd[15601]: #19 0x7fe21e71a50a in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x350a) (BuildId: f3ac204eaa4ceed81438c80e80998209f828bb1a) [357268.749797] polkitd[15601]: #20 0x000000401c04 in _start (/usr/lib/polkit-1/polkitd+0x401c04) (BuildId: a927b98f2ddc1b57773bec4e0f8a537fe46632b1) Follow-up for 9958c25.
In gitlab.freedesktop.org by bugzilla-migration on Apr 13, 2018, 07:22
Link to the original issue: https://gitlab.freedesktop.org/polkit/polkit/-/issues/11
Submitted by [email protected]
Assigned to David Zeuthen
@david
Link to original bug (#106021)
Description
Hi,
We found a prolem of polkitd.
When run subprocess timeout in rules ,the utils_spawn_data_free reap timeout subprocess did not work , and it result in a large number of zombie processes
It can be reproduced in fedora27. And the upstream has not fix it.
How to reproduce:
Add a debug rule , this rule waill run spawn process over 10s and result in a timeout
[root@localhost ~]# cat /etc/polkit-1/rules.d/01-test.rules
polkit.addRule(function(action, subject) {
polkit.log("debug start")
try {
polkit.spawn(["/usr/bin/sleep", "15"]);
} catch (error) {
// polkit.log(error)
}
});
have a look at the prcess of polkitd,
[root@localhost ~]# ps -ef |grep polkit |grep -v polkit
polkitd 1501 1 0 Mar31 ? 00:02:51 /usr/lib/polkit-1/polkitd --no-debug
polkitd 5060 1501 0 12:37 ? 00:00:00 [sleep]
<defunct>
polkitd 5367 1501 0 12:38 ? 00:00:00 [sleep]
<defunct>
polkitd 5631 1501 0 12:38 ? 00:00:00 [sleep]
<defunct>
polkitd 5915 1501 0 12:38 ? 00:00:00 [sleep]
<defunct>
polkitd 14052 1501 0 12:42 ? 00:00:00 sleep 20
[root@localhost ~]# journalctl -fu polkit
-- Logs begin at Sat 2018-03-31 14:36:03 CST. --
Apr 03 12:39:11 2-3 polkitd[1501]: /etc/polkit-1/rules.d/01-test.rules:5: Error: Error spawning helper: Timed out after 10 seconds (g-io-error-quark, 24)
Apr 03 12:39:21 2-3 polkitd[1501]: /etc/polkit-1/rules.d/01-test.rules:5: Error: Error spawning helper: Timed out after 10 seconds (g-io-error-quark, 24)
Apr 03 12:40:11 2-3 polkitd[1501]: /etc/polkit-1/rules.d/01-test.rules:5: Error: Error spawning helper: Timed out after 10 seconds (g-io-error-quark, 24)
Apr 03 12:40:21 2-3 polkitd[1501]: /etc/polkit-1/rules.d/01-test.rules:5: Error: Error spawning helper: Timed out after 10 seconds (g-io-error-quark, 24)
The text was updated successfully, but these errors were encountered: