Bug 156142 - kernel may oops if more than 4k worth of string data returned in /proc/devices
kernel may oops if more than 4k worth of string data returned in /proc/devices
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: kernel (Show other bugs)
3.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Neil Horman
Brian Brock
:
Depends On:
Blocks: 156320
  Show dependency treegraph
 
Reported: 2005-04-27 16:44 EDT by Chris Williams
Modified: 2007-11-30 17:07 EST (History)
6 users (show)

See Also:
Fixed In Version: RHSA-2005-663
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-09-28 11:00:19 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
rhkl patch accepted to fix this problem (2.03 KB, patch)
2005-05-17 07:11 EDT, Neil Horman
no flags Details | Diff
rhkl patch accepted to fix this problem (2.03 KB, patch)
2005-05-17 07:11 EDT, Neil Horman
no flags Details | Diff

  None (edit)
Description Chris Williams 2005-04-27 16:44:43 EDT
+++ This bug was initially created as a clone of Bug #156029 +++

Description of problem:
the read routine for /proc/devices is missing a length check routine. 
Consequently, if the number of block and char devices in a system totals more
than 4096 bytes of string data between their names and major/minor numbers, the
read routine will sprintf the data off the end of the page and oops the kernel.
other proc files that are part of proc_misc.c protect against this with a length
check that truncates the file if it goes over a page, but this check is missing
from get_device_list and get_blkdev_list.

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

How reproducible:
always

Steps to Reproduce:
1. register sufficient char/block devices in a system to create > 4096 bytes of
string data for /proc/devices
2. cat /proc/devices
3.
  
Actual results:
system will oops on a page fault

Expected results:
system should truncate file to 4096 bytes.

Additional info:
Comment 3 Ernie Petrides 2005-05-04 20:40:36 EDT
A fix for this problem has just been committed to the RHEL3 U6
patch pool this evening (in kernel version 2.4.21-32.3.EL).
Comment 6 Neil Horman 2005-05-16 20:48:02 EDT
I wrote a module to register dummy character devices and block devices to fill
up the page in /proc/devices.  Pretty straightforward.  Do you want it?
Comment 8 Neil Horman 2005-05-17 07:11:16 EDT
Created attachment 114458 [details]
rhkl patch accepted to fix this problem

Sorry, arjan, I thought it was already added here.  This is what was accepted
on rhkl. Its pretty unobtrusive.
Comment 9 Neil Horman 2005-05-17 07:11:40 EDT
Created attachment 114459 [details]
rhkl patch accepted to fix this problem

Sorry, arjan, I thought it was already added here.  This is what was accepted
on rhkl. Its pretty unobtrusive.  I'll dig out my test code (need to remember
where I put it), and post it here shortly
Comment 18 Red Hat Bugzilla 2005-09-28 11:00:20 EDT
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 the 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-2005-663.html

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