Bug 1465735 - non root user run kdumpctl cause dead loop
non root user run kdumpctl cause dead loop
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: kexec-tools (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Ziyue Yang
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-28 00:57 EDT by Dave Young
Modified: 2017-07-24 00:34 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1474174 (view as bug list)
Environment:
Last Closed: 2017-07-14 04:11:15 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Dave Young 2017-06-28 00:57:19 EDT
Description of problem:
Run `kdumpctl status` as normal user, get below error messages:

Another app is currently holding the kdump lock; waiting for it to exit...
flock: 9: Bad file descriptor
Another app is currently holding the kdump lock; waiting for it to exit...
flock: 9: Bad file descriptor
Another app is currently holding the kdump lock; waiting for it to exit...
flock: 9: Bad file descriptor
Another app is currently holding the kdump lock; waiting for it to exit...
flock: 9: Bad file descriptor
Another app is currently holding the kdump lock; waiting for it to exit...
flock: 9: Bad file descriptor
Another app is currently holding the kdump lock; waiting for it to exit...
flock: 9: Bad file descriptor
Another app is currently holding the kdump lock; waiting for it to exit...
flock: 9: Bad file descriptor
Another app is currently holding the kdump lock; waiting for it to exit...
flock: 9: Bad file descriptor
Another app is currently holding the kdump lock; waiting for it to exit..

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
Comment 1 Ziyue Yang 2017-07-03 03:43:23 EDT
This bug is caused by behavior difference between bash and sh(bash in posix).

In the function single_instance_lock in kdumpctl script, there is

exec 9>/var/lock/kdump

which will fail in user mode. However, this fail will cause script exit under bash and non-exit under sh, causing infinite loop because the flock will always fail.

According to the 15th item in
ftp://ftp.gnu.org/old-gnu/Manuals/bash-2.02/html_node/bashref_66.html

If a POSIX.2 special builtin returns an error status, a non-interactive shell exits.

And according to
https://www.gnu.org/software/bash/manual/html_node/Special-Builtins.html

These are the POSIX special builtins:

break : . continue eval exec exit export readonly return set
shift trap unset

I suggest fixing the bug by checking exec return value.
Comment 2 Ziyue Yang 2017-07-03 03:43:50 EDT
Sorry it should be the 16th item.

Note You need to log in before you can comment on or make changes to this bug.