View Issue Details

IDProjectCategoryView StatusLast Update
0017619CentOS-7dhcppublic2020-07-24 12:50
Reportershader 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version7.8-2003 
Target VersionFixed in Version 
Summary0017619: dhclient runs out of all available addresses in the pool in case of abnormal script termination
Description---- Copied from https://gitlab.isc.org/isc-projects/dhcp/-/issues/123
= Preface =

Some Linux distribution, eg. CentOS Linux 7.x or 8.x, use NetworkManager to configure network interfaces. The dhclient command started by NetworkManager looks like this:
/sbin/dhclient -d -q -sf /usr/libexec/nm-dhcp-helper \
    -pf /run/NetworkManager/dhclient-<iface_name>.pid \
    -lf /var/lib/NetworkManager/dhclient-<connection_uuid>-<iface_name>.lease \
    -cf /var/lib/NetworkManager/dhclient-<iface_name>.conf <iface_name>
When dhclient receive answer from server on lease renewal it use script or binary specified by -sf option for IP validity checking.
/* If the BOUND/RENEW code detects another machine using the
   offered address, it exits nonzero. We need to send a
   DHCPDECLINE and toss the lease. */
if (script_go(client)) {
    make_decline(client, client->new);
    send_decline(client);
    destroy_client_lease(client->new);
But the script_go function return non-zero result in the 2 cases:

Launched process exit status is non-zero. In this case script_go function return value > 0.
Launched process terminated by signal, eg. SIGTEM. In this case script_go function return value < 0.

= Problem description =
Let's imagine the next situation. nm-dhcp-helper or other script or binary specified by -sf option starting at some time will always terminates by SIGSEGV due to filesystem damage or some dynamic library incompatibility. In this case the dhclient will send DECLINE and retry lease renewal after 10 seconds timeout. This will repeat infinitely until all available addresses in the DHCP pool will be marked as invalid and other clients will not be able to lease an IP address.

= Solution =
To eliminate the possibility of a repetition of such a situation, it is enough in the above code fragment to replace a line
if (script_go(client)) {
by
if (script_go(client) > 0) {
Steps To Reproduce1. Create simple C-program that will always cause SIGSEGV:
--- example.c ---
int main ()
{
    char *p;
    memset(p, 0, 1000000);
}
--- cut here ---

2. Compile example with following command:
gcc -o nm-dhcp-helper example.c

3. Replace original /usr/libexec/nm-dhcp-helper by compiled example.

4. Wait for dhclient renew lease
TagsNo tags attached.
abrt_hash
URLhttps://gitlab.isc.org/isc-projects/dhcp/-/issues/123

Activities

ManuelWolfshant

ManuelWolfshant

2020-07-24 12:29

manager   ~0037412

Given that CentOS is a rebuild of the sources used to create RHEL and aims to reproduce RHEL bug for bug and feature for feature, we cannot implement the change you suggest. Please submit it to Redhat via bugzilla.redhat.com and if/when RH accepts it and incorporates it into RHEL and releases a patched version, CentOS will pick it up automatically.
For easier tracking, please crosslink this bug with the one opened at bugzilla.redhat.com.
shader

shader

2020-07-24 12:50

reporter   ~0037413

https://bugzilla.redhat.com/show_bug.cgi?id=1860391

Issue History

Date Modified Username Field Change
2020-07-24 11:28 shader New Issue
2020-07-24 12:29 ManuelWolfshant Note Added: 0037412
2020-07-24 12:50 shader Note Added: 0037413