0
Commit Graph

38 Commits

Author SHA1 Message Date
Ken Rockot
89903dec9a MojoIpcz: Full handle xfer for elevated processes
Adds a few additional bits of state to the MojoIpcz transport
implementation, in particular to track relative trust level across the
transport independent of broker/non-broker status.

Also introduces new Mojo invitation API flags to indicate when the
caller is inviting a process (or accepting an invitation as a process)
that is trustworthy, e.g. an elevated Windows process.

Combined these changes allow trusted non-broker nodes to transfer
pre-duplicated handles to brokers, rendering elevated processes
fully functional in a network of MojoIpcz processes. This turns out
to be necessary for existing elevated process usage in Chrome due
to how ipcz communication is bootstrapped.

TEST=browser_tests for ImageWriterUtilityClient* on Windows with MojoIpcz enabled

Bug: 1374611
Change-Id: Id9a6056e239c6ec0f258cd053489fd1771e3c850
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3963307
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Alex Gough <ajgo@chromium.org>
Commit-Queue: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/main@{#1061775}
2022-10-20 20:21:03 +00:00
Dominik Röttsches
b4ea6c73e5 Disable flaky LaunchProcessAndCrash test on Linux64
Compare failing builds auch as:
https://ci.chromium.org/ui/p/chrome/builders/ci/linux64/89238/overview

Bug: 879555
Change-Id: I419ad7680aaaa98c2be751646dc07e3d61a44c56
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3918174
Auto-Submit: Dominik Röttsches <drott@chromium.org>
Commit-Queue: Dominik Röttsches <drott@chromium.org>
Owners-Override: Dominik Röttsches <drott@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Quick-Run: Dominik Röttsches <drott@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1051172}
2022-09-26 13:02:39 +00:00
Avi Drissman
4e1b7bc33d Update copyright headers in content/
The methodology used to generate this CL is documented in
https://crbug.com/1098010#c34.

No-Try: true
No-Presubmit: true
Bug: 1098010
Change-Id: I8c0f009d16350271f07d8e5e561085822cc9dd27
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3895935
Owners-Override: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1047456}
2022-09-15 14:03:50 +00:00
Will Harris
591d1cc24f Partial Revert "[Sheriff] disabled UtilityProcessHostBrowserTest.LaunchProcessAndCrash"
This reverts commit 3a6812278a.

Reason for revert: We should only disable this on android-arm64.

Original change's description:
> [Sheriff] disabled UtilityProcessHostBrowserTest.LaunchProcessAndCrash
>
> Bug: 1358585
> Change-Id: I93de868da852b28e1e2ea62d1cc9bd4b1c88221e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3867145
> Reviewed-by: Leonard Grey <lgrey@chromium.org>
> Commit-Queue: Salvador Guerrero Ramos <salg@google.com>
> Owners-Override: Salvador Guerrero Ramos <salg@google.com>
> Cr-Commit-Position: refs/heads/main@{#1041640}

Bug: 1358585
Change-Id: I90238b4aa5ecbfe2f0259f2d7970bcf401515080
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3878871
Reviewed-by: Bo Liu <boliu@chromium.org>
Commit-Queue: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1044111}
2022-09-07 19:02:22 +00:00
Salvador Guerrero
3a6812278a [Sheriff] disabled UtilityProcessHostBrowserTest.LaunchProcessAndCrash
Bug: 1358585
Change-Id: I93de868da852b28e1e2ea62d1cc9bd4b1c88221e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3867145
Reviewed-by: Leonard Grey <lgrey@chromium.org>
Commit-Queue: Salvador Guerrero Ramos <salg@google.com>
Owners-Override: Salvador Guerrero Ramos <salg@google.com>
Cr-Commit-Position: refs/heads/main@{#1041640}
2022-08-31 18:42:04 +00:00
Patrick Monette
c355402c0a Transform TestService into a main utility service
With this change, TestService will have the same behavior as other
utility service like the Network process, where a disconnection cause
the utility process to terminate.

Bug: 977637
Change-Id: Iaa40598445b129d1737a663777b9f9f092c6fe04
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3851127
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Patrick Monette <pmonette@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1038918}
2022-08-24 20:00:22 +00:00
Xiaohan Wang
1ecfd006fd content: Use BUILDFLAG for OS checking
Use BUILDFLAG(IS_XXX) instead of defined(OS_XXX).

