Bug 667810

Summary: "modprobe ip_conntrack hashsize=NNNN" panics kernel if /etc/modprobe.conf has hashsize=MMMM
Product: Red Hat Enterprise Linux 5 Reporter: John Hawkes <jhawkes>
Component: kernelAssignee: Neil Horman <nhorman>
Status: CLOSED ERRATA QA Contact: Boris Ranto <branto>
Severity: high Docs Contact:
Priority: low    
Version: 5.5CC: branto, nhorman, qcai, tgraf
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-07-21 10:27:46 UTC Type: ---
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
patch to preent null derefeneces in set_hashsize module option parsing none

Description John Hawkes 2011-01-06 20:37:35 UTC
Description of problem:

Kernel panic when doing
    modprobe ip_conntrack hashsize=32768
when /etc/modprobe.conf already contains a different (lower?) value:
    options ip_conntrack hashsize=16384


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

    kernel-2.6.18-194.32.1.el5


How reproducible:

    Every time.


Steps to Reproduce:

/etc/modprobe.conf contains an option for ip_conntrack:
    options ip_conntrack hashsize=16384

Boot the kernel (2.6.9-194.32.1.el5) and have various options turned off so that the ip_conntrack kernel module is not loaded.  Confirm this with:
    grep ip_conntrack /proc/modules
and don't see ip_conntrack.

Also confirm that /etc/modules.conf is set up:
    modprobe -nv ip_conntrack
should show you the "hashsize=16384".

Then attempt to manually load the ip_conntrack module specifying a different hashsize than is specified in /etc/modprobe.conf:
    modprobe ip_conntrack hashsize=32768

Panic!

I haven't been able to capture the printk output, but a summary of the stack dump on the console:
    alternatives_smp_module_add + 0xf2
    parse_args + 0x113
    load_module + 0x15fc

With a RHEL4 kernel (2.6.9-89.33.1.EL), the manual
    modprobe ip_conntrack hashsize=32768
ignores the attempt to override hashsize, and ip_conntrack only sees the value in /etc/modprobe.conf.

With both RHEL4 and RHEL5 kernels, if /etc/modprobe.conf contains no mention of ip_conntrack, then the manual modprobe uses the specified hashsize= arg value.

Comment 1 Neil Horman 2011-01-18 16:57:21 UTC
I've managed to reproduce this.  I have a feeling this is a stack overrun.  I'll do some digging and post results soon

Comment 2 Neil Horman 2011-01-18 21:09:47 UTC
Found the problem.  Turns out the set method for the hashtable size in the conntrack modules has some broken logic in it, and on the second set we try to deference the ip_conntrack_hash array before we've allocated it.  I'll have a patch together shortly

Comment 3 Neil Horman 2011-01-19 21:06:51 UTC
Created attachment 474359 [details]
patch to preent null derefeneces in set_hashsize module option parsing

Here, this patch fixes it.  Looks like a variant needs to go upstream as well.  I'll look into that shortly, and post this asap.

Comment 4 RHEL Program Management 2011-02-04 20:30:49 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 6 Jarod Wilson 2011-02-09 14:57:44 UTC
in kernel-2.6.18-243.el5
You can download this test kernel (or newer) from http://people.redhat.com/jwilson/el5

Detailed testing feedback is always welcomed.

Comment 10 errata-xmlrpc 2011-07-21 10:27:46 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-1065.html