All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Chad N. Tindel" <chad@tindel.net>
To: netdev@oss.sgi.com
Cc: linux-net@vger.kernel.org
Subject: Wrong UIDs reported in /proc/net/tcp
Date: Tue, 9 Nov 2004 15:53:58 -0500	[thread overview]
Message-ID: <20041109205358.GA64015@calma.pair.com> (raw)

Hello-

In our testing we've found some occurrences of identd reporting back the
wrong username for the owner of a socket.  We added some instrumentation
to identd so that we can tell it what we expect the username to be, and when
what it discovers doesn't match what we expect, it logs a message.  Sometimes
non-root users appear as root, and sometimes the root user appears as a non-root
user.  Here's an example log message from our instrumented identd:

Nov  9 00:55:11 rock identd[4139]: ERROR: Expected username 'root' but got 'ident'. Proc line was ' 299: AFAF0D0F:CEE1 ACAF0D0F:14B6 01 00000000:00000000 00:00000000 00000000   100        0 880370 1 f22bb980 21 4 8 3 -1 '.  EUID was 100

As you can see, our client was running as root, but identd reported that
the username was "ident".  /proc/net/tcp reported that the EUID was 100.  
Clearly it isn't correct that the ident user is associated with a socket that
doesn't have port 113 as one of the endpoints.

Here's another example:

Nov  8 17:19:06 rock identd[4139]: ERROR: Expected username 'rba0001f' but got 'root'. Proc line was '  19: AFAF0D0F:8FFD AFAF0D0F:14B6 01 00000000:00000000 02:000AFC6F 00000000     0        0 0 2 f04ed980 '.  EUID was 0

The user rba0001f has a UID of 65535 on this system.

We have seen this problem on RH3u3 as well as SLES9, so our current thoughts
are that it is a generic kernel issue.  We're starting to dive down in the
code to look for possible problems, but I wanted to bring it up to the list
and see if anybody had any ideas.  

In our cursory analysis of the code, we've seen that the inode structure which
holds the user id comes out of a cache.  In the function sock_alloc(), the
UID gets assigned as:

inode->i_uid = current->fsuid;

Is it possible for this code to be invoked in a context where current doesn't
actually point to the right task structure?

Is it possible for the socket to get added to the established hash table
before the uid pointer gets initialized, thus causing /proc/net/tcp to report
the UID of whoever used this socket memory earlier?

We can reproduce this problem fairly easily here, so if anybody has any ideas
or suggestions on kernel instrumentation that would help track this down, I'm
all ears.

Regards,

Chad

             reply	other threads:[~2004-11-09 20:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-09 20:53 Chad N. Tindel [this message]
2004-11-09 21:06 ` Wrong UIDs reported in /proc/net/tcp Herbert Xu
2004-11-09 22:43   ` Chad N. Tindel
2004-11-09 22:58     ` Herbert Xu
2004-11-09 23:04       ` Chad N. Tindel
2004-11-09 23:18         ` Herbert Xu
2004-11-18 19:02   ` Chad N. Tindel
2004-11-18 21:03     ` Herbert Xu
2004-11-18 21:27       ` Stephen Hemminger
2004-11-18 22:07         ` Herbert Xu
2004-11-18 22:16           ` David Stevens
2004-11-18 23:40             ` Herbert Xu
2004-11-18 23:49             ` Chad N. Tindel
2004-11-18 23:56               ` David Stevens
2004-11-19  1:26                 ` Herbert Xu
2004-11-19 21:01       ` Chad N. Tindel
2004-11-19 14:27     ` Henrik Nordstrom
2004-11-09 21:11 ` akepner
2004-11-09 22:41   ` Chad N. Tindel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041109205358.GA64015@calma.pair.com \
    --to=chad@tindel.net \
    --cc=linux-net@vger.kernel.org \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.