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 1404291

Summary: vsftpd stack overflow on incorrect config file
Product: Red Hat Enterprise Linux 7 Reporter: Paulo Andrade <pandrade>
Component: vsftpdAssignee: Martin Sehnoutka <msehnout>
Status: CLOSED DUPLICATE QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: low Docs Contact:
Priority: low    
Version: 7.2CC: sbroz
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-12-15 08:51:39 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:

Description Paulo Andrade 2016-12-13 14:49:37 UTC
Backtrace looks like:

#0  0x00007fa18db538f1 in __openat_nocancel (mode=<optimized out>, oflag=-128, 
    file=0x3 <Address 0x3 out of bounds>, fd=0)
    at ../sysdeps/unix/sysv/linux/openat.c:94
#1  __GI___openat (fd=0, file=0x3 <Address 0x3 out of bounds>, 
    oflag=<optimized out>) at ../sysdeps/unix/sysv/linux/openat.c:170
#2  0x00007fa18f0f9023 in vsf_sysutil_activate_noblock (fd=-902463408, 
    fd@entry=0) at sysutil.c:766
#3  0x00007fa18f0e874b in bug (p_text=p_text@entry=0x7fa18f1013d4 "fcntl")
    at utility.c:44
#4  0x00007fa18f0e8799 in die (p_text=p_text@entry=0x7fa18f1013d4 "fcntl")
    at utility.c:19
#5  0x00007fa18f0f9070 in vsf_sysutil_activate_noblock (fd=fd@entry=0)
    at sysutil.c:769
#6  0x00007fa18f0e874b in bug (p_text=p_text@entry=0x7fa18f1013d4 "fcntl")
    at utility.c:44
#7  0x00007fa18f0e8799 in die (p_text=p_text@entry=0x7fa18f1013d4 "fcntl")
    at utility.c:19
#8  0x00007fa18f0f9070 in vsf_sysutil_activate_noblock (fd=fd@entry=0)
    at sysutil.c:769
...

basically, it enters an infinite recursion where
vsf_sysutil_activate_noblock() calls die() that calls
bug() that calls vsf_sysutil_activate_noblock().

  Reproducer and possible patch listed at:
https://lists.freebsd.org/pipermail/freebsd-ports-bugs/2005-October/068040.html

Comment 2 Martin Sehnoutka 2016-12-15 08:51:39 UTC
Hi,

Thank you for you report, did you really try it with our version vsftpd package? 

From my point of view our version of vsftpd is slightly modified and this bug does not work for it.

Comment 3 Paulo Andrade 2016-12-15 14:05:02 UTC
  I am uncertain how the customer managed to generated the
coredump using vsftpd-3.0.2-11.el7_2.x86_64.

  The issue can be reproduced with:

---8<---
# echo "a'/." >> /etc/vsftpd/vsftpd.conf

$ cat fcntl.c
#include <stdio.h>
#include <string.h>
#include <dlfcn.h>
#include <sys/types.h>

/* Function pointers to hold the value of the glibc functions */
static  int (*real_fcntl)(int fd, int cmd, ...) = NULL;

int fcntl(int fd, int cmd, ...)
{
    if (real_fcntl == NULL)
        real_fcntl = dlsym(RTLD_NEXT, "write");
    if (fd == 0)
	return -1;
    return real_fcntl(fd, cmd);
}

$ gcc -D_GNU_SOURCE=1 -o fcntl.so -shared -fPIC fcntl.c -ldl
$ LD_PRELOAD=$PWD/fcntl.so vsftpd 
---8<---

Comment 4 Stepan Broz 2019-09-20 09:51:15 UTC

*** This bug has been marked as a duplicate of bug 1666380 ***