0
Commit Graph

58 Commits

Author SHA1 Message Date
Mark Rowe
57186b30ac [Mac] Validate the identity of the network service process
Add the ability to specify a `ProcessRequirement` in `LaunchOptions`
that will be passed down to `MachPortRendezvousServer`. Use it within
`UtilitySandboxedProcessLauncherDelegate` to ensure that the process
hosting the network service is signed with the same signing identity as
the browser process before it can initiate a Mojo connection. This
prevents a local attacker from replacing the utility process executable
on disk to gain access to the key used to encrypt cookies.

This is gated by a feature flag and will be rolled out via Finch to
ensure there is no impact to stability and performance.

Bug: 362301042
Change-Id: I16c6a1349a8d3a8a47a1b90f0a86526ef90235b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5924750
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Will Harris <wfh@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Commit-Queue: Mark Rowe <markrowe@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1368564}
2024-10-15 02:30:18 +00:00
Brendon Tiszka
254cb73c71 Reland "Unoptimize base::ImmediateCrash in non-official builds"
This is a reland of commit a16893d1f9

Reasons for reland:
* This fixes a problem where some Android builds experienced a
  failure in immediate_crash_unittest.cc where the test was unable
  to find a return instruction - this is just a test code change.
* This switches back to the previous TRAP_SEQUENCE mechanism on Windows,
  because otherwise we see an abort/retry/ignore dialog on Windows
  which disrupts automated testing.

Original change's description:
> Unoptimize base::ImmediateCrash in non-official builds
>
> This CL creates an unoptimized path in `base::ImmediateCrash` that
> calls `std::abort` instead of sigtrap (default path) and exit
> (fuzzing builds). This allows ASAN to catch and symbolize crashes
> that are caused by CHECKs. Before this CL we were failing to conform
> to multiple tools:
> * libFuzzer had an atexit handler so stack traces were symbolized
>   most of the time (more context in the thread).
> * centipede doesn't have an atexit handler so things were never
>   symbolized.
> * chrome with asan crashed with SIGTRAP on linux which ASAN doesn't
>   handle or have an ASAN_OPTION for.
> * more context here https://issues.chromium.org/issues/40948553#comment45
>
> Low-Coverage-Reason: COVERAGE_UNDERREPORTED the uncovered lines are after the abort, so don't really exist
> Cq-Include-Trybots: luci.chromium.try:linux-centipede-asan-rel,win-libfuzzer-asan-rel,linux-libfuzzer-asan-rel,win-official
> Bug: 40948553, 349781043, 349414737, 331770035, 40947114, 40287419
> Change-Id: Id370dd5e2d14c8b2af3e6617391dfc2a74439142
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5332940
> Reviewed-by: Peter Boström <pbos@chromium.org>
> Commit-Queue: Adrian Taylor <adetaylor@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Nasko Oskov <nasko@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1357569}

Bug: 40948553, 349781043, 349414737, 331770035, 40947114, 40287419
Change-Id: I467997d9399b5374204d6f2a2ba0dcf90e7ef25e
Cq-Include-Trybots: luci.chromium.try:linux-centipede-asan-rel,win-libfuzzer-asan-rel,linux-libfuzzer-asan-rel,win-official
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5882758
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Peter Boström <pbos@chromium.org>
Commit-Queue: Adrian Taylor <adetaylor@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1361151}
2024-09-27 15:17:08 +00:00
Adrian Taylor
11d26b01fd Revert "Unoptimize base::ImmediateCrash in non-official builds"
This reverts commit a16893d1f9.

Reason for revert: Seems to break two tests:
Android 32-bit: see https://chromium-review.googlesource.com/c/chromium/src/+/5872760
Windows ProcessGTestOutputTest.FoundTestCaseNotEnforced: failing for reasons not yet fully understood, reverting while we investigate

