0
Commit Graph

44 Commits

Author SHA1 Message Date
Tomas Popela
5b9b01f71f Get the distribution name from os-release instead of lsb_release
Use the PRETTY_NAME variable from /etc/os-release (or
/usr/lib/os-release) to get the "pretty operating system name in a format
suitable for presentation to the user" as the standard says.

This could allow us to drop a requirement on lsb_release binary on
Linux. The os-release is presented on most new distribution like Fedora,
RHEL 7, CentOS 7, Ubuntu 12.04+, Debian Wheezy+.

More information could be found on
https://www.freedesktop.org/software/systemd/man/os-release.html.

Bug: 420439
Change-Id: If4fc3cd3d22507e47b32d6184ac6ef4ae4b4ff3f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1156504
Commit-Queue: Tomáš Popela <tomas.popela@gmail.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Thomas Anderson <thomasanderson@chromium.org>
Auto-Submit: Tomáš Popela <tomas.popela@gmail.com>
Cr-Commit-Position: refs/heads/master@{#695280}
2019-09-10 19:42:31 +00:00
Alexandr Ilin
d4f4b34f77 android: Reached code sampling profiler.
Reached code profiler periodically interrupts threads in all Chrome processes
and stores process counter values as array of offsets. Later, this array may be
dumped to the disk or uploaded to a server for further analysis.

In order to collect samples this CL does following:
- Registers a signal handler early in the process creation. This handler writes
the current pc value into array. A signal handler is a process-global attribute
shared by all threads so every thread is able to handle a signal.
- Sets up an interval timer (via timer_create()) measuring CPU time consumed by
the calling process. This timer periodically calls SendSignalToAllThreads() on
a dedicated thread.
- SendSignalToAllThreads() has a cached list of all thread ids belonging
to the current process obtained by parsing /proc/self/task directory. It sends
a signal to all listed threads via tgkill() and periodically updates this list.

This allows to collect ~6000 samples per seconds from all threads.

This CL is based on lizeb@ work: https://crrev.com/c/1171233

Bug: 916263
Change-Id: I661ca6d65be694053458e2a6afa1dab62fd9812c
Reviewed-on: https://chromium-review.googlesource.com/c/1319597
Commit-Queue: Alexandr Ilin <alexilin@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Reviewed-by: ssid <ssid@chromium.org>
Reviewed-by: Egor Pasko <pasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#620731}
2019-01-08 15:34:09 +00:00
reveman
7b97c3240f base: Allow renderer thread priorities to be changed.
This provides a mechanism for a renderer to change the priority of
its threads and as a result also the cpuset they are assigned to.

A ChildProcessHost IPC message from the renderer is used to request
a thread priority change and have the browser process identify the
renderer thread that is requesting a priority change by checking all
its threads to find a thread with NSpid field in
/proc/[pid]/task/[thread_id]/status that matches the namespace tid
from the renderer.

This is currently limited to Linux and ChromeOS but follow up work
will investigate the possibility and benefits of doing the same on
other platforms.

Note: Thread priorities in the renderer are already adjusted in a
similar way on Android as the sandbox is not strict enough to
prevent this on Android today.

BUG=chrome-os-partner:56550
TEST=

Review-Url: https://codereview.chromium.org/2334533002
Cr-Commit-Position: refs/heads/master@{#419649}
2016-09-20 02:12:32 +00:00
mdempsky@chromium.org
5043a896e5 Remove SCM_CREDENTIALS fallback code from breakpad
Since r266618, we require SCM_CREDENTIALS to work correctly across PID
namespaces, and refuse to run on kernels where it doesn't.

Reland of r270173.  The original attempt failed to update kControlMsgSize,
which caused failures like this one:

http://build.chromium.org/p/chromium.linux/builders/Linux%20Tests%20%28dbg%29%281%29%2832%29/builds/5169

This is only noticed on 32-bit machines because CMSG_SPACE(sizeof(int))
happens to equal CMSG_SPACE(2*sizeof(int)) on x86-64 due to structure
padding and alignment, but they're different on i386.

Review URL: https://codereview.chromium.org/271703012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270367 0039d316-1c4b-4281-b951-d872f2087c98
2014-05-14 09:18:29 +00:00
piman@chromium.org
50ec6b2327 Revert 270173 "Remove SCM_CREDENTIALS fallback code from breakpad"
build break: http://build.chromium.org/p/chromium.linux/builders/Linux%20Tests%20%28dbg%29%281%29%2832%29/builds/5169/steps/browser_tests/logs/CDMExpectedCrash

> Remove SCM_CREDENTIALS fallback code from breakpad
> 
> Since r266618, we require SCM_CREDENTIALS to work correctly across PID
> namespaces, and refuse to run on kernels where it doesn't.
> 
> NOTRY=true
> 
> Review URL: https://codereview.chromium.org/283643004

TBR=mdempsky@chromium.org

Review URL: https://codereview.chromium.org/275913003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270277 0039d316-1c4b-4281-b951-d872f2087c98
2014-05-14 01:00:42 +00:00
mdempsky@chromium.org
dd33ee49a4 Remove unneeded kFindInodeSwitch
The last use was removed in r269530.

BUG=357670

Review URL: https://codereview.chromium.org/288463002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270179 0039d316-1c4b-4281-b951-d872f2087c98
2014-05-13 19:53:10 +00:00
mdempsky@chromium.org
c0ccd2c274 Remove SCM_CREDENTIALS fallback code from breakpad
Since r266618, we require SCM_CREDENTIALS to work correctly across PID
namespaces, and refuse to run on kernels where it doesn't.

NOTRY=true

Review URL: https://codereview.chromium.org/283643004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270173 0039d316-1c4b-4281-b951-d872f2087c98
2014-05-13 19:42:43 +00:00
jln@chromium.org
a73ed203c3 Create a new SetuidSandboxClient class.
We move the setuid sandbox "client" code to its own location in
/sandbox/linux/suid/client and we create a SetuidSandboxClient class
to use it.

NOTRY=true

Review URL: https://chromiumcodereview.appspot.com/10807059

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147993 0039d316-1c4b-4281-b951-d872f2087c98
2012-07-23 23:36:39 +00:00
ajwong@chromium.org
01c86ece02 Remove the rest of #pragma once in one big CL.
For context see this thread:
  https://groups.google.com/a/chromium.org/forum/?fromgroups#!topic/chromium-dev/RMcVNGjB4II

TBR=thakis,pkasting,jam

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146163 0039d316-1c4b-4281-b951-d872f2087c98
2012-07-11 19:01:43 +00:00
thestig@chromium.org
46e9acad2b Cleanup: Move some const char definitions to the .cc file. (try 2)
BUG=none
TEST=none

Review URL: https://chromiumcodereview.appspot.com/10535141

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142013 0039d316-1c4b-4281-b951-d872f2087c98
2012-06-13 23:20:04 +00:00
cpu@chromium.org
ee26352696 Revert 141810 - Cleanup: Move some const char definitions to the .cc file.
BUG=none
TEST=none

Review URL: https://chromiumcodereview.appspot.com/10539099

TBR=thestig@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10543130

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141823 0039d316-1c4b-4281-b951-d872f2087c98
2012-06-13 01:33:14 +00:00
thestig@chromium.org
eef23ec5b8 Cleanup: Move some const char definitions to the .cc file.
BUG=none
TEST=none

Review URL: https://chromiumcodereview.appspot.com/10539099

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141810 0039d316-1c4b-4281-b951-d872f2087c98
2012-06-13 00:44:56 +00:00
jln@chromium.org
d8e9e205d2 Linux: bump the setuid sandbox API number
With this change, the setuid sandbox and the Zygote will start
complaining if they expect different API versions.

Users will get warning messages if their setuid sandbox is too old
and be referred to:
https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment

BUG=
TEST=


Review URL: https://chromiumcodereview.appspot.com/10536009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140613 0039d316-1c4b-4281-b951-d872f2087c98
2012-06-05 21:05:09 +00:00
jln@chromium.org
0381ae21ec Setuid sandbox API versioning
We introduce API versioning to the setuid sandbox and issue warnings when
the versions Chrome and the Sandbox expect are different.

1. The Zygote launcher in the browser will export the API version it expects
to the environment.

2. The setuid sandbox will match its own version with the one in the
environment.

3. Afterwards, it will export the API it provides to the environment for the
sandboxed process.

4. The Zygote (the sandboxed process) will in turn check for the API number.

The double check is needed because a version of the browser or of the setuid
sandbox that does check for API could co-exist with a version that does not.

The various utilities that are part of the setuid sandbox are not versioned
because they have callers that are external to Chrome (in ChromeOS).

When environment variables are not found, we assume version 0. Since the API
is for now set to 0, this change will not produce any warning at the moment.

BUG=None
TEST=None


Review URL: https://chromiumcodereview.appspot.com/10492006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140456 0039d316-1c4b-4281-b951-d872f2087c98
2012-06-05 01:03:32 +00:00
darin@chromium.org
0bea725483 Rename BASE_API to BASE_EXPORT.
R=rvargas
Review URL: http://codereview.chromium.org/7461141

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95618 0039d316-1c4b-4281-b951-d872f2087c98
2011-08-05 15:34:00 +00:00
kmixter@chromium.org
cb7d53e31d Always search TIDs for the crashing processes.
Kernels newer than 2.6.32 support TID and PID namespacing where
processes' view of their TIDs and PIDs are not globally unique or
externally meaningful.  We have workarounds to find the TID and PID of
the crashing process from outside in the browser process.  However, we
were only assuming TID namespacing was happening if PID namespacing
was enabled and the kernel had a bug that was fixed since 2.6.38.
This change causes us to always treat the TID as subject to
namespacing.  Our trick to find the TID relies on a procfs feature
added in 2008.  We assume if that feature is not yet present that
the TID translation is not necessary.

This fixes the bug where all crashes of non-browser processes on Linux
2.6.38+ (Chrome OS r13+) are unusable (result in
UnspecifiedStackSignature).

BUG=chromium-os:15462
TEST=Do about:crash on 2.6.38 kernel and verify proper tid listed in
MDException block 

Review URL: http://codereview.chromium.org/7190019

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89795 0039d316-1c4b-4281-b951-d872f2087c98
2011-06-21 04:21:06 +00:00
bryner@chromium.org
fb96946aa8 Add BASE_API to the remaining functions in linux_util.
These symbols are used by chrome/browser/crash_handler_host_linux.cc when building with branding==Chrome, so they need to be exported for shared-library builds to work in that configuration.

BUG=none
TEST=builds

Review URL: http://codereview.chromium.org/7076007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86782 0039d316-1c4b-4281-b951-d872f2087c98
2011-05-26 05:34:23 +00:00
evan@chromium.org
68a008e82d linux: components build
Reapply r83630, r83629, r83583, and fix the one compile error.

TBR=rvargas

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83740 0039d316-1c4b-4281-b951-d872f2087c98
2011-05-02 17:54:14 +00:00
maf@chromium.org
fd132701cc Revert 83629 - linux components: expose more BASE_API used by Chrome itself
Review URL: http://codereview.chromium.org/6902177

TBR=evan@chromium.org
Review URL: http://codereview.chromium.org/6903159

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83635 0039d316-1c4b-4281-b951-d872f2087c98
2011-04-30 00:10:16 +00:00
evan@chromium.org
afedf0168c linux components: expose more BASE_API used by Chrome itself
Review URL: http://codereview.chromium.org/6902177

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83629 0039d316-1c4b-4281-b951-d872f2087c98
2011-04-29 23:54:11 +00:00
brettw@google.com
a8e2058011 Move base/win_util to the base/win directory and use the base::win namespace.
Fix up includes, many files including base/win_util don't actually need it.

TEST=it compiles
BUG=none

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70341 0039d316-1c4b-4281-b951-d872f2087c98
2010-12-31 17:18:50 +00:00
mnissler@chromium.org
6dde9d7f2a Make crash reporting client_id accessible through child_process_logging.
On Mac and Linux, keep the client id in a global variable kept by the
child_process_logging implementations. This allows to read it in a
thread safe fashion when starting a child process.

Also replace std::string with statically allocated buffers for the
various items we add to the crash reports. This allows to properly
handle crashes upon shutdown (std::string would run its destructor,
invalidating the memory).

BUG=53231
TEST=Crash reporting should still work

Review URL: http://codereview.chromium.org/3186028

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57497 0039d316-1c4b-4281-b951-d872f2087c98
2010-08-26 08:55:22 +00:00
viettrungluu@chromium.org
d7828c27c6 Remove obviously unneeded forward declarations from headers under src/{app,base,net}.
BUG=none
TEST=builds

Review URL: http://codereview.chromium.org/3136025

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56995 0039d316-1c4b-4281-b951-d872f2087c98
2010-08-21 16:42:35 +00:00
tfarina@chromium.org
76b90d310d base: Rename EnvVarGetter to Environment.
Now EnvVarGetter do much more than getting environment variables.

Per suggestion from Pawel in http://codereview.chromium.org/3043018/.

BUG=None
TEST=trybots

Signed-off-by: Thiago Farina <tfarina@chromium.org>

Review URL: http://codereview.chromium.org/3052034

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54696 0039d316-1c4b-4281-b951-d872f2087c98
2010-08-03 03:00:50 +00:00
thakis@chromium.org
32b76eff6f #pragma once for app, base, chrome, gfx, ipc, net, skia, views
BUG=50273
TEST=everything still builds, build is 10% faster on windows, same speed on mac/linux

TBR: erg

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53716 0039d316-1c4b-4281-b951-d872f2087c98
2010-07-26 23:08:24 +00:00
thestig@chromium.org
6621831401 Linux: Guess the thread id for crashing renderers in a different PID namespace.
BUG=48997
TEST=Google Chrome gets valid crash reports for about:crash most of the time.
Review URL: http://codereview.chromium.org/2961008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52723 0039d316-1c4b-4281-b951-d872f2087c98
2010-07-16 19:28:17 +00:00
pvalchev@google.com
7cd70c394e Move non-linux specific code from base/linux_util to app/gtk_util
from sprewell

Review URL: http://codereview.chromium.org/2058004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47201 0039d316-1c4b-4281-b951-d872f2087c98
2010-05-13 22:06:01 +00:00
evan@chromium.org
1c657854c2 bsd: refactor XDG bits of linux_util into a shared file.
This allows the shared code to build on the BSDs without
them needing to build _linux files.

Review URL: http://codereview.chromium.org/1701005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45380 0039d316-1c4b-4281-b951-d872f2087c98
2010-04-22 23:28:05 +00:00
erg@chromium.org
11991c3c09 GTK: Improve xfce detection.
On Hardy, the DESKTOP_SESSION environment variable is "xfce4" but on Karmic,
it is "xfce"

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/1572042

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44698 0039d316-1c4b-4281-b951-d872f2087c98
2010-04-15 20:40:17 +00:00
thestig@chromium.org
9bc8cff2f2 Move EnvironmentVariableGetter from base/linux_util.h to base/env_var.h and rename it EnvVarGetter. Label base::SysInfo::{Get,Has}EnvVar as deprecated.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/1606007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43559 0039d316-1c4b-4281-b951-d872f2087c98
2010-04-03 01:05:39 +00:00
erg@chromium.org
88c50ab803 GTK: Turn on the GTK+ integration by default.
This will regress default startup time for users by 50ms. This doesn't matter
because this is what the users want--I've lost count of the number bloggers,
people on twitter, and people in our IRC channel complaining about the lack of
GTK+ integration...when it's just not on by default.

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/1442001

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42804 0039d316-1c4b-4281-b951-d872f2087c98
2010-03-26 20:04:06 +00:00
thestig@chromium.org
9e9b6e8ee7 Move some XDG code from chrome to base, make DIR_USER_CACHE generic rather than Chromium specific, and clean up a few headers.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/449048

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33565 0039d316-1c4b-4281-b951-d872f2087c98
2009-12-02 08:45:01 +00:00
thestig@chromium.org
8ecd3aade8 Add support for getting the real process id from within the suid sandbox. The browser processes gets the real process ids, so they look correct in the task manager. When it asks the zygote to reap a process, we use the process ids internal to the sandbox.
While we are at it, reap the sandbox process after it clones the zygote and figure out zygote's actual process id. Save the actual process id rather than that of the sandbox.

Original review: http://codereview.chromium.org/262020
This is try 2 - initialize the sandbox host and zygote for InProcessBrowserTest.

TBR=agl

BUG=20012, 20714, 23072
TEST=Process IDs for renderers should be correct in the task manager and you should be able to use the end process button to kill them.

Review URL: http://codereview.chromium.org/361002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30948 0039d316-1c4b-4281-b951-d872f2087c98
2009-11-04 08:32:22 +00:00
thestig@chromium.org
83a0cbe4af Revert 30938 - Add support for getting the real process id from within the suid sandbox. The browser processes gets the real process ids, so they look correct in the task manager. When it asks the zygote to reap a process, we use the process ids internal to the sandbox.
While we are at it, reap the sandbox process after it clones the zygote and figure out zygote's actual process id. Save the actual process id rather than that of the sandbox.

BUG=20012,20714,23072
TEST=Process IDs for renderers should be correct in the task manager and you should be able to use the end process button to kill them.
Review URL: http://codereview.chromium.org/262020
Review URL: http://codereview.chromium.org/359001

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30939 0039d316-1c4b-4281-b951-d872f2087c98
2009-11-04 04:22:47 +00:00
thestig@chromium.org
da11a4be39 Add support for getting the real process id from within the suid sandbox. The browser processes gets the real process ids, so they look correct in the task manager. When it asks the zygote to reap a process, we use the process ids internal to the sandbox.
While we are at it, reap the sandbox process after it clones the zygote and figure out zygote's actual process id. Save the actual process id rather than that of the sandbox.

BUG=20012,20714,23072
TEST=Process IDs for renderers should be correct in the task manager and you should be able to use the end process button to kill them.
Review URL: http://codereview.chromium.org/262020

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30938 0039d316-1c4b-4281-b951-d872f2087c98
2009-11-04 04:07:33 +00:00
craig.schlenter@chromium.org
b28af75267 Linux: Add missing include.
sys/types.h is needed for ino_t.

Review URL: http://codereview.chromium.org/339066

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30477 0039d316-1c4b-4281-b951-d872f2087c98
2009-10-29 18:21:30 +00:00
thestig@chromium.org
85ebe8f925 Move FileDescriptorGetInode() and FindProcessHoldingSocket() into base/linux_util.cc. Reimplement FileDescriptorGetInode().
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/312002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30433 0039d316-1c4b-4281-b951-d872f2087c98
2009-10-29 04:02:55 +00:00
mdm@chromium.org
c85cfbd98c Linux: make the "change proxy settings" button able to start several proxy config utilities.
Currently it still only ever starts gnome-network-properties but it is now easy to update.
BUG=none
TEST=none

Review URL: http://codereview.chromium.org/174106

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23910 0039d316-1c4b-4281-b951-d872f2087c98
2009-08-20 23:14:57 +00:00
evan@chromium.org
d6cb85b664 linux: generalize desktop environment guessing to encompass KDE
BUG=17363

Review URL: http://codereview.chromium.org/159297

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21455 0039d316-1c4b-4281-b951-d872f2087c98
2009-07-23 22:10:53 +00:00
mattm@chromium.org
87fc168b36 Try again: Add proxy config (using gnome-network-preferences)
BUG=11507
TEST=Open options, click change proxy, gnome-network-preferences should launch.  If gnome isn't installed or running, LinuxProxyConfig wiki page should load.

Review URL: http://codereview.chromium.org/155792

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21246 0039d316-1c4b-4281-b951-d872f2087c98
2009-07-22 00:22:49 +00:00
mattm@chromium.org
200e80dc6a Revert "Add proxy config (using gnome-network-preferences)"
This reverts commit d06bc0c855b1e81e36c7bfc9bef342eb358d99a5.

TBR=estade

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21033 0039d316-1c4b-4281-b951-d872f2087c98
2009-07-18 00:34:56 +00:00
mattm@chromium.org
425be73ff4 Add proxy config (using gnome-network-preferences)
BUG=11507
TEST=Open options, click change proxy, gnome-network-preferences should launch.  If gnome isn't installed, LinuxProxyConfig wiki page should load.

Review URL: http://codereview.chromium.org/149785

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21023 0039d316-1c4b-4281-b951-d872f2087c98
2009-07-17 23:28:08 +00:00
thestig@chromium.org
912c64520e Include output of "lsb_release -d" in crash reports.
/etc/lsb-release does not exist on all distros, and sometimes it does
not provide any useful info. Whereas all LSB complaint distros return
useful data with the lsb_release command.
Review URL: http://codereview.chromium.org/155653

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20936 0039d316-1c4b-4281-b951-d872f2087c98
2009-07-17 05:55:51 +00:00
sgk@google.com
75ae542de5 Eliminate a circular dependency by making BGRAToRGBA() generic (no pulling in guchar from gtk.h) and moving it from base/gfx to base.
Review URL: http://codereview.chromium.org/87016

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14117 0039d316-1c4b-4281-b951-d872f2087c98
2009-04-21 17:20:10 +00:00