Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 477538 - www-client/chromium: munging of command line breaks `netstat -p` processing via /proc/$pid/comm
Summary: www-client/chromium: munging of command line breaks `netstat -p` processing v...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Chromium Project
URL: https://crbug.com/887875
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-20 22:52 UTC by Agostino Sarubbo
Modified: 2018-09-21 14:36 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2013-07-20 22:52:26 UTC
Netstat -p says:


tcp        0      0 192.168.1.10:36475      mil01s17-in-f15.1e:http ESTABLISHED 4529/ -start-maximi 


my /etc/chromium/default is:

CHROMIUM_FLAGS="--disk-cache-dir="/tmp/" -start-maximized"


I don't see chrome/chromium via netstat.

I guess it is more an upstream bug.
Comment 1 Mike Gilbert gentoo-dev 2013-07-20 23:25:41 UTC
@base-system: How does netstat get the "program name"?
Comment 2 Denis M. (Phr33d0m) 2013-07-20 23:47:52 UTC
Mine show up as:

# ▶ netstat -ntp
tcp        0      0 192.168.1.10:59672      69.171.247.29:443       ESTABLISHED 4154/cache --scroll 
tcp        0      0 192.168.1.10:47482      95.131.168.181:80       ESTABLISHED 4154/cache --scroll 
tcp        0      0 192.168.1.10:34860      95.131.171.210:80       ESTABLISHED 4154/cache --scroll 
tcp        0      0 192.168.1.10:43766      173.194.34.231:443      ESTABLISHED 4154/cache --scroll 
tcp        0      0 192.168.1.10:58681      173.252.102.241:443     ESTABLISHED 4154/cache --scroll 
tcp        0      0 192.168.1.10:41161      173.194.78.125:5222     ESTABLISHED 4154/cache --scroll


And my CHROMIUM_FLAGS:
CHROMIUM_FLAGS="--disk-cache-dir=/tmp/cache --scroll-pixels=250 --disk-cache-size=629145600 --memory-model=high"


And 'ps':
$ ▶ ps aux | grep chrome
n0ks      4154  0.6  1.4 3616024 353820 ?      Sl   Jul20   4:17 /usr/lib64/chromium-browser/chrome --extra-plugin-dir=/usr/lib/nsbrowser/plugins --disk-cache-dir=/tmp/cache --scroll-pixels=250 --disk-cache-size=629145600 --memory-model=high
Comment 3 Matt Whitlock 2013-10-01 21:29:59 UTC
(In reply to Mike Gilbert from comment #1)
> @base-system: How does netstat get the "program name"?

It should be doing it by calling readlink(2) on /proc/<pid>/exe and then calling basename(3) on the result, but, from the looks of it, it's doing something with /proc/<pid>/cmdline.
Comment 4 SpanKY gentoo-dev 2013-12-23 06:18:05 UTC
the trouble is that the code does:
 - read /proc/$pid/cmdline
 - if (cmdlbuf[0] == '/' && (cmdlp = strrchr(cmdlbuf, '/'))) 
 - display cmdlp as the process name

so if your process does something like:
 /opt/google/chrome/chrome --user-data-dir=/home/vapier/.config/google-chrome-beta --extra-plugin-dir=/usr/lib64/nsbrowser/plugins

it'll find "/plugins" and use "plugins" as the name.  but it only does this scane if the prog starts with a /.  it's been this way since 20 Apr 2011.

the code before that just did:
 - cmdlp = strrchr(cmdlbuf, '/');

which mean it'd always misprocess a / in the name.  the leading / check was added to address cases like:
 sshd pts/0

which would cause it to render as "0" instead of "sshd".  this dates back to the original commit in 03 Mar 1999.  iow, it's always been broken :P.
Comment 5 SpanKY gentoo-dev 2013-12-23 06:54:27 UTC
hmm, actually, playing around with this a bit more, i think the bug might be in chromium itself.

the "cmdline" file is supposed to be NUL delimited, but chromium is space delimited.  if it were to change its logic to use NUL's, then netstat would automatically be fixed.
Comment 6 Mike Gilbert gentoo-dev 2013-12-24 21:34:09 UTC
Hmm... now if I could just figure out where that argv clobbering code lives.