Generated by `os_buildflag_migration.py` (https://crrev.com/c/3311983).

R=thakis@chromium.org

Bug: 1234043
Test: No functionality change
Change-Id: Ia0eae6f9396065e190929d42600012c9324c07e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3399774
Commit-Queue: Xiaohan Wang <xhwang@chromium.org>
Owners-Override: Xiaohan Wang <xhwang@chromium.org>
Auto-Submit: Xiaohan Wang <xhwang@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Owners-Override: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#961157}
2022-01-19 22:33:10 +00:00
Will Harris
df8fcb48c2 Reland "Add launch failure notifications to BrowserChildProcessObserver"
This is a reland of 893230151e

The previous version of this CL mistakenly removed a default
case statement for an 'int' field, so an expected compile error
was not generated but instead an early return was skipped.

Original change's description:
> Add launch failure notifications to BrowserChildProcessObserver
>
> Also, fix a bug where the Windows sandbox would return SBOX_ALL_OK
> even if base::LaunchProcess failed, and launch_result was not
> being set for elevated processes.
>
> Add reporting of GetLastError on Windows in the
> ChildProcessTerminationInfo for failed launches.
>
> Also, clean up some switch statements to remove default cases.
>
> BUG=1280005
>
> Change-Id: I1001fc950b8456b78ef1a9a985ca07cf288e8a04
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3340072
> Reviewed-by: John Abd-El-Malek <jam@chromium.org>
> Commit-Queue: Will Harris <wfh@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#952182}

Bug: 1280005, 1280541
Change-Id: I81f3354e9870a455644e77144a40c4acbdf14ebe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3345720
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#952667}
2021-12-18 09:21:31 +00:00
Kush Sinha
d26f685ff4 [Sheriff] Revert "Add launch failure notifications to BrowserChildProcessObserver"
This reverts commit 893230151e.

Reason for revert: "browser_tests" failing on builder "Linux ChromiumOS MSan Tests"

Original change's description:
> Add launch failure notifications to BrowserChildProcessObserver
>
> Also, fix a bug where the Windows sandbox would return SBOX_ALL_OK
> even if base::LaunchProcess failed, and launch_result was not
> being set for elevated processes.
>
> Add reporting of GetLastError on Windows in the
> ChildProcessTerminationInfo for failed launches.
>
> Also, clean up some switch statements to remove default cases.
>
> BUG=1280005
>
> Change-Id: I1001fc950b8456b78ef1a9a985ca07cf288e8a04
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3340072
> Reviewed-by: John Abd-El-Malek <jam@chromium.org>
> Commit-Queue: Will Harris <wfh@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#952182}

Bug: 1280005, 1280541
Change-Id: I368d0c89ca6911cb4145bcec13edf2ad8bd4d829
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3344787
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Kush Sinha <sinhak@chromium.org>
Reviewed-by: Aya Elsayed <ayaelattar@chromium.org>
Commit-Queue: Kush Sinha <sinhak@chromium.org>
Owners-Override: Kush Sinha <sinhak@chromium.org>
Cr-Commit-Position: refs/heads/main@{#952303}
2021-12-16 11:00:34 +00:00
Will Harris
893230151e Add launch failure notifications to BrowserChildProcessObserver
Also, fix a bug where the Windows sandbox would return SBOX_ALL_OK
even if base::LaunchProcess failed, and launch_result was not
being set for elevated processes.

Add reporting of GetLastError on Windows in the
ChildProcessTerminationInfo for failed launches.

Also, clean up some switch statements to remove default cases.

BUG=1280005

Change-Id: I1001fc950b8456b78ef1a9a985ca07cf288e8a04
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3340072
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#952182}
2021-12-16 01:17:22 +00:00
Will Harris
5d4df28cb5 Re-enable LaunchElevatedProcess test.
This test should not be flaky or fail, so perhaps situation has changed
since it was disabled. It's important that this works.

So re-enable it to monitor for more flakes. Will Disable if they happen
again.

BUG=1268087,927298

Change-Id: I529e02daa690bc4255579a223520bb4a70f1cfe3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3313644
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Commit-Queue: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#949721}
2021-12-08 21:32:15 +00:00
Alex Gough
eb6a38f6fa Replace sandbox::policy::SandboxType with mojom Sandbox enum
sandbox.mojom.Sandbox can now be used as the sandbox type so we
replace it everywhere.

The guts of the change are in //sandbox/policy/sandbox_type.h where
SandboxType is now deleted, and //sandbox/policy/mojom/sandbox.mojom
where sandbox types that are not already used in mojom ServiceSandbox
attributes are added.

Some cascading changes:-

 - kService wasn't implemented on Mac (as it is equivalent to kUtility).
 As we cannot alias enum fields in mojo like we can in C++ I have added
 kService for Mac. The alternative is to define platform specific
 ServiceSandbox attributes for all kService interfaces which seems to
 put this complexity in the wrong place.
 - sandbox_type.h included a number of buildflag headers that other files
 then relied on. As sandbox_type.h is no longer needed in many places
 and no longer needs these defines, they have been introduced where
 required.
 - sandbox::mojom::Sandbox is forward declared in a couple of headers
 that are widely imported, hopefully reducing the number of times the
 mojom.h is included but not used.
 - some build deps must be modified.
 - LibAssistantService needs a sandbox to be defined even when hosted
 in process, so has kNoSandbox now when enable_cros_libassistant is
 false.

Bug: 1210301
Change-Id: I13fa4fa8cbbb3090a38806fe5532787bbdf1e2fb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3213677
Reviewed-by: Charlie Reis <creis@chromium.org>
Reviewed-by: Sean Topping <seantopping@chromium.org>
Reviewed-by: Filip Gorski <fgorski@chromium.org>
Reviewed-by: Derek Schuff <dschuff@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Tao Wu <wutao@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Will Harris <wfh@chromium.org>
Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: David Dorwin <ddorwin@chromium.org>
Commit-Queue: Alex Gough <ajgo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#934126}
2021-10-22 01:55:13 +00:00
John Abd-El-Malek
9c256eb60e Some simplifications in content now that ProcessHostOnUI is on by default.
Bug: 904556
Change-Id: I421e5a343fa8f0888c5a5af5c736b2d884944fa5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3174369
Auto-Submit: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Commit-Queue: Nasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#923977}
2021-09-22 19:17:13 +00:00
Peter Kasting
5b16ac38f9 Convert narrowing casts from T{} to static_cast<T>(): content/
The style guide encourages use of T{}-style casts under the assumption
that the compiler will warn about narrowing.  This warning is currently
disabled; enabling it requires fixing up the cases that narrow.

Bug: 1216696
Change-Id: I096d3de7f3c23fe663d78cae9f25e7ebe1b23f69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2946380
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#890173}
2021-06-08 09:42:01 +00:00
John Abd-El-Malek
a1c30bc2ab Fix various browser_tests and content_browsertests to work when ProcessHost objects live on UI thread.
Bug: 904556
Change-Id: Id9dd20c6bc3d787119408be874411a254dc5d8e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2828695
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Calder Kitagawa <ckitagawa@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#873077}
2021-04-15 22:31:19 +00:00
Jan Wilken Dörrie
8aeb574da9 [LSC] Remove base::ASCIIToUTF16("...") in //content and //ui
This change removes calls to base::ASCIIToUTF16 in //content and //ui
with a single-line string literal and replaces them with a u"..."
literal instead. Files where this change would cause compilation errors
were not changed.

This is a mechanical change:

$ git grep -lw ASCIIToUTF16 content ui | xargs \
    sed -i 's/\(base::\)\?ASCIIToUTF16(\("\(\\.\|[^\\"]\)*"\))/u\2/g'
$ git cl format

Bug: 1189439
Change-Id: I0d5601dc15324c43012b8d26260405f1efdca07e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2780265
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#865766}
2021-03-23 19:27:02 +00:00
Sean McAllister
0d73ca3d80 Refactor OS_LINUX preprocessor directive for LaCrOS effort.
Currently, ChromeOS defines the OS_LINUX directive as well as
OS_CHROMEOS.  We're working to separate these two, so we're
making the fact that OS_LINUX == OS_LINUX || OS_CHROMEOS
explicit.

Bug: 1110266
Change-Id: Iebbe654853bebeb4af49c9cb793dae5938416f3f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2351374
Commit-Queue: Sean McAllister <smcallis@google.com>
Reviewed-by: Drew Wilson <atwilson@chromium.org>
Reviewed-by: Erik Chen <erikchen@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Becca Hughes <beccahughes@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Mike Wittman <wittman@chromium.org>
Reviewed-by: David Roger <droger@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799710}
2020-08-19 17:54:37 +00:00
Avi Drissman
7c57be77a7 Migrate to OS_MAC and OS_APPLE in content
Because content is not used by iOS, this migrates
 defined(OS_MACOSX) -> defined(OS_MAC)

Bug: 1105907
Change-Id: Ibf85273fea9c5566594ca00f2589b890515be6c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2321210
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792842}
2020-07-29 20:09:46 +00:00
Robert Sesek
7d0b49b0aa Move //services/service_manager/sandbox to //sandbox/policy.
Originally the sandbox policies lived in //content, but with
servicification this would create unwanted dependencies between
//services and //content. Instead, create a new //sandbox/policy
library to hold the sandbox integration code. This library can depend
on the low-level //sandbox routines, but not nice versa.

