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 103401 - glibc: [RFE] RPC (on boot) port selection collisions between various applications
Summary: glibc: [RFE] RPC (on boot) port selection collisions between various applicat...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: glibc
Version: 8.2
Hardware: All
OS: Linux
urgent
urgent
Target Milestone: rc
: 8.2
Assignee: glibc team
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
: 51904 83985 113586 125962 154800 189144 191950 218216 (view as bug list)
Depends On: 723228 786076 790682 790684 790685 790686 790687 790690 802240 913509
Blocks: 168996 170445 756082 1594286
TreeView+ depends on / blocked
 
Reported: 2003-08-29 20:13 UTC by Steve Bonneville
Modified: 2023-07-18 16:03 UTC (History)
62 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-07-06 14:37:26 UTC
Type: Enhancement
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 223937 0 medium CLOSED rpc.rquotad grabs port 993 breaking dovecot IMAPs 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 455859 0 medium CLOSED rpc.rquotad grabs port 993 breaking dovecot IMAPs 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 1854147 0 unspecified CLOSED libtirpc: Suggestions for bindresvport denylist additions 2023-06-18 08:05:54 UTC
Red Hat Issue Tracker RHELPLAN-34760 0 None None None 2021-09-17 11:41:58 UTC
Sourceware 456 0 P2 REOPENED bindresvport() may ports reserved by other services... 2020-09-11 03:00:13 UTC

Internal Links: 223937 455859 1854147

Description Steve Bonneville 2003-08-29 20:13:45 UTC
Description of problem:

On boot, ypbind occasionally grabs port 631/udp, blocking CUPS from binding to
the port.  This is a glibc problem because ypbind is a RPC service that has its
port assigned dynamically through bindresvport().

The code in libc/sunrpc/bindrsvprt.c shows the port number is assigned purely
based on the PID of the ypbind process, something like

  port = (PID % 424) + 600

The PID seems to vary slightly from reboot to reboot, but generally is in the
870s on the machine in question, resulting in ports assigned in the vicinity of
630.  CUPS (actually, IPP) has ports 631/tcp and 631/udp reserved.  NIS starts
first, so it wins, and since CUPS has a reserved Well Known Port, it can't
relocate and loses.

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

How reproducible:
Depends entirely on the PID handed to ypbind on boot, and the exact set of
services configured affects this.  

Suggested Fix:
The glibc algorithm already blacklists all reserved ports below 600, presumably
to avoid this exact problem.  Consider altering the code to blacklist 5 to 8
additional ports in the 600-1023 range that are or may be in common use:

  631     (IPP == CUPS)
  636     (LDAPS)
  749     (Kerberos V kadmin)
  873     (rsyncd)
  992-995 (SSL-enabled telnet, IMAP, IRC, and POP3)

The ports lost could be recovered, if desired, by allowing ports in the 590-600
range to be assigned by bindrsvprt().

Comment 1 Jakub Jelinek 2003-09-01 21:43:29 UTC
According to Ulrich Drepper, daemons requiring specific ports in the 600-1023
range need to be started before any daemons using bindresvport.

Comment 2 Tim Waugh 2003-09-02 16:29:53 UTC
I think that portmap ought to be tought how to avoid a list of ports. 
Otherwise, once I've stopped cupsd (for whatever reason) and restarted ypbind, I
can no longer be sure that cupsd will ever start again.

Comment 3 Tim Waugh 2003-09-02 21:06:25 UTC
(see above comment)

Comment 4 Steve Bonneville 2003-09-03 06:04:59 UTC
If you accept Ulrich's argument that this is a service bug, then this is NOT
just a CUPS bug.  It's also a bug against xinetd-2.3.12-0.3E, openldap-2.0.27-9,
and krb5-server-1.2.7-15.  ALL of the services in the distribution that I know
about that use Well Known Ports in the 600-1023 range start up AFTER ypbind, not
before! 



 