Original change's description:
> Unoptimize base::ImmediateCrash in non-official builds
>
> This CL creates an unoptimized path in `base::ImmediateCrash` that
> calls `std::abort` instead of sigtrap (default path) and exit
> (fuzzing builds). This allows ASAN to catch and symbolize crashes
> that are caused by CHECKs. Before this CL we were failing to conform
> to multiple tools:
> * libFuzzer had an atexit handler so stack traces were symbolized
>   most of the time (more context in the thread).
> * centipede doesn't have an atexit handler so things were never
>   symbolized.
> * chrome with asan crashed with SIGTRAP on linux which ASAN doesn't
>   handle or have an ASAN_OPTION for.
> * more context here https://issues.chromium.org/issues/40948553#comment45
>
> Low-Coverage-Reason: COVERAGE_UNDERREPORTED the uncovered lines are after the abort, so don't really exist
> Cq-Include-Trybots: luci.chromium.try:linux-centipede-asan-rel,win-libfuzzer-asan-rel,linux-libfuzzer-asan-rel,win-official
> Bug: 40948553, 349781043, 349414737, 331770035, 40947114, 40287419
> Change-Id: Id370dd5e2d14c8b2af3e6617391dfc2a74439142
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5332940
> Reviewed-by: Peter Boström <pbos@chromium.org>
> Commit-Queue: Adrian Taylor <adetaylor@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Nasko Oskov <nasko@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1357569}

Bug: 40948553, 349781043, 349414737, 331770035, 40947114, 40287419
Change-Id: I821887501b803330e4f5bc4be1676404ce6a4566
Cq-Include-Trybots: luci.chromium.try:linux-centipede-asan-rel,win-libfuzzer-asan-rel,linux-libfuzzer-asan-rel,win-official
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5873253
Commit-Queue: Ian Wells <iwells@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Ian Wells <iwells@chromium.org>
Auto-Submit: Adrian Taylor <adetaylor@chromium.org>
Owners-Override: Ian Wells <iwells@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1357650}
2024-09-19 16:29:37 +00:00
Brendon Tiszka
a16893d1f9 Unoptimize base::ImmediateCrash in non-official builds
This CL creates an unoptimized path in `base::ImmediateCrash` that
calls `std::abort` instead of sigtrap (default path) and exit
(fuzzing builds). This allows ASAN to catch and symbolize crashes
that are caused by CHECKs. Before this CL we were failing to conform
to multiple tools:
* libFuzzer had an atexit handler so stack traces were symbolized
  most of the time (more context in the thread).
* centipede doesn't have an atexit handler so things were never
  symbolized.
* chrome with asan crashed with SIGTRAP on linux which ASAN doesn't
  handle or have an ASAN_OPTION for.
* more context here https://issues.chromium.org/issues/40948553#comment45

Low-Coverage-Reason: COVERAGE_UNDERREPORTED the uncovered lines are after the abort, so don't really exist
Cq-Include-Trybots: luci.chromium.try:linux-centipede-asan-rel,win-libfuzzer-asan-rel,linux-libfuzzer-asan-rel,win-official
Bug: 40948553, 349781043, 349414737, 331770035, 40947114, 40287419
Change-Id: Id370dd5e2d14c8b2af3e6617391dfc2a74439142
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5332940
Reviewed-by: Peter Boström <pbos@chromium.org>
Commit-Queue: Adrian Taylor <adetaylor@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1357569}
2024-09-19 13:42:58 +00:00
Peter Boström
8472105d01 Use NOTREACHED_IN_MIGRATION() in content/
This was generated by replacing "  NOTREACHED()" with
"  NOTREACHED_IN_MIGRATION()" and running git cl format.

This prepares for making NOTREACHED() [[noreturn]] alongside
NotReachedIsFatal migration of existing inventory.

Bug: 40580068
Change-Id: I3b48b89911ac5e9ffcb211622992f917f8f9e8d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5539619
Auto-Submit: Peter Boström <pbos@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1301096}
2024-05-15 04:36:02 +00:00
Alison Gale
770f3fce37 Migrate TODOs referencing old crbug IDs to the new issue tracker IDs
The canonical bug format is TODO(crbug.com/<id>). TODOs of the
following forms will all be migrated to the new format:

