Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1489617

Summary: exportfs segfault due to incorrect sign in export_hash function
Product: Red Hat Enterprise Linux 6 Reporter: Frank Sorenson <fsorenso>
Component: nfs-utilsAssignee: Steve Dickson <steved>
Status: CLOSED ERRATA QA Contact: Yongcheng Yang <yoyang>
Severity: high Docs Contact:
Priority: urgent    
Version: 6.9CC: dwysocha, jsinclea, mthacker, steved, swhiteho, tbecker, xzhou, yieli, yoyang
Target Milestone: rcKeywords: EasyFix, Patch, TestCaseProvided, ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nfs-utils-1.2.3-76.el6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1500920 (view as bug list) Environment:
Last Closed: 2018-06-19 05:08:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1461138, 1500920    

Description Frank Sorenson 2017-09-07 23:26:29 UTC
Description of problem:

If the path to be exported is long, or contains multi-byte characters, the export_hash() function may return a negative value, rather than a hash value within the correct range (0-1021).  This may lead to a segfault due to accessing a memory location outside of the hash.


Version-Release number of selected component (if applicable):
nfs-utils-1.2.3-75.el6.x86_64


How reproducible:

easy


Steps to Reproduce:

# mkdir -p /exports/Общедоступные
# echo "/exports/Общедоступные 1.2.3.4(rw)" >> /etc/exports
#  exportfs -arv


Actual results:

# exportfs -arv
Segmentation fault (core dumped)


Expected results:

no segfault


Additional info:


This is fixed in the following upstream commit:

commit a16f4a13677d13b0aae9327a3b9e8414470b7927
Author: Ivan Romanov <drizt>
Date:   2012-10-15 12:41:36 -0400

    Exportfs crashes with long path
    
    Acked-by: Bruce Fields <bfields>
    Signed-off-by: Steve Dickson <steved>

diff --git a/support/export/export.c b/support/export/export.c
index 4fda30a..0257903 100644
--- a/support/export/export.c
+++ b/support/export/export.c
@@ -357,7 +357,7 @@ strtoint(char *str)
 static int 
 export_hash(char *str)
 {
-       int num = strtoint(str);
+       unsigned int num = strtoint(str);
 
        return num % HASH_TABLE_SIZE;
 }

Comment 5 Yongcheng Yang 2017-10-10 06:17:52 UTC
Just to record the reproduced log with RHEL-6.9 default nfs-utils.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[root@ibm-x3550m4-02 ~]# rpm -q nfs-utils
nfs-utils-1.2.3-75.el6.x86_64
[root@ibm-x3550m4-02 ~]# exportfs -vi 127.0.0.1:/exports/Общедоступные
Segmentation fault (core dumped)
[root@ibm-x3550m4-02 ~]# exportfs -vi 127.0.0.1:/exports/公共目录
Segmentation fault (core dumped)
[root@ibm-x3550m4-02 ~]# echo $?
139
[root@ibm-x3550m4-02 ~]#

Comment 10 Yongcheng Yang 2017-10-17 04:09:06 UTC
Moving to VERIFIED and include this as regression test.

Verify logs of nfs-utils-1.2.3-76.el6
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[root@ibm-x3550m4-02 ~]# rpm -q nfs-utils
nfs-utils-1.2.3-75.el6.x86_64
[root@ibm-x3550m4-02 ~]# exportfs -vi 127.0.0.1:/exports/Общедоступные
Segmentation fault (core dumped)
[root@ibm-x3550m4-02 ~]# exportfs -vi 127.0.0.1:/exports/公共目录
Segmentation fault (core dumped)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Reproduced
[root@ibm-x3550m4-02 ~]# 
[root@ibm-x3550m4-02 ~]# rpm -Uvh nfs-utils-1.2.3-76.el6.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:nfs-utils              ########################################### [100%]
[root@ibm-x3550m4-02 ~]# rpm -q nfs-utils
nfs-utils-1.2.3-76.el6.x86_64
[root@ibm-x3550m4-02 ~]# exportfs -v
[root@ibm-x3550m4-02 ~]# mkdir /exports/公共目录
[root@ibm-x3550m4-02 ~]# mkdir /exports/Общедоступные
[root@ibm-x3550m4-02 ~]# exportfs -vi 127.0.0.1:/exports/公共目录
exporting 127.0.0.1:/exports/公共目录
[root@ibm-x3550m4-02 ~]# exportfs -vi 127.0.0.1:/exports/Общедоступные
exporting 127.0.0.1:/exports/Общедоступные
[root@ibm-x3550m4-02 ~]# exportfs -v
/exports/Общедоступные
                127.0.0.1(ro,wdelay,root_squash,no_subtree_check,sec=sys,ro,root_squash,no_all_squash)
/exports/公共目录
                127.0.0.1(ro,wdelay,root_squash,no_subtree_check,sec=sys,ro,root_squash,no_all_squash)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Verified
[root@ibm-x3550m4-02 ~]#

Comment 13 errata-xmlrpc 2018-06-19 05:08: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-2018:1855