Comment 5 Tim Waugh 2003-09-03 15:04:29 UTC
This problem should be solved in portmap.  Here is a proof-of-concept, which I
think should be merged into portmap: http://cyberelk.net/tim/portreserve.  In
summary: portmap should read a directory of configuration files, one per daemon,
each containing the name of the service that is out of bounds.

(I know that bindresvport is the culprit, but what other users of that are there
really?)

Comment 6 Steve Bonneville 2003-11-15 00:51:46 UTC
I'm moving this to RHEL 3 because we're still seeing this in operation
on servers with that version installed.

I don't know what else uses bindresvport, if anything, I just know
that if you have ypserv and CUPS running, there's a pretty decent
chance of a collision on boot which breaks CUPS.



Comment 7 Joe Orton 2003-12-24 10:32:08 UTC
spamassassin's spamd is another possible collision (though not in
RHEL), it uses port 783 by default.

Comment 8 Aleksey Nogin 2004-01-07 04:50:06 UTC
*** Bug 83985 has been marked as a duplicate of this bug. ***

Comment 9 Tim Waugh 2004-01-15 16:40:41 UTC
*** Bug 113586 has been marked as a duplicate of this bug. ***

Comment 10 Jeff Minelli 2004-01-16 20:09:27 UTC
NFS also causes port collisions, more specifically rpc.rquotad.

Comment 11 Orion Poplawski 2004-05-12 16:35:31 UTC
I just had a collision between rpc.mountd and cups.

Comment 13 Alexandre Oliva 2004-07-20 19:42:40 UTC
Regarding command #1 (daemons requiring specific ports in the 600-1023
range need to be started before any daemons using bindresvport): if
you consider that ypbind (that uses bindresvport) is often necessary
to obtain user information, host information, service port numbers,
etc, and that starting services that require such information before
it's available won't work, we've got a catch 22 situation.  We really
need a better way to reserve ports such that portmap doesn't take them
over.

portreserve looks like a perfect solution for the problem, except that
it can't rely on th ypbind services map, so there's a slight risk that
it might reserve a port based on /etc/services that turns out to be
different in the NIS map, or even that the port number can't be
identified because it's only defined in the services map.  I suppose
it's a resonable requirement to have any ports that are to be reserved
by portreserve defined in /etc/services or some other database that's
available early enough in the boot.

Comment 14 Bill Nottingham 2004-08-05 21:07:37 UTC
*** Bug 125962 has been marked as a duplicate of this bug. ***

Comment 15 Steve Dickson 2004-08-12 18:22:48 UTC
reassing to Jakub the glibc maintainer

Comment 16 Ulrich Drepper 2004-09-28 05:54:01 UTC
This is no glibc issue.  Lacking a better idea, I'll assign it to
initscripts since a solution à la portreserve would be part of
initscripts.  Changing bindresvport() is no option since there are no
universally available ports (look at the IANA list).  So an extern
solution like portreserve is needed.  I think it can work nicely and
should not be hard the integrate.

Comment 21 Bruce Friedman 2005-02-04 16:34:14 UTC
I am seeing a similar issue now on Fedora Core 3 where rpc.mountd grabs port 783
before spamassassin has a chance to grab it.

Need to move nfs init sequence from 60 to 81 to place it after spamassassin to
clear the problem.

Should the port be reserved, or is rearrangement of init order more appropriate?

Comment 26 Steve Bonneville 2005-03-15 14:47:32 UTC
As an update, and not that it should be a surprise since nothing has been
changed, but we are seeing the exact issue I originally reported (on Red Hat
Linux 9, as I recall) on Red Hat Enterprise Linux 4 as well.

Comment 30 Paul Raines 2005-07-16 21:25:39 UTC
Just want to add that I have seen this on several RHEL4 clients too.
Also, having ypbind start AFTER other services is not an option as
ypbind is needed to see all accounts and many services need to
see those accounts when starting (e.g.imapd for port 993)

Comment 31 Jeff Minelli 2005-07-29 01:12:58 UTC
Is this ever going to be fixed? This is a wide spread problem that will affect almost everyone at some 
point....