Tbr: ajgo@chromium.org (mechanical change rule)
Bug: 1097376
Change-Id: I1ca9ac0015a625197f2d3aae104e8f7aa78dcfd9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2272609
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Alex Gough <ajgo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786385}
2020-07-08 18:31:27 +00:00
Gabriel Charette
e7cdc5cd07 [BrowserThread] Migration callers without full content:: namespace
Note to QA: This CL is purely mechanical and shouldn't be blamed
for future regressions on touched files.

This is a follow-up to https://chromium-review.googlesource.com/c/chromium/src/+/2211138
which already removed all usage using content::BrowserThread.

Hence this script now matches unqualified BrowserThread:: without
risking having "content::" be selected as "traits_before" by the regex
(ran on same revision as step ).

content:: is now always added if outside namespace content {}
(deleting unused using content::BrowserThread; decls)

Script @ https://crbug.com/1026641#c92

(will TBR fdoray@ post-review for mechanical change)
TBR=fdoray@hchromium.org

AX-Relnotes: n/a.
Bug: 1026641
Change-Id: I51ae2f83eb17d19b54563fd9b4fc040d2aa0c948
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2212469
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: François Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772458}
2020-05-27 23:35:05 +00:00
Peter Kasting
919ce657e4 Add missing #includes of browser_test.h.
This is a step towards doing full IWYU of browser_test.h, which will
have other benefits.