- TODO(crbug.com/<old id>)
- TODO(https://crbug.com/<old id>)
- TODO(crbug/<old id>)
- TODO(crbug/monorail/<old id>)
- TODO(<old id>)
- TODO(issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/<old id>)
- TODO(https://issues.chromium.org/u/1/issues/<old id>)
- TODO(bugs.chromium.org/<old id>)

Bug id mapping is sourced from go/chrome-on-buganizer-prod-issues.
See go/crbug-todo-migration for details.

#crbug-todo-migration

Bug: b/321899722
Change-Id: Ibc66b8c440e4bcdef414e77fef4d9874d2ea9951
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5493800
Auto-Submit: Alison Gale <agale@chromium.org>
Commit-Queue: Alison Gale <agale@chromium.org>
Reviewed-by: Peter Boström <pbos@chromium.org>
Owners-Override: Alison Gale <agale@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1293330}
2024-04-27 00:39:58 +00:00
Takuto Ikuta
c8d6b16f02 format windows headers using new config.
Test new config:
https://chromium-review.googlesource.com/c/chromium/src/+/5197064

by applying clang-format on every problematic windows headers.

This CL is cloned from https://crrev.com/c/5366045.

Script:
-------

```
function replace {
    echo "Replacing $1 by $2"
    git grep -l "$1" \
        | cut -f1 -d: \
        | grep \
              -e "\.h" \
              -e "\.cc" \
        | grep -v "third_party/[^b]" \
        | sort \
        | uniq \
        | xargs sed -i "s/$1/$2/gi"
}

git checkout origin/main
git branch -D change-5197064 || true

git new-branch change-5197064
replace "#include <\(initguid|mmdeviceapi\|windows\|winsock2\|ws2tcpip\|shobjidl\|atlbase\|ole2\|unknwn\|objbase\|tchar\).h>" ""
replace "#include \"base\\/win\\/atl.h\"" ""
replace "#include <uiautomation.*>" ""
git add -u
git commit -m "remove problematic windows headers"
git revert HEAD --no-commit
git add -u
git commit -m "add problematic windows headers"
git cl format --upstream=HEAD~
git add -u
git commit -m "format"

git cl issue 5367127
git cl upload -df --bypass-hook
```

Also removed some unnecessary comments.

Bug: 329138753
Change-Id: I161c28ea2d27c569825e0c789a4c143530937f58
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5367127
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Owners-Override: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1287420}
2024-04-15 16:59:19 +00:00
Md Hasibul Hasan
a963a934b5 Convert base::StringPiece to std::string_view in content/browser
The changes of this CL are made using the following script.

```
target_directory="content/browser"
replace_string_in_files() {
  old_string="$1"
  new_string="$2"

  find "$target_directory" -type f \( -name "*.cc" -o -name "*.h" \) \
      -exec sed -i '' "s/$old_string/$new_string/g" {} +
}

delete_include() {
    find "$target_directory" \( -name "*.h" -o -name "*.cc" \) -print0 | while IFS= read -r -d '' file; do
        grep -v '#include "base/strings/string_piece.h"' "$file" > "$file.tmp" && mv "$file.tmp" "$file"
    done
}

add_include() {
    find "$target_directory" \( -name "*.h" -o -name "*.cc" \) -print0 | while IFS= read -r -d '' file; do
        local include_added=false
        local tempfile=$(mktemp)

        if grep -qE 'std::(string|u16string)_view' "$file"; then
            while IFS= read -r line; do
                echo "$line" >> "$tempfile"
                if [[ $line =~ ^\s*#include ]]; then
                    if ! $include_added; then
                        echo "#include <string_view>" >> "$tempfile"
                        include_added=true
                    fi
                fi
            done < "$file"

            mv "$tempfile" "$file"

            if $include_added; then
                echo "Added #include <string_view> after the first include line in $file"
            else
                echo "No include line found in $file"
            fi
        else
            echo "std::string_view not found in $file"
        fi
    done
}

replace_string_in_files "base::StringPiece16" "std::u16string_view"
replace_string_in_files "base::StringPiece" "std::string_view"
delete_include
add_include
```

Replaced base::StringPiece16 with std::u16string_view
Replaced base::StringPiece with std::string_view
Removed header "base/strings/string_piece.h"
Added header "<string_view>" where applicable

Bug: 40506050
Change-Id: I2bc22c79dd9a0c839745afe065123f7a53c4a5ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5401117
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1281746}
2024-04-03 10:15:14 +00:00
Xinan Lin
9266502b26 Fix LaunchProcessAndCrash in windows official testers
LaunchProcessAndCrash has been failing on windows official build:
https://ci.chromium.org/ui/test/chrome/ninja%3A%2F%2Fcontent%2Ftest%3Acontent_browsertests%2FUtilityProcessHostBrowserTest.LaunchProcessAndCrash?q=V%3Atest_suite%3Dcontent_browsertests+