Comment 32 Jeff Minelli 2005-07-29 01:13:49 UTC
Is this ever going to be fixed? This is a wide spread problem that will affect almost everyone at some 
point....

Comment 33 John Dennis 2005-07-29 18:03:48 UTC
*** Bug 154800 has been marked as a duplicate of this bug. ***

Comment 34 Ralf Corsepius 2005-09-15 19:09:52 UTC
I would propose to make this issue a release blocker for FC5.

Comment 35 Bill Nottingham 2005-09-21 21:33:54 UTC
This problem is being considered for a future major release of Red Hat
Enterprise Linux. Red Hat does not currently plan to provide a resolution for
this in a Red Hat Enterprise Linux update for currently deployed systems.

With the goal of minimizing risk of change for deployed systems, and in response
to customer and partner requirements, Red Hat takes a conservative approach when
evaluating changes for inclusion in maintenance updates for currently deployed
products. The primary objectives of update releases are to enable new hardware
platform support and to resolve critical defects. 



Comment 36 Bill Nottingham 2005-09-29 19:07:54 UTC
*** Bug 51904 has been marked as a duplicate of this bug. ***

Comment 37 Jeremy Sanders 2005-10-17 13:02:42 UTC
I reported this some time ago in
http://sources.redhat.com/bugzilla/show_bug.cgi?id=1014 

glibc seems the obvious place to fix this problem.

Comment 38 Jakub Jelinek 2005-10-17 13:06:08 UTC
And you were also told there it is a bad idea and glibc is not going to change
in this regard.

Comment 39 Jeremy Sanders 2005-10-17 13:16:53 UTC
This will be my only comment to prevent bugspam, but it says nowhere in the bug
that this is a bad idea, or why it is a bad idea. Please can someone elaborate
on this? All these issues are caused by a single point of failure - glibc. It
seems the obvious place to solve the issue. It seems pretty hairbrained to have
a special daemon to handle this. All the apps, and any 3rd party ones too, need
to be rewritten to use the daemon. Why couldn't there be a configuration file
stating the ports for bindresvport() to avoid?