Completely mechanical and already R+ed as part of r765923.

Tbr: sky
Bug: none
Change-Id: Icb7ab728098a6cf29c0920da4b524e96a7c024c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2186411
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#766361}
2020-05-07 10:22:36 +00:00
Balazs Engedy
683d2c7a8f Revert "IWYU for browser_test.h."
This reverts commit 66a53c909a.

Reason for revert: Breaks compile on official branded builders.

Original change's description:
> IWYU for browser_test.h.
> 
> Include this directly in relevant test files.  This lets us convert the
> HAS_OUT_OF_PROC_TEST_RUNNER checks in this file and
> view_event_test_base.h into #errors, and force people to not even
> include this file in files that can't use it.
> 
> Bug: none
> Tbr: sky
> Change-Id: I86626099eb047eb53e8b3611de38ba6bebc01a0b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2136117
> Commit-Queue: Peter Kasting <pkasting@chromium.org>
> Reviewed-by: Scott Violet <sky@chromium.org>
> Reviewed-by: Lei Zhang <thestig@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#765923}

TBR=sky@chromium.org,pkasting@chromium.org,thestig@chromium.org

Change-Id: I4583916602404c310a93f571dd2c78645c6bd567
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: none
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2184132
Reviewed-by: Balazs Engedy <engedy@chromium.org>
Commit-Queue: Balazs Engedy <engedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#765931}
2020-05-06 10:36:40 +00:00
Peter Kasting
66a53c909a IWYU for browser_test.h.
Include this directly in relevant test files.  This lets us convert the
HAS_OUT_OF_PROC_TEST_RUNNER checks in this file and
view_event_test_base.h into #errors, and force people to not even
include this file in files that can't use it.

