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 1776096 - [rpc.statd] New use-after-free in monitor list when insertion fails for existing entry
Summary: [rpc.statd] New use-after-free in monitor list when insertion fails for exist...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: nfs-utils
Version: 8.2
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: 8.2
Assignee: Steve Dickson
QA Contact: Yongcheng Yang
URL:
Whiteboard:
Depends On:
Blocks: 1776036 1776957
TreeView+ depends on / blocked
 
Reported: 2019-11-25 06:48 UTC by Yongcheng Yang
Modified: 2022-05-02 04:27 UTC (History)
7 users (show)

Fixed In Version: nfs-utils-2.3.3-29.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-28 16:51:05 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-32043 0 None None None 2022-05-02 04:27:58 UTC
Red Hat Product Errata RHBA-2020:1832 0 None None None 2020-04-28 16:51:25 UTC

Description Yongcheng Yang 2019-11-25 06:48:50 UTC
Description of problem:
The patch of Bug 1746572 modifies file "utils/statd/monitor.c" which might introduce an use_after_free problem. 

It might be USE_AFTER_FREE issue as this reproducer is from Bug 1624542 (Fix use-after-free in rpc.statd monitor list when insertion fails for existing entry).

Version-Release number of selected component (if applicable):
nfs-utils-2.3.3-27.el8
(previous version 2.3.3-26.el8 is good)

How reproducible:
always

Steps to Reproduce:
1. chown -R rpcuser:rpcuser /var/lib/nfs/statd/sm{,.bak}  # Not neccessary for the first time
2. ./nsm_client mon 192.168.123.1 1
3. chown -R root:root /var/lib/nfs/statd/sm{,.bak}
4. ./nsm_client mon 192.168.123.1 2
5. # Check `rpc.statd` exists or not

Actual results:
[root.0 ~]# ll /var/lib/nfs/statd
total 0
drwx------. 2 rpcuser rpcuser 6 Nov 11 09:29 sm     <<<<
drwx------. 2 rpcuser rpcuser 6 Nov 11 09:29 sm.bak <<<<
[root.0 ~]# ps aux | grep -v grep | grep statd
rpcuser   1625  0.0  0.0  45472  3764 ?        Ss   01:12   0:00 rpc.statd
[root.0 ~]# ./nsm_client mon 192.168.123.10 1
Calling 127.0.0.1 (as rhel-8.2.0.rhts.eng.pek2.redhat.com) to monitor 192.168.123.10
SM_MON request successful, state: 5
[root.0 ~]# chown -R root:root /var/lib/nfs/statd/sm{,.bak}
[root.0 ~]# ll /var/lib/nfs/statd/
total 0
drwx------. 2 root root 217 Nov 25 01:13 sm       <<<<<
drwx------. 2 root root   6 Nov 11 09:29 sm.bak   <<<<<
[root.0 ~]# ps aux | grep -v grep | grep statd
rpcuser   1625  0.0  0.1  61460  4620 ?        Ss   01:12   0:00 rpc.statd
[root.0 ~]# ./nsm_client mon 192.168.123.10 2
Calling 127.0.0.1 (as rhel-8.2.0.rhts.eng.pek2.redhat.com) to monitor 192.168.123.10
RPC:0
sm_mon_1: RPC: Unable to receive; errno = Connection refused   <<<<<<<<<<<<<<
[root.0 ~]# ps aux | grep -v grep | grep statd
[root.0 ~]# coredumpctl 
No coredumps found.
[root.0 ~]# tail /var/log/messages 
...
Nov 25 01:16:20 rhel-8.2.0 kernel: rpc.statd[1625]: segfault at 10 ip 000055c3e9717a0a sp 00007ffca5641e90 error 6 in rpc.statd (deleted)[55c3e9712000+17000]
Nov 25 01:16:20 rhel-8.2.0 kernel: Code: 7c e6 ff ff 48 8d 3d fa b7 00 00 31 c0 e8 6e 9a 00 00 e9 81 fe ff ff 48 8d 35 c2 b5 00 00 bf 01 00 00 00 31 c0 e8 86 97 00 00 <c7> 04 25 10 00 00 00 00 00 00 00 0f 0b e8 f4 e5 ff ff 0f 1f 40 00
...
[root.0 ~]# rpm -q nfs-utils
nfs-utils-2.3.3-27.el8.x86_64
[root.0 ~]# 


Expected results:
No crash rpc.statd

Additional info:

Comment 1 Steve Whitehouse 2019-12-16 10:58:38 UTC
Since this is a regression, should it also be a blocker for 8.2?

Comment 4 Steve Dickson 2020-01-13 17:26:11 UTC
(In reply to Steve Whitehouse from comment #1)
> Since this is a regression, should it also be a blocker for 8.2?

It is a regression... since the permission denied broke.
The fix is an easy one

diff -up ./tests/nsm_client/nlm_sm_inter.h.orig ./tests/nsm_client/nlm_sm_inter.h
diff -up ./utils/statd/monitor.c.orig ./utils/statd/monitor.c
--- ./utils/statd/monitor.c.orig	2020-01-13 10:06:55.962136625 -0500
+++ ./utils/statd/monitor.c	2020-01-13 11:01:43.037265175 -0500
@@ -177,7 +177,6 @@ sm_mon_1_svc(struct mon *argp, struct sv
 	 * We're committed...ignoring errors.  Let's hope that a malloc()
 	 * doesn't fail.  (I should probably fix this assumption.)
 	 */
-	clnt = NULL;
 	if (!existing && !(clnt = nlist_new(my_name, mon_name, 0))) {
 		free(dnsname);
 		xlog_warn("out of memory");

So we need to fix this.... Waiting on the blocker ack.

Comment 10 errata-xmlrpc 2020-04-28 16:51:05 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-2020:1832


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