For release build(official=true and dcheck=false), the exit code for
LaunchProcessAndCrash is not EXCEPTION_BREAKPOINT but STATUS_STACK_BUFFER_OVERRUN.

BUG=40861868
TEST=local run

Change-Id: I1dea6e489efd36266d15f1c75bf69b7641078374
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5392110
Reviewed-by: Will Harris <wfh@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Xinan Lin <linxinan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1278583}
2024-03-26 20:56:06 +00:00
Austin Sullivan
07879856d0 Code Health: Use span variant of base::ReadFromFd
The variant which passes a char* + offset is being removed

This CL is split from https://crrev.com/c/5168849

This CL was uploaded by git cl split.

R=boliu@chromium.org

Bug: 1490484
Change-Id: Ibfa36afca3e7c70f661ee0efd40460c8a6b0a3ce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5178564
Reviewed-by: Bo Liu <boliu@chromium.org>
Commit-Queue: Bo Liu <boliu@chromium.org>
Auto-Submit: Austin Sullivan <asully@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1244609}
2024-01-09 12:48:33 +00:00
Ming-Ying Chung
c4e2cab71c [gardener] Disable flaky tests on ChromeOS
- UtilityProcessHostBrowserTest.FileDescriptorStore
- UtilityProcessHostBrowserTest.LaunchProcessAndCrash

Bug: 1511497
Change-Id: Idc8ecd5bd6159b4c158be0cd405c275c02d95474
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5119204
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Ming-Ying Chung <mych@chromium.org>
Reviewed-by: Taiyo Mizuhashi <taiyo@chromium.org>
Owners-Override: Ming-Ying Chung <mych@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1237400}
2023-12-14 06:38:17 +00:00
Pâris
e6361d070b Rename DanglingAcrossTasks to AcrossTasksDanglingUntriaged
Following up on https://chromium-review.googlesource.com/c/chromium/src/+/4567353/comments/67bd2f0d_b10f9056
Add back DanglingUntriaged into the name of this trait.
Keep the name consistent with other traits.

Change-Id: I2702f843d9e81b87656ca31fd4c9ba19943d44d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4675808
Commit-Queue: Pâris Meuleman <pmeuleman@chromium.org>
Owners-Override: danakj <danakj@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1172247}
2023-07-19 09:00:43 +00:00
Pâris
508dce9dea Annotate all Across tasks dangling raw_ptrs
This follows up on https://crrev.com/c/4567353 and annotates all
raw_ptrs that were detected as dangling across tasks on the CQ in the
following CL https://crrev.com/c/4166936.

Change-Id: I8ac81276b72c315d7624008cf7421a419b7786ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4650611
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: Pâris Meuleman <pmeuleman@chromium.org>
Owners-Override: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1164246}
2023-06-29 18:23:48 +00:00
Ali Hijazi
6b14c6ac0e DanglingPtr: Mark all of them as untriaged [25/N]
Add the "DanglingUntriaged" raw_ptr annotation. It indicates a raw_ptr
becomes dangling, and it should be triaged/fixed. This will also disable
dangling detection for those pointers, once enabled.

These were identified by running the CQ bots with DPD activated (both
build + runtime here: https://crrev.com/c/3941825)

Bug: 1291138
Change-Id: I3af7e2ff2aa4400424300e95e1544f4c59d264c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4303178
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Owners-Override: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1112962}
2023-03-03 20:49:24 +00:00
Matthew Denton
ab0ccd578e Linux: Fix exec'd process's use of base::FileDescriptorStore
See crbug.com/1407326. This fixes (1) and adds a test to
utility_process_host_browsertest.cc to ensure that this works in the
future when exec'ing a process (i.e. not launching from a zygote).

Bug: 692619, 1407326
Change-Id: I334400ebefac116611d3fc93d5ff5a7d83908eb7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4159897
Commit-Queue: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Auto-Submit: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1104132}
2023-02-11 00:11:59 +00:00
Arthur Sonzogni
fdfe5e525d Fix dangling pointer in UtilityProcessHostBrowserTest
A dangling pointer was introduced by:
https://chromium-review.googlesource.com/c/chromium/src/+/4166816
See FYI bot:
https://ci.chromium.org/ui/p/chromium/builders/ci/linux-backuprefptr-x64-fyi-rel/13170/blamelist