Bug: none
Tbr: sky
Change-Id: I86626099eb047eb53e8b3611de38ba6bebc01a0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2136117
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#765923}
2020-05-06 09:38:56 +00:00
Alex Gough
9ab468a6c3 Use enum class for service_manager::SandboxType.
Removes unused kNaClLoader (was PROCESS_TYPE_NACL_LOADER)
from Windows as these are in fact Ppapi (PPAPI) sandbox types.

Removes unused values from SandboxType enum and replaces default cases.

SandboxType is not used for iteration so these boundary values are removed
from the SandboxType enum.

The kInvalid SandboxType is retained as it is used as an error case in
a couple of places. It might be possible to remove this in the future.

This removes default cases from switch statements where it might make
sense to have a notification in future when new sandbox types are added.
In these cases the default case is replaced with all otherwise
unchecked cases, so retaining the existing behavior.

Change-Id: I76ffc8ae617f3f8fa9aa68236551ebcfa4cce32f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1938076
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Will Harris <wfh@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Alex Gough <ajgo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#723425}
2019-12-10 19:10:22 +00:00
Ken Rockot
b7201ce944 Move Utility process interfaces off Service Manager
These are now exposed to the ChildProcess BindReceiver API on the
UtilityProcessHost, via ChildThreadImpl::ExposeInterfacesToBrowser.

Bug: 977637
Change-Id: Ib214f80d9ec3ae1e54fb63a04f06be77fa6fb7c0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1903594
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#715367}
2019-11-14 19:56:46 +00:00
Greg Thompson
510c0ca3d7 Really disable UtilityProcessHostBrowserTest.LaunchElevatedProcessAndCrash.
It appears that this was supposed to have been disabled from initial
commit.

BUG=1001597
R=wfh@chromium.org

Change-Id: I28eafadc31d7a8416263c35dccba89f579fd84b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1876030
Auto-Submit: Greg Thompson <grt@chromium.org>
Reviewed-by: Will Harris <wfh@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708742}
2019-10-23 20:00:39 +00:00
Julie Jeongeun Kim
29cb9cb731 Convert TestService to new Mojo types
This CL converts TestServicePtr and TestServiceRequest
to new Mojo types.

It uses Remote, PendingReceiver and Receiver instead of
QueryableDataStorePtr, QueryableDataStoreRequest and Binding.

Bug: 955171
Change-Id: I61f3d6b66ac6f5faffe533800bbe482a2db772ce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1803948
Commit-Queue: Julie Kim <jkim@igalia.com>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Oksana Zhuravlova <oksamyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697068}
2019-09-17 02:58:35 +00:00
Sami Kyostila
8e4d5a915e content/browser: Always specify thread affinity when posting tasks
*** Note: There is no behavior change from this patch. ***

The PostTask APIs will shortly be changed to require all tasks to explicitly
specify their thread affinity, i.e., whether the task should run on the thread
pool or a specific named thread such as a BrowserThread. This patch updates all
call sites with thread affinity annotation. We also remove the "WithTraits"
suffix to make the call sites more readable.

Before:

    // Thread pool task.
    base::PostTaskWithTraits(FROM_HERE, {...}, ...);

    // UI thread task.
    base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI, ...}, ...);

After:

    // Thread pool task.
    base::PostTask(FROM_HERE, {base::ThreadPool(), ...}, ...);

    // UI thread task.
    base::PostTask(FROM_HERE, {BrowserThread::UI, ...}, ...);

