Bug 1368728

Summary: Keepalive don't assign virtual ip and report libc2.7 error on messages
Product: Red Hat Enterprise Linux 7 Reporter: Christian Marangoni <christian.marangoni>
Component: keepalivedAssignee: Ryan O'Hara <rohara>
Status: CLOSED ERRATA QA Contact: Brandon Perkins <bperkins>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.1CC: cluster-maint, ralloway
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: keepalived-1.3.5-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 19:36:38 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:
Attachments:
Description Flags
Proposed patch for keepalived-1.2.13-7 none

Description Christian Marangoni 2016-08-20 18:27:45 UTC
Description of problem:

When you setup keepalived on rh  7.1 and don't enter smtp server on global_def, keepalived dosen't work and continue to loop  and report some libc 2.7 error ad the assign of the ip already setup on network device not the "virtual" on  /var/log/messages


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

Red Hat enterprise Linux 7.1

keepalived-1.2.13-6.el7.x86_64
or
keepalived-1.2.13-7.el7.x86_64


How reproducible:

Install and configure keepalived without insert a value for smtp_server 


Actual results:
Don't work with smtp_server value

Expected results:

work with smtp_server value

Additional info:

errorlog /var/log/messages

 DPI208 kernel: keepalived[12486]: segfault at 7f0a00726570 ip 00007f0a2fd0fe84 sp 00007fff0739b0c8 error 4 in libc-2.17.so[7f0a2fbde000+1b6000]
 DPI208 kernel: keepalived[12487]: segfault at 7f0a00726570 ip 00007f0a2fd0fe84 sp 00007fff0739b0c8 error 4 in libc-2.17.so[7f0a2fbde000+1b6000]
 DPI208 Keepalived_healthcheckers[12488]: Netlink reflector reports IP 10.100.2.208 added
 DPI208 Keepalived_healthcheckers[12488]: Registering Kernel netlink reflector
 DPI208 Keepalived_healthcheckers[12488]: Registering Kernel netlink command channel
 DPI208 Keepalived_healthcheckers[12488]: Opening file '/etc/keepalived/keepalived.conf'.
 DPI208 Keepalived[2490]: Healthcheck child process(12488) died: Respawning
 Keepalived[2490]: Starting Healthcheck child process, pid=12489
 kernel: keepalived[12488]: segfault at 7f0a00726570 ip 00007f0a2fd0fe84 sp 00007fff0739b0c8 error 4 in libc-2.17.so[7f0a2fbde000+1b6000]

Comment 2 Richard D Alloway 2016-10-20 17:47:19 UTC
I was able to replicate the issue and have resolved it with a patch that I will attach momentarily.

The issue was that having a configuration item without a value assigned creates a vector, but the token in slot 1 is not initialized/populated and therefore points to NULL.

The existing vector_ensure() function performs a check and, if the token isn't initialized, it is created and set to NULL. 

So, I call vector_ensure() and then verify that vector_slot() return a non-NULL value before using vector_slot().

In addition to resolving this issue with smtp_server, I found that the same problem is present with notification_email_from and smtp_connect_timeout, so the patch addresses these two, also.

-Rich Alloway (RogueWave)

Comment 3 Richard D Alloway 2016-10-20 17:48:45 UTC
Created attachment 1212600 [details]
Proposed patch for keepalived-1.2.13-7

Comment 4 Ryan O'Hara 2016-10-20 19:32:56 UTC
(In reply to Richard D Alloway from comment #3)
> Created attachment 1212600 [details]
> Proposed patch for keepalived-1.2.13-7

(In reply to Richard D Alloway from comment #2)
> I was able to replicate the issue and have resolved it with a patch that I
> will attach momentarily.
> 
> The issue was that having a configuration item without a value assigned
> creates a vector, but the token in slot 1 is not initialized/populated and
> therefore points to NULL.
> 
> The existing vector_ensure() function performs a check and, if the token
> isn't initialized, it is created and set to NULL. 
> 
> So, I call vector_ensure() and then verify that vector_slot() return a
> non-NULL value before using vector_slot().
> 
> In addition to resolving this issue with smtp_server, I found that the same
> problem is present with notification_email_from and smtp_connect_timeout, so
> the patch addresses these two, also.
> 
> -Rich Alloway (RogueWave)

The problem exists for any config file keyword that expects a value where none is set. The parser does not detect this as it should. I've discussed this with upstream and I believe we have a simple patch that will address this problem, such that an error will be printed and keepalived will exit. That said, I will take a look at this patch.

Comment 5 Ryan O'Hara 2016-10-20 19:33:24 UTC
(In reply to Richard D Alloway from comment #3)
> Created attachment 1212600 [details]
> Proposed patch for keepalived-1.2.13-7

This is only a diff of the spec file.

Comment 6 Richard D Alloway 2016-10-20 19:55:34 UTC
Hi Ryan!

There is a new file created as SOURCES/bz1368728-keepalived-config-segfault.patch towards the top of the patch file.

The spec file diff is below the patch.

Let me know if you can't see it and I'll upload the file again.

Thanks!

-Rich

Comment 7 Ryan O'Hara 2016-10-20 22:06:38 UTC
(In reply to Richard D Alloway from comment #6)
> Hi Ryan!
> 
> There is a new file created as
> SOURCES/bz1368728-keepalived-config-segfault.patch towards the top of the
> patch file.
> 
> The spec file diff is below the patch.
> 
> Let me know if you can't see it and I'll upload the file again.
> 
> Thanks!
> 
> -Rich

OK. I see it now. For some reason if I click the diff link in the above comment I only see the spec file diff. The patch looks fine, but I would much prefer we fix the bigger issue with all keyword/value pairs. Between upstream and myself, if that doesn't happen soon I will use this patch as a temporary fix in RHEL. Thanks.

Comment 8 Ryan O'Hara 2017-03-27 17:22:23 UTC
I tested this today and it is fixed in keepalived-1.3.5, which will released with RHEL7.4.

In the "global_defs" section of /etc/keepalived/keepalived.conf, simple add "smtp_server" without specifying the required name/address. Start keepalived, there will be no segfault. Instead, keepalived shoud fail to start and the following messages should appear in the logs:

*** Configuration line starting `smtp_server` is missing a parameter after keyword `smtp_server` at word position 2

Comment 11 errata-xmlrpc 2017-08-01 19:36:38 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-2017:2169