Comment 41 Mike Jang 2006-01-12 20:45:11 UTC
(In reply to comment #34)
> I would propose to make this issue a release blocker for FC5.

FYI, I see this problem in FC5 test 1, as reported in 154800 (which was closed
as a duplicate of this bug).

Comment 42 Orion Poplawski 2006-04-24 22:17:40 UTC
Perhaps we can reopen this and actually work on a fix? Target FC6?

Comment 43 Tim Waugh 2006-05-16 15:50:49 UTC
*** Bug 191950 has been marked as a duplicate of this bug. ***

Comment 44 Tim Waugh 2006-05-16 15:51:32 UTC
*** Bug 189144 has been marked as a duplicate of this bug. ***

Comment 45 chris 2006-12-10 15:30:29 UTC
*** Bug 218216 has been marked as a duplicate of this bug. ***

Comment 46 Jan Engelhardt 2007-05-30 08:12:53 UTC
Also see https://bugzilla.novell.com/show_bug.cgi?id=262341

Comment 47 Bill Nottingham 2007-10-04 15:36:39 UTC
*** Bug 318461 has been marked as a duplicate of this bug. ***

Comment 48 Orion Poplawski 2007-10-29 22:19:14 UTC
Seems like leaving this in "Closed Deferred" means it will never get worked on.
   Is there ever a hope of a fix?

Comment 49 Stephen John Smoogen 2007-10-30 00:19:35 UTC
Any bug in RHEL-3 is dead as far as I can tell unless it is a security problem.

Comment 50 Matthew Galgoci 2007-10-30 00:33:32 UTC
This bug is still present in RHEL4U5 as I had a system hit this just a few weeks
ago. It may well be present in rhel5 also, though I haven't verified.

Comment 51 Steve Bonneville 2007-10-30 01:09:32 UTC
It is present in 5 and 5.1; at least some of the bugs marked as duplicates above
reflect that.  #218216 is the same bug in Fedora Core 6 filed against spamd in
spamassassin (port 783), for example, which is effectively RHEL 5 for this purpose.



Comment 53 Orion Poplawski 2007-10-30 02:24:56 UTC
Also present in Fedora 7, which is what got me digging this old thing up again.
 Now the service is "rpcbind" which acquires the ports.

Comment 54 Jeremy Sanders 2007-10-30 09:02:21 UTC
I still haven't seen any technical reasons why it portmap couldn't check in a
special directory for files containing reserved ports and not use these. See
comment #5. These files could be installed by RPM.


Comment 66 Boris Vinarsky 2008-03-11 00:15:36 UTC
On RHEL-4 we had practically the same problem. The program that listened on the 
port TCP 631 was rpc.statd. As a result cups died on startup with the message:
startListening: Unable to bind socket for address 7f000001:631 - Address 
already in use.
While Red Hat decides what is the best way to fix this permanently can Red Hat 
offer a workaround?

Comment 67 Jay Rishel 2008-05-12 15:13:58 UTC
I just got hit with this on rhel4, rpc.statd took port 631, preventing cups from
starting.   

Comment 68 Kazutoshi Morioka 2008-10-04 02:46:09 UTC
I got same problem on Fedora 9. krb5kdc port 750. Please fix this.

Comment 69 Kazutoshi Morioka 2008-10-04 02:49:21 UTC
I got same problem on Fedora 9. krb5kdc port 750. Please fix this.

Comment 72 Tim Waugh 2008-10-14 15:46:13 UTC
The workaround is: use portreserve (see comment #5).

This is already included in Fedora 10, and CUPS in Fedora 10 makes use of it in its initscript.

spamassassin has been mentioned as another service that could make use of portreserve.  Changing component and reassigning.

Comment 73 Stephen John Smoogen 2008-10-14 16:02:44 UTC
Can portreserve work with RHEL-4/5? If it can, I would be happy to get it into EPEL as a help.

Comment 74 Tim Waugh 2008-10-14 16:24:05 UTC
Yes, I don't see any reason it wouldn't work.  However, services that want to use it need to modify their initscript (to call 'portrelease').

Packaging it for EPEL might help for third-party applications though, and other EPEL packages.

Comment 75 Jeremy Sanders 2008-10-14 16:31:48 UTC
Can someone enlighten me how portreserve is not a race condition waiting to happen? As far as I can tell, you get portreserve to release the port before starting the service. How do you make sure nothing else gets in there first before the portreserve command and the service-starting command? I suspect it's unlikely that something could slip in between these commands, but is this good programming?

Comment 76 Tim Waugh 2008-10-14 16:47:13 UTC
(In reply to comment #75)
> Can someone enlighten me how portreserve is not a race condition waiting to
> happen? As far as I can tell, you get portreserve to release the port before
> starting the service. How do you make sure nothing else gets in there first
> before the portreserve command and the service-starting command? I suspect it's
> unlikely that something could slip in between these commands, but is this good
> programming?

Without support in glibc/portmap there is no generic way around this.

Comment 77 Jay Rishel 2009-01-21 15:15:10 UTC
have any of the portreserve changes in Fedora 10 made it into the RHEL5.3 release? or would this wait until RHEL6?

Comment 78 Tim Waugh 2009-01-21 15:22:41 UTC
It's not in RHEL-5.3.

Comment 79 Chris Schanzle 2009-06-26 16:20:13 UTC
Confirming 5.3 has issues.  After updating and rebooting 105 clients with a recent kernel patch + others, one had this issue logged in /var/log/cups/error_log:

E [25/Jun/2009:21:11:11 -0400] Unable to bind broadcast socket - Address already in use.

Cups didn't get broadcasted print queues until after restarting cups.

The curious thing is that I hard-bind rpc services; status, nlockmgr, ypbind are listing on *my* chosen ports, non of the conflicting with cups's 631.

We've also had past (but none this time) random issues with rsyncd not being able to bind to its listening port, I'm extrapolating the root cause is the same.

Comment 80 Warren Togami 2009-12-03 05:10:52 UTC
I'm adding the portreserve hack to spamassassin-3.3.0 for RHEL-6.  But this is not a complete solution.  Arbitrary other services can still cause this failure.

Comment 81 Tim Waugh 2009-12-03 09:30:54 UTC
Warren: how so?

The only way I know of that it can fail is after the protected service is stopped.  There's no way to close that hold without kernel support.

Comment 86 Mark Hittinger 2010-02-25 17:46:45 UTC
Some ethernet NICs (broadcom, intel gigabit) have something called
ASF enabled.  This causes the NIC to gobble stuff sent to port 623
and port 664!  So there are some other ports that we need to exclude.

RPC mounts avoid these ports by using sunrpc.min_resvport which is
set to 665 these days.  So the code for mounts won't use ports below
665.

Maybe bindrsvprt.c could be modified to also use sunrpc.min_resvport
and sunrpc.max_resvport.

In the 623/664 cases there is no collision with another daemon.  The
affected NICs lose the packets.

ypmatch and ypcat will hang with do_ypcall: clnt_call: RPC: Timed out
when they pick 623 or 664 on the affected hardware.

sshd (particularly when AllowGroups is used) will also hang on the 
affected hardware when it selects 623 or 664 to do an NIS lookup.

A kludge is to use xinetd to grab the 623/664 ports for a workaround.

Comment 88 Colin.Simpson 2010-07-21 11:00:34 UTC
Just been hit with this again:

# netstat -anp | grep 631
tcp        0      0 0.0.0.0:631                 0.0.0.0:*                   LISTEN      25591/cupsd         
udp        0      0 0.0.0.0:631                 0.0.0.0:*                               24623/rpc.statd     

Whilst portreserve looks like a fix, from my understanding is it not a bit of a hack around this.  Shouldn't portmaper not just be given a list of ports to never use from a file that gets appended to as services are added from packages? Or am I missing something?

Comment 89 Tim Waugh 2010-07-21 14:20:08 UTC
See comment #16.

Comment 90 Colin.Simpson 2010-07-21 14:52:43 UTC
comment #16 doesn't answer why we need portreserve, it just says that there are no free unallocated low ports in the official allocation list. That's true, but shouldn't portmapper have a notion of services THIS system has or needs reserved low and not allocate them. 

Or is there just no easy way of allocating a low port in a system call that can exclude ports we want to hold back? Sounds like a new call is called for eventually?

Comment 91 releng-rhel@redhat.com 2010-11-11 14:59:17 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.

Comment 95 RHEL Program Management 2011-07-06 00:03:48 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.

Comment 102 Chris Schanzle 2011-12-08 15:44:58 UTC
(In reply to comment #91)
> Red Hat Enterprise Linux 6.0 is now available and should resolve
> the problem described in this bug report.

It won't since there is no portrelease support in the 6.x ypbind scripts.

Comment 103 Orion Poplawski 2011-12-08 15:48:17 UTC
It's not ypbind that needs to use portreserve/release, it's everything else that uses ports in the rpc port range.

Comment 104 Jeremy Sanders 2011-12-08 15:58:28 UTC
Dovecot is missing support portreserve/release (at least in Scientific Linux 6.1).

Comment 105 Chris Schanzle 2011-12-08 17:57:51 UTC
(In reply to comment #103)
> It's not ypbind that needs to use portreserve/release, it's everything else
> that uses ports in the rpc port range.

What I discovered via portreserve(1) and testing is that when portreserve starts, it listens on all the reserved ports that have been configured.  Just before the real daemon starts, it needs to run portrelease so the *real* daemon can listen on it.  Look at:

grep portrelease /etc/init.d/*
cat /etc/portreserve/cups

In the case of ypbind, which can listen either on a random port (unfixable) or a fixed port (via setting OTHER_YPBIND_OPTS).  I hard-code to port 900 by setting 

/etc/sysconfig/network:OTHER_YPBIND_OPTS="-p 900"

To fix ypbind, I see two potential ways - (1) it's init script needs to parse out the -p parameter and if you get something, call portrelease on that port.  Something like:

ypport=`echo $OTHER_YPBIND_OPTS | sed 's/.*-p[[:space:]]*\(\<.*\>\).*/\1/'`
[ -n "$ypport" -a -x /sbin/portrelease ] && /sbin/portrelease $ypport &>/dev/null || :

Or (2), since the user needs to reserve a port by dropping a file into /etc/portreserve/ anyway, force them to use the service named 'ypbind' and just portrelease that:
[ -x /sbin/portrelease ] && /sbin/portrelease ypbind &>/dev/null || :

Hopefully I'll get time to test this today.

Should I open a new bug on RHEL6 for this issue?  I searched and could not find one...

Comment 110 Karel Srot 2012-01-31 11:34:18 UTC
I have changed the component to "distribution". Please file a new bug for each affected component and use this one as a tracker.

rsync bug filed as Bug 786076.

Comment 120 Dan Yocum 2012-05-03 19:33:21 UTC
This bug exists in RHELv5.x, too.  I noticed it when trying to use heartbeat (port 694).  

Can we get portreserve backported to RHELv5.x?

Comment 121 Ondrej Vasik 2012-06-27 08:49:16 UTC
Just having portreserve in RHEL-5.X will not solve the issue, you need to update all the packages which already use it in RHEL-6 to achieve same results. And this is IMHO very unlikely.

Comment 122 Dan Yocum 2012-06-27 17:00:38 UTC
I wasn't suggesting updating all the RHEL5 packages that would need portreserve, but having the package itself as part of the distro (instead of having to go to some third party repo, which is what I ended up doing) would go a long way to allow a sysadmin solve the problem, IMO.  

Even if it made it into EPEL for RHEL5 I think I'd be happy...

Comment 125 Harold Miller 2012-10-23 20:44:00 UTC
I attached this bug to case 00721174, as the new RHS product can (and will) assign a port for every storage brick. In huge systems we have seen this consume all available ports under 1024.

Comment 128 Ted Rule 2014-04-27 12:48:49 UTC
Having just been caught out by this bug in CentOS6 with heartbeat, ( UDP Port 694 ), and looking at the AFS /IPMI Port 623/664 bug mentioned in previous comments, it doesn't seem unreasonable to me to make portmap/rpcbind honour sunrpc.min_resvport/sunrpc.max_resvport as per comment 86.

I presume rpc.mountd honours these proc settings, and the original setting of 600 minimum was modified specifically so as to avoid IPMI hardware clashes. If that's the case, then it would seem rpcbind is STILL vulnerable to a potential clash with IPMI hardware as long as a suitably configured portreserve is not running, even if no actual "real" daemons use those ports. Since there's willingness to avoid NFS mounts clashing, why not "protect" rpcbind with the same tweak?

If this were done, then sysadmins who only have a few clashing services in the 6xx range, but only a modicum of simultaneous RPC services/ports, could avoid the whole mess by simply raising sunrpc.min_resvport to 700, for instance.

In more complex cases, I admit that it might well be necessary to employ portreserve, but the /proc setting might well be sufficient in many cases.

Comment 129 Lars Hecking 2015-02-04 16:01:08 UTC
I would just like to add that I have this problem on CentOS6 with ypserv *every* time I reboot a particular server - 6.0 through 6.6. And occasionally on CentOS 5.11 with ypbind/cups.

Comment 130 Greg Ercolano 2015-03-16 22:42:07 UTC
I haven't seen this solution mentioned in this thread:
/proc/sys/net/ipv4/ip_local_reserved_ports

Supposedly port numbers added to this file will be skipped over by the
glibc functions that auto-assign reserved ports as used by tools like
nfs/nis/etc. 

Some interesting details here:
http://www.mjmwired.net/kernel/Documentation/networking/ip-sysctl.txt#716
https://lkml.org/lkml/2012/3/10/187

Comment 132 Aaron Reichow 2016-03-08 19:54:37 UTC
Any chance we'll see a fix? Having this issue on RHEL 6.7 with rpc.statd. No port collisions, but in our environment we are required to have specific ports/port ranges defined for a particular service. There doesn't seem to be anyway to force rpc.statd to use a particular port rather than follow the pid % 424 + 600 formula.

Comment 137 RobbieTheK 2018-07-24 15:57:08 UTC
Seeing this with Dovecot on Fedora 28:
Jul 24 11:12:24 ourdomain dovecot[1838]: Error: service(imap-login): listen(::, 993) failed: Address already in use
Jul 24 11:12:24 ourdomain dovecot[1838]: master: Error: service(pop3-login): listen(*, 995) failed: Address already in use
Jul 24 11:12:24 ourdomain dovecot[1838]: master: Error: service(pop3-login): listen(::, 995) failed: Address already in use
Jul 24 11:12:24 ourdomain dovecot[1838]: Fatal: Failed to start listeners
Jul 24 11:12:24 ourdomain dovecot[1838]: master: Error: service(imap-login): listen(*, 993) failed: Address already in use
Jul 24 11:12:24 ourdomain dovecot[1838]: master: Error: service(imap-login): listen(::, 993) failed: Address already in use
Jul 24 11:12:24 ourdomain dovecot[1838]: master: Fatal: Failed to start listeners
Jul 24 11:12:24 ourdomain systemd[1]: dovecot.service: Control process exited, code=exited status=89
Jul 24 11:12:24 ourdomain systemd[1]: dovecot.service: Failed with result 'exit-code'.
Jul 24 11:12:24 ourdomain systemd[1]: Failed to start Dovecot IMAP/POP3 email server.

netstat -lnp | grep 993
unix  2      [ ACC ]     STREAM     LISTENING     39993    1075/httpd           /run/httpd/cgisock.972

Comment 138 Florian Weimer 2018-07-24 15:59:42 UTC
(In reply to RobbieTheK from comment #137)
> Seeing this with Dovecot on Fedora 28:
> Jul 24 11:12:24 ourdomain dovecot[1838]: Error: service(imap-login):
> listen(::, 993) failed: Address already in use

> netstat -lnp | grep 993
> unix  2      [ ACC ]     STREAM     LISTENING     39993    1075/httpd       
> /run/httpd/cgisock.972

That is something else, the grep doesn't show a TCP socket on port 993.

Comment 139 RobbieTheK 2018-11-08 16:40:11 UTC
This is still happening after a reboot, Fedora 28, 

Nov  8 12:21:41 kopernik dovecot[1386]: Error: service(pop3-login): listen(*, 995) failed: Address already in use
Nov  8 12:21:41 kopernik dovecot[1386]: Error: service(pop3-login): listen(::, 995) failed: Address already in use
Nov  8 12:21:41 kopernik dovecot[1386]: Error: service(imap-login): listen(*, 993) failed: Address already in use
Nov  8 12:21:41 kopernik dovecot[1386]: Error: service(imap-login): listen(::, 993) failed: Address already in use

After restarting dovecot it works:
netstat -lnp | grep 993
tcp        0      0 0.0.0.0:993             0.0.0.0:*               LISTEN      4622/dovecot
tcp6       0      0 :::993                  :::*                    LISTEN      4622/dovecot

Comment 141 Florian Weimer 2020-07-06 14:37:26 UTC
We are tracking this upstream. It is unclear whether bindresvport will remain as a public API in glibc. So far, it has not been subject to the Sun RPC transition in glibc, although libtirpc implements the symbol as well. It may therefore be possible to turn the glibc symbol in to a compat symbol, effectively removing it from the glibc API. In this case, it is unlikely that upstream will implement a denylist, similar to what is available in libtirpc today.

Applications built on Red Hat Enterprise Linux 8 can already use the libtirpc denylist functionality for bindresvport by linking against libtirpc.

Comment 142 Florian Weimer 2020-07-06 14:49:26 UTC
I filed bug 1854147 against libtirpc with the denylist additions suggested in comment 0.


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