Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 234262 - intermittent parse failure due to 64-bit tm->when time field in /proc/net/tcp*
Summary: intermittent parse failure due to 64-bit tm->when time field in /proc/net/tcp*
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: authd
Version: rawhide
Hardware: All
OS: Linux
medium
low
Target Milestone: ---
Assignee: Roman Rakus
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-03-27 22:46 UTC by Bill Rugolsky, Jr.
Modified: 2014-01-13 00:06 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-02-27 14:34:43 UTC


Attachments (Terms of Use)
simple-minded workaround for parse failure (deleted)
2007-03-27 22:46 UTC, Bill Rugolsky, Jr.
no flags Details | Diff

Description Bill Rugolsky, Jr. 2007-03-27 22:46:21 UTC
Description of problem:

authd incorrectly assumes that the "tm->when" field in /proc/net/tcp* is limited
to a 32-bit value, and fails when that value exceeds UINT_MAX.  

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

How reproducible:
Always.

Steps to Reproduce:
On an FC6 x86_64 bit machine in multiuser mode:
1. ssh localhost
2. set -- $SSH_CONNECTION
3. yes $2,$4 | /usr/sbin/in.authd -d -m

Actual results:
local_address =(null):D15D
rem_address   =(null):0016
/proc/net/tcp =sl:7 uid:500 inode:37274
53597 , 22 : USERID : UNIX :rugolsky
[ ... repeated potentially a few hundred times ... ]
local_address =(null):D15D
rem_address   =(null):0016
/proc/net/tcp:2:    0: 0100007F:1F40 00000000:0000 0A 00000000:00000000
00:1AD7F29ABCA 00000000     0        0 10222 1 ffff81006e767800 3000 0 0 2 -1  
              
/proc/net/tcp =sl:7 uid:500 inode:37274
53597 , 22 : ERROR :rugolsky

Expected results:
Endless repeating pattern of output, without error.

Additional info:
This problem currently only occurs when running a 64-bit kernel, with either
64-bit or 32-bit authd.  I worked around it by creating a get_tok_ullong()
function to mirror the behavior of get_tok_uint(), but that's not really
necessary.  The code is quite crufty, and could use a cleanup pass to iron out
the use of various integer sizes.

The offending lines in authd.c are:

    350 static unsigned long get_tok_uint(char *s, unsigned base) {
    351     unsigned long ul = ULONG_MAX;
    352 
    353     assert(base <= 36);
    354     if ((s = strtok(s, DELIM)) != NULL) {
    355         char *endptr;
    356 
    357         ul = strtoul(s, &endptr, (int) base);
    358         if (ul > UINT_MAX || is_bad_strto(s, endptr))
    359             errno = EINVAL;
    360     }
    361     else errno = EINVAL;
    362     return ul;
    363 }

and

    657         (void) get_tok_uint(NULL, 16);            // tm->when (unit:
jiffies)

Comment 1 Bill Rugolsky, Jr. 2007-03-27 22:46:21 UTC
Created attachment 151088 [details]
simple-minded workaround for parse failure

Comment 2 Roman Rakus 2008-02-27 14:34:43 UTC
Thanks for patch and sorry for long delay.
Fedora 6 is EOL, changing version to rawhide. Fixed in rawhide,
authd-1.4.3-13.x86_64.rpm.


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