Bug 1022496

Summary: Exceeding an arbitrary limit on number of SOL IPMI consoles causes conmand to crash on start
Product: Red Hat Enterprise Linux 6 Reporter: Miroslav Hradílek <mhradile>
Component: conmanAssignee: Ondrej Vasik <ovasik>
Status: CLOSED ERRATA QA Contact: Miroslav Hradílek <mhradile>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: dvlasenk, jkurik, mhradile, phracek, pm-rhel, rvokal, snagar, tgummels, tlavigne
Target Milestone: rc   
Target Release: 6.8   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: conman-0.2.7-3.el6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1244189 (view as bug list) Environment:
Last Closed: 2017-03-21 11:35:08 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: 1172231, 1269194, 1318711, 1356036, 1359264, 1400664, 1405173    
Attachments:
Description Flags
The patch which fixes this none

Description Miroslav Hradílek 2013-10-23 12:19:43 UTC
Clone of the upstream issue https://code.google.com/p/conman/issues/detail?id=15


> Reported by markkawi..., Nov 27, 2012
> 
> What steps will reproduce the problem?
> 
> Create a conman.conf file with 4,096 or more "console" entries, all using IPMI SOL, and try to run conmand. It will crash.
> 
> What is the expected output? What do you see instead?
> 
> 
> What version of the software are you using? On what operating system?
> 
> ConMan 0.2.7, CentOS 5.5 (kernel 2.6.18)
> 
> Please provide any additional information below.
> 
> The relevant defines:
> 
> #define IPMI_ENGINE_CONSOLES_PER_THREAD 128
> #define IPMICONSOLE_THREAD_COUNT_MAX 32
> 
> When there are 4,096 or more consoles using IPMI SOL, the following line is run:
> 
> num_threads = ((num_consoles - 1) / IPMI_ENGINE_CONSOLES_PER_THREAD) + 1;
> 
> (this is on line 96 of the file server-ipmi.c. The math works out to: ((4096 - 1) / 128) + 1. That goes to 33 when num_consoles is >= 4096. But 33 is greater than IPMICONSOLE_THREAD_COUNT_MAX, and libipmiconsole refuses to initialize the engine.
> 
> The workaround is to make sure that num_threads never exceeds IPMICONSOLE_THREAD_COUNT_MAX:
> 
> Mark-Pettits-Twitter-Laptop:~/conman/conman$ git diff
> diff --git a/server-ipmi.c b/server-ipmi.c
> index ba2ec65..2b7775a 100644
> --- a/server-ipmi.c
> +++ b/server-ipmi.c
> @@ -93,6 +93,7 @@ void ipmi_init(int num_consoles)
> return;
> }
> num_threads = ((num_consoles - 1) / IPMI_ENGINE_CONSOLES_PER_THREAD) + 1;
> +    num_threads = MIN(num_threads, IPMICONSOLE_THREAD_COUNT_MAX);
> 
> if (ipmiconsole_engine_init(num_threads, 0) < 0) {
> log_err(0, "Unable to start IPMI SOL engine");

Comment 3 Denys Vlasenko 2013-10-23 12:55:02 UTC
From devel side, it is trivially easy to do this.

Comment 16 Denys Vlasenko 2014-10-20 16:36:06 UTC
I have a working patch for this, but can't commit it:

$ rhpkg commit --clog -p
...
remote: *** Resolves:
remote: ***   Unapproved:
remote: ***     rhbz#1022496 (pm_ack+, rhel-6.5.0-, rhel-6.6.0+, rhel-6.5.z?)
remote: *** No approved Bugzilla IDs referenced in log message or changelog for ecb7e7702661689c7bbbaa38c69067de80772299
remote: *** Unapproved Bugzilla IDs referenced in log message or changelog for ecb7e7702661689c7bbbaa38c69067de80772299
remote: *** Commit ecb7e7702661689c7bbbaa38c69067de80772299 denied
remote: *** Current checkin policy requires:
remote:     (rhel-6.6.z == + or (rhel-6.6.0 == + and blocker == +))

Please set required flags (blocker+, or rhel-6.7.0+), and I will commit the change.

Comment 25 Denys Vlasenko 2016-02-01 17:18:34 UTC
Created attachment 1120192 [details]
The patch which fixes this

Comment 32 errata-xmlrpc 2017-03-21 11:35:08 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://rhn.redhat.com/errata/RHBA-2017-0761.html