The `host_` is "owned" by the content main loop, via a global list.
The content main loop is "owned" by the test.

It would be a UAF using the `host_` pointer after the end of the loop.
It must be reset.

Bug: 1411101,1291138
Change-Id: Ia5fca30c9afd80a9e9daf338155ff7d880ab3c71
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4202489
Reviewed-by: Paul Semel <paulsemel@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1098538}
2023-01-30 12:14:06 +00:00
Matthew Denton
e669d60181 Reland "Linux: Fix zygote's use of base::FileDescriptorStore"
This is a reland of commit 2548a5c354

Compared to the original CL, this fixes the use of an uninit variable in
child_process_launcher_helper_posix.cc (region should be initialized to
kWholeFile if passing a file descriptor to the new process).

Original change's description:
> Linux: Fix zygote's use of base::FileDescriptorStore
>
> See crbug.com/1407326. This fixes (2) and adds a test to
> utility_process_host_browsertest.cc to ensure that this works in the
> future, with both the unsandboxed and the generic zygote.
>
> Unfortunately base::FileDescriptorStore still doesn't work on Android,
> so add a bug and a TODO to fix that.
>
> Bug: 692619, 1407326
>
> Change-Id: I83ecbb1ec84b36c55ed954acdbab890cb8f55862
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4166816
> Reviewed-by: Tom Sepez <tsepez@chromium.org>
> Commit-Queue: Matthew Denton <mpdenton@chromium.org>
> Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1095906}

Bug: 692619, 1407326
Change-Id: Iad498b2949f4cc29d683f20cd4711fe2d4403656
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4191378
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1096462}
2023-01-24 22:56:15 +00:00
Olesia Marukhno
93ecd6f4c8 Revert "Linux: Fix zygote's use of base::FileDescriptorStore"
This reverts commit 2548a5c354.

Reason for revert: The added tests are consistently failing on Linux ChromiumOS MSan Tests (https://ci.chromium.org/p/chromium/builders/ci/Linux%20ChromiumOS%20MSan%20Tests) and Linux MSan Tests (https://ci.chromium.org/p/chromium/builders/ci/Linux%20MSan%20Tests)

Original change's description:
> Linux: Fix zygote's use of base::FileDescriptorStore
>
> See crbug.com/1407326. This fixes (2) and adds a test to
> utility_process_host_browsertest.cc to ensure that this works in the
> future, with both the unsandboxed and the generic zygote.
>
> Unfortunately base::FileDescriptorStore still doesn't work on Android,
> so add a bug and a TODO to fix that.
>
> Bug: 692619, 1407326
>
> Change-Id: I83ecbb1ec84b36c55ed954acdbab890cb8f55862
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4166816
> Reviewed-by: Tom Sepez <tsepez@chromium.org>
> Commit-Queue: Matthew Denton <mpdenton@chromium.org>
> Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1095906}

Bug: 692619, 1407326
Change-Id: Iee9c562cc556bfca09b1541e602d94d102d4da88
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4188677
Owners-Override: Olesia Marukhno <olesiamarukhno@google.com>
Commit-Queue: Olesia Marukhno <olesiamarukhno@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1096074}
2023-01-24 09:31:24 +00:00
Matthew Denton
2548a5c354 Linux: Fix zygote's use of base::FileDescriptorStore
See crbug.com/1407326. This fixes (2) and adds a test to
utility_process_host_browsertest.cc to ensure that this works in the
future, with both the unsandboxed and the generic zygote.

Unfortunately base::FileDescriptorStore still doesn't work on Android,
so add a bug and a TODO to fix that.

Bug: 692619, 1407326

Change-Id: I83ecbb1ec84b36c55ed954acdbab890cb8f55862
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4166816
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1095906}
2023-01-23 23:49:13 +00:00
Avi Drissman
adac219925 Update header includes for /base/functional in /content
bind.h, callback.h, callback_forward.h, and callback_helpers.h
moved into /base/functional/. Update the include paths to
directly include them in their new location.

Bug: 1364441
Change-Id: I32ec425b9c0e52ec4b50047bf3290fecc5c905ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4148554
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1091567}
2023-01-11 23:46:39 +00:00
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