RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1687899 - gssproxy thread may block indefinitely inside epoll_wait() due to race with a second thread closing gpmctx->epollfd
Summary: gssproxy thread may block indefinitely inside epoll_wait() due to race with a...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: gssproxy
Version: 7.6
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: rc
: ---
Assignee: Robbie Harwood
QA Contact: anuja
URL:
Whiteboard:
Depends On:
Blocks: 1594286 1690082
TreeView+ depends on / blocked
 
Reported: 2019-03-12 15:12 UTC by Dave Wysochanski
Modified: 2023-12-15 16:26 UTC (History)
9 users (show)

Fixed In Version: gssproxy-0.7.0-24.el7
Doc Type: Bug Fix
Doc Text:
Cause: Race condition and kernel bug around epoll_wait() Consequence: gssproxy can hang, causing, e.g., NFS to block and fail. Fix: Fix user-space portion of race and add epoll timeouts. Result: Problem should be fixed, and any future similar problems will cause timeouts rather than hangs.
Clone Of:
: 1690082 (view as bug list)
Environment:
Last Closed: 2019-08-06 12:39:15 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
sample test program that shows thread1 calling epoll_wait with valid epoll_fd then thread2 calling close(epoll_fd) - thread1 will never wake up (5.35 KB, text/x-csrc)
2019-03-12 15:12 UTC, Dave Wysochanski
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker FREEIPA-10645 0 None None None 2023-12-15 16:26:02 UTC
Red Hat Knowledge Base (Solution) 3896131 0 Troubleshoot None RHEL7.6: NFS4 client using gssproxy with kerberos NFS share and Active Directory on windows 2016 sees process hangs in g... 2019-03-14 12:08:21 UTC
Red Hat Product Errata RHBA-2019:2050 0 None None None 2019-08-06 12:39:21 UTC

Description Dave Wysochanski 2019-03-12 15:12:18 UTC
Created attachment 1543238 [details]
sample test program that shows thread1 calling epoll_wait with valid epoll_fd then thread2 calling close(epoll_fd) - thread1 will never wake up

Description of problem:
There is a possible race condition inside gssproxy where one thread may call into epoll_wait(gpmctx->epollfd, ...) and while inside, a second thread may call close on (gpmctx->epollfd).  The thread inside epoll_wait is not woken up despite the second thread's close() operation but may hang inside epoll_wait().

We discovered this issue when studying a possible kernel bug where processes could hang indefinitely waiting for rpc.gssd upcall:
https://bugzilla.redhat.com/show_bug.cgi?id=1511706#c41

gpm_make_call() may release the mutex too early and as a result a thread race may be possible.

int gpm_make_call(int proc, union gp_rpc_arg *arg, union gp_rpc_res *res)
...
    /* grab the lock for the whole conversation */
    ret = gpm_grab_sock(gpmctx);
...    
    /* Send request, receive response with timeout */
    ret = gpm_send_recv_loop(gpmctx, send_buffer, send_length, &recv_buffer,
                             &recv_length);
    /* release the lock */
    gpm_release_sock(gpmctx);
    sockgrab = false;         // at this point some other thread could grab the lock and race with this one
...
done:
    gpm_timer_close(gpmctx);  // sets timerfd = -1 as seen in corefile
    gpm_epoll_close(gpmctx);  // sets epollfd = -1 as seen in corefile
...




Version-Release number of selected component (if applicable):
gssproxy-0.7.0-21.el7

How reproducible:
TBD - should be reproducible with delay inserted in gssproxy code

Steps to Reproduce:
See attached program which demonstrates the possibility of a hang inside epoll_wait()

Actual results:
gssproxy thread may hang inside epoll_wait() indefinitely

Expected results:
no indefinite hang inside epoll_wait() in gssproxy


Additional info:

Since this problem is so well defined and has a patch under testing, it makes sense to file this as a specific bug.

Comment 16 anuja 2019-06-27 05:59:20 UTC
As it needs sanity only verification
Adding downstream bash/ipa-client-automount beaker job.
https://beaker.engineering.redhat.com/jobs/3631144

Comment 17 Yongcheng Yang 2019-06-27 07:18:47 UTC
JFYI. our NFS regression tests work well (no new failure found)
ever since the fixed version gssproxy-0.7.0-24.el7

Comment 19 errata-xmlrpc 2019-08-06 12:39:15 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:2050


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