This patch was semi-automatically prepared with these steps:

    1. Patch in https://chromium-review.googlesource.com/c/chromium/src/+/1635827
       to make thread affinity a build-time requirement.
    2. Run an initial pass with a clang rewriter:
       https://chromium-review.googlesource.com/c/chromium/src/+/1635623
    3. ninja -C out/Debug | grep 'requested here' | cut -d: -f1-3 | sort | \
           uniq > errors.txt
    4. while read line; do
         f=$(echo $line | cut -d: -f 1)
         r=$(echo $line | cut -d: -f 2)
         c=$(echo $line | cut -d: -f 3)
         sed -i "${r}s/./&base::ThreadPool(),/$c" $f
       done < errors.txt
    5. GOTO 3 until build succeeds.
    6. Remove the "WithTraits" suffix from task API call sites:

       $ tools/git/mffr.py -i <(cat <<EOF
       [
         ["PostTaskWithTraits",                            "PostTask"],
         ["PostDelayedTaskWithTraits",                     "PostDelayedTask"],
         ["PostTaskWithTraitsAndReply",                    "PostTaskAndReply"],
         ["CreateTaskRunnerWithTraits",                    "CreateTaskRunner"],
         ["CreateSequencedTaskRunnerWithTraits",           "CreateSequencedTaskRunner"],
         ["CreateUpdateableSequencedTaskRunnerWithTraits", "CreateUpdateableSequencedTaskRunner"],
         ["CreateSingleThreadTaskRunnerWithTraits",        "CreateSingleThreadTaskRunner"],
         ["CreateCOMSTATaskRunnerWithTraits",              "CreateCOMSTATaskRunner"]
       ]
       EOF
       )

This CL was uploaded by git cl split.

R=boliu@chromium.org, tsepez@chromium.org

Bug: 968047
Change-Id: I346372d16a3856186ea74d14e0dd8a12f7cacae5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1729589
Commit-Queue: Sami Kyöstilä <skyostil@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Auto-Submit: Sami Kyöstilä <skyostil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683554}
2019-08-02 12:45:05 +00:00
Reid Kleckner
c55cd149ff Revert "Shorten TRAP_SEQUENCE() to one instruction on most platforms."
This reverts commit ffe0185ea6.

Reason for revert: Causes test failures in official builds

Original change's description:
> Shorten TRAP_SEQUENCE() to one instruction on most platforms.
> 
> Previously, TRAP_SEQUENCE() consisted of:
> - an instruction to trigger a debugger breakpoint
> - an instruction to ensure fatal termination (usually encoded as an
>   illegal instruction)
> 
> But all that's really needed is the latter, so eliminate the
> instruction to trigger the debugger breakpoint.
> 
> Note: on Intel, the debugger breakpoint instruction (int3) is only one
> byte, while the fatal termination instruction (ud2) is two bytes.
> Unfortunately, crash reports seem to be indicating that int3 is
> non-fatal. Since it's important that TRAP_SEQUENCE() terminates, it
> cannot rely on int3.
> 
> Bug: 958675
> Change-Id: I84b3123b07a9871dbd3b062fd73e79137b1ef6dd
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1672227
> Reviewed-by: Mark Mentovai <mark@chromium.org>
> Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
> Commit-Queue: Daniel Cheng <dcheng@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#678065}

TBR=dcheng@chromium.org,alexmos@chromium.org,rsesek@chromium.org,mark@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 958675, 985138
Change-Id: Ib9c3d09f6b2a5dc182cb125f90a7d9130c98e5be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1713904
Reviewed-by: Reid Kleckner <rnk@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Reid Kleckner <rnk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#679787}
2019-07-23 00:38:17 +00:00
Daniel Cheng
ffe0185ea6 Shorten TRAP_SEQUENCE() to one instruction on most platforms.
Previously, TRAP_SEQUENCE() consisted of:
- an instruction to trigger a debugger breakpoint
- an instruction to ensure fatal termination (usually encoded as an
  illegal instruction)

But all that's really needed is the latter, so eliminate the
instruction to trigger the debugger breakpoint.

Note: on Intel, the debugger breakpoint instruction (int3) is only one
byte, while the fatal termination instruction (ud2) is two bytes.
Unfortunately, crash reports seem to be indicating that int3 is
non-fatal. Since it's important that TRAP_SEQUENCE() terminates, it
cannot rely on int3.

Bug: 958675
Change-Id: I84b3123b07a9871dbd3b062fd73e79137b1ef6dd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1672227
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#678065}
2019-07-17 01:07:39 +00:00
Clark DuVall
a6a3233f72 Remove unused UtilityProcessHostClient
Nobody has used this for years, so it should be safe to remove.

Change-Id: I59d361640801e2677a16f0b80be21b41296d2c91
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1655979
Auto-Submit: Clark DuVall <cduvall@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#668507}
2019-06-12 18:56:02 +00:00
Vasilii Sukhanov
96369af38c Disable UtilityProcessHostBrowserTest.LaunchElevatedProcess
TBR=wfh@chromium.org

Bug: 927298
Change-Id: Ifb053d49ab15d08af0b80ffca0f3ef4089b41d38
Reviewed-on: https://chromium-review.googlesource.com/c/1448180
Reviewed-by: Vasilii Sukhanov <vasilii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#627926}
2019-01-31 13:38:33 +00:00
Will Harris
c67f8bc96d Re-enable UtilityProcessHostBrowserTest.LaunchProcess without tracking launches.
As stated in BrowserChildProcessHostImpl::OnChildDisconnected:

"OnChildDisconnected may be called without OnChannelConnected, so stop the
early exit watcher so GetTerminationStatus can close the process handle"

This test previously did not take this into account and always expected a
connected notification before a disconnected notification, so the test can
be fixed by just removing this assumption.

BUG=879555

Change-Id: I68ce0d27765a6b5387d57bf7af10b84c8fb240ac
Reviewed-on: https://chromium-review.googlesource.com/c/1286910
Reviewed-by: Will Harris <wfh@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601294}
2018-10-19 21:04:37 +00:00
Eric Seckler
8652dcd5d8 content: Replace uses of BrowserThread task posting with post_task.h API
This patch updates callsites of BrowserThread task posting methods to
use the post_task.h API instead.

Background: We're changing the way tasks are posted to a BrowserThread,
see PSA [1] and design doc [2]. This unifies the way tasks are posted
and paves the way for annotating tasks with task types and other
attributes that can be used to prioritize tasks in the future browser
UI thread scheduler (design doc [3]).

This CL changes callsites of the following forms:
(a) BrowserThread::Post*Task(BrowserThread::UI/IO, ..) to
    base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI/IO}, ..),
(b) BrowserThread::GetTaskRunnerForThread(BrowserThread::UI/IO) to
    base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI/IO}).

It also adds necessary includes. These mechanical changes were applied
by a script.

Tasks posted with the same BrowserThread::ID trait (via
PostTaskWithTraits or TaskRunners obtained from
Create*TaskRunnerWithTraits) will still execute in the order they
were posted, see [4].

[1] https://groups.google.com/a/chromium.org/d/topic/chromium-dev/A3_snMVXv8A/discussion
[2] https://docs.google.com/document/d/1SGy9VTXUwyXEX_yBZ0ukFAnS8B0hDeMUJD-1iALaE-Q/edit?usp=sharing
[3] https://docs.google.com/document/d/1z1BDq9vzcEpkhN9LSPF5XMnZ0kLJ8mWWkNAi4OI7cos/edit?usp=sharing
[4] https://cs.chromium.org/chromium/src/base/task/post_task.h?l=66

TBR=achuith@chromium.org, afakhry@chromium.org, agl@chromium.org, avi@chromium.org, bbudge@chromium.org, bengr@chromium.org, benwells@chromium.org, bnc@chromium.org, calamity@chromium.org, ccameron@chromium.org, chiniforooshan@chromium.org, cjgrant@chromium.org, cmumford@chromium.org, csharrison@chromium.org, dalecurtis@chromium.org, delphick@chromium.org, dgozman@chromium.org, dmazzoni@chromium.org, droger@chromium.org, dschuff@chromium.org, dullweber@chromium.org, erikchen@chromium.org, felt@chromium.org, fgorski@chromium.org, gogerald@chromium.org, groby@chromium.org, horo@chromium.org, imcheng@chromium.org, jcivelli@chromium.org, jianli@chromium.org, jinho.bang@samsung.com, jkarlin@chromium.org, jochen@chromium.org, kinuko@chromium.org, lazyboy@chromium.org, lpy@chromium.org, markusheintz@chromium.org, mattcary@chromium.org, maxmorin@chromium.org, miu@chromium.org, mkwst@chromium.org, mmenke@chromium.org, mpearson@chromium.org, msramek@chromium.org, nick@chromium.org, nparker@chromium.org, nyquist@chromium.org, peter@chromium.org, pwnall@chromium.org, qinmin@chromium.org, rbpotter@chromium.org, rdevlin.cronin@chromium.org, rouslan@chromium.org, scottmg@chromium.org, servolk@chromium.org, skuhne@chromium.org, sky@chromium.org, tapted@chromium.org, tbansal@chromium.org, thestig@chromium.org, tommi@chromium.org, tommycli@chromium.org, torne@chromium.org, tschumann@chromium.org, vabr@chromium.org, vakh@chromium.org, waffles@chromium.org, yfriedman@chromium.org, zmo@chromium.org, bartfab@chromium.org

Bug: 878356
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:linux_vr;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I37526c8e75630ee7bec29421276094a30e903894
Reviewed-on: https://chromium-review.googlesource.com/1186623
Reviewed-by: Eric Seckler <eseckler@chromium.org>
Reviewed-by: Vaclav Brozek <vabr@chromium.org>
Reviewed-by: Alex Clarke <alexclarke@chromium.org>
Reviewed-by: Sami Kyöstilä <skyostil@chromium.org>
Commit-Queue: Eric Seckler <eseckler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592750}
2018-09-20 10:42:28 +00:00
inglorion
b7c3f6a2c0 Disable flaky UtilityProcessHostBrowserTest.LaunchProcessAndCrash on Windows
content_browsertests UtilityProcessHostBrowserTest.LaunchProcessAndCrash is
flaky on Windows. Disabling the test so that it doesn't cause build bots to
be red on non-breaking changes.

Bug: 879555
Change-Id: If2aff8e69d240adf09173b82472db6c86eb6aa91
Reviewed-on: https://chromium-review.googlesource.com/1227303
Reviewed-by: Will Harris <wfh@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Reid Kleckner <rnk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592216}
2018-09-18 21:53:36 +00:00
Will Harris
ffe7466328 Add tests for BrowserChildProcessObserver crash notifications.
Also, add tests for launches too, since this wasn't really tested
anywhere before.

BUG=767906

Change-Id: Ibdd39584a2637986590183458ca3e1fbe7874c13
Reviewed-on: https://chromium-review.googlesource.com/1086225
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565189}
2018-06-07 05:16:29 +00:00
Will Harris
edb011f9c5 Set a consistent browser child process name for metrics.
Add new "metrics name" which is non-localized and will be used for
recording metrics for child processes. The name is taken from the
mojo service name for mojo processes, or can be custom set.

BUG=767906

Change-Id: Ibcfa314fe4c475256f76a4369d17e63e32050195
Reviewed-on: https://chromium-review.googlesource.com/1072789
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#563777}
2018-06-01 20:28:44 +00:00
Jay Civelli
14aced2aea Make UtilityProcessHost non public
Removes UtilityProcessHost from content/public and renames
UtilityprocessHostImpl to UtilityProcessHost.
Now that all use cases of UtilityProcessHost have been replaced by
using services (but for the PowerMonitor browser tests), this will
prevent further forking of process bypassing the service manager.

Bug: 775677
Change-Id: I2107271a54e4ab3141102a5c4fbcce4ea21915dd
Reviewed-on: https://chromium-review.googlesource.com/961496
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Commit-Queue: Jay Civelli <jcivelli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543238}
2018-03-14 23:44:33 +00:00