0
Commit Graph

2166 Commits

Author SHA1 Message Date
Tom Sepez
67e9e6e83e Convert FuzzerClientListener::last_message_ to unique_ptr<>
Avoid using raw_ptr<> for an owned reference.

Change-Id: I0eeb51307c8376576c931b8b1a9d9d6d78c51c46
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4408264
Reviewed-by: Ken Rockot <rockot@google.com>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1128827}
2023-04-11 19:39:54 +00:00
Tom Sepez
93b5e8e549 Convert PendingSyncMsg::done_event to std::unique_ptr<>
Follow-on from https://crrev.com/c/4397638, clarifies ownership
of the done event

Change-Id: I530ec00faec823841b93c727e10d8ccb706e13f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4401308
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1128270}
2023-04-10 19:10:44 +00:00
Tom Sepez
55354070d4 Convert PendingSyncMessage::deserializer to std::unique_ptr<>
Follow-on from https://crrev.com/c/4397638, clarifies ownership
of the deserializer.

Change-Id: I2af0a2c42bbc3fe3091254a3d3a72d81756350f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4400765
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Derek Schuff <dschuff@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1127251}
2023-04-06 16:58:46 +00:00
Tom Sepez
ef8e7cd826 Rework base new/delete in ipc_sync_channel.cc
Use owned references in place of raw_ptr. It is unclear why this
isn't giving dangling ptr warnings, though.

Change-Id: I55bd4ac5df53a79612c97c442673b475a8fa812a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4400072
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1126754}
2023-04-05 19:30:17 +00:00
Tom Sepez
b7f23c4d34 Remove DanglingUntriaged from PendingSyncMsg
Per docs/dangling_ptr_guide.md, invoke `ClearAndDelete()` on
members rather than passing them to a bare `delete`.

- Use reference to avoid copy-constructing additional dangling ptrs.
- Use default member init and pack tighter on 64 bit platforms.

Change-Id: Id2153f092624f2ff76b3566b4a493cffd65d266e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4397638
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1126738}
2023-04-05 19:06:35 +00:00
Dave Tapuska
4475e0aa34 [ios] Enable building of ipc_unittests and event_unittests
event_unittests depends on ipc:test_support so we enable
both of these tests at the same time.

Bug: 1411704
Change-Id: I32e0fe69fd1cb3c607b9168179c0d58f2e8b70d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4398210
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/main@{#1126042}
2023-04-04 16:34:29 +00:00
Keishi Hattori
2b0ea1fb52 Rewrite ChannelProxy::outgoing_message_filter_ to raw_ptr
Change-Id: Idd69b91bbff5f9f4aefcfbc2a141207becdddfef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4393744
Owners-Override: Keishi Hattori <keishi@chromium.org>
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Reviewed-by: Bartek Nowierski <bartekn@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1125226}
2023-04-03 08:22:35 +00:00
Keishi Hattori
7fe63cb753 Additional raw_ptr rewrites for linux
Additional raw_ptr rewrites required to enable clang plugin check

Bug: 1273182
Change-Id: I2779cb82fed6ab727211a4cc8b578c32eec0528d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4387673
Owners-Override: Keishi Hattori <keishi@chromium.org>
Reviewed-by: Bartek Nowierski <bartekn@chromium.org>
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1124572}
2023-03-31 04:59:55 +00:00
Peter Kasting
525a01446e Use thread_local: ipc/
Bug: 1416710
Change-Id: Ie2d356ba778be1424c99ff8094f45290a15a01ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4318344
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/main@{#1114795}
2023-03-08 21:56:27 +00:00
Claudio DeSouza
c537f85dff Making pickle friendly to base::span
This CL adjust the return type of Pickle::data() to be more friendly to
base::span. It also offers are casting helper, called data_as(), to
allow users of data to consume it as different types, in a more
ergonomic way.

Additionally, Pickle::ReadData is being changed to avoid the use of out
params, and rather provide its data through the return type.

Bug: 1420355
Change-Id: I0bfba0be3537285e08c301ce1dd137c4b5d9a9b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4298216
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Claudio DeSouza <cdesouza@igalia.com>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1112314}
2023-03-02 18:42:52 +00:00
Ken Rockot
dd70bafb49 MojoIpcz: Enable by default for most platforms
This enables MojoIpcz by default for most platforms, with or without an
initialized FeatureList.

Not enabled on macOS since that's controlled by an ongoing Finch
experiment. Not enabled on Chrome OS since that's delayed until some
more work can be done on the Chrome OS side.

This also fixes several small issues around the tree which were
surfaced by the Mojo impl change:

- ipc_tests and chrome_cleaner_unittests properly configure
  broker/non-broker processes
- some blob storage tests pump tasks on teardown to avoid new leaks
- a now-invalid Mojo Java test has been deleted
- a global tracking table has added for internal ipcz API objects
  and MojoIpcz driver objects to avoid LSan detection of existing
  leaks in various test suites around the tree.
- stricter enforcement of platform handle serialization to
  avoid situations where non-optional platform handle fields
  were accepting null platform handles
- fixes to chrome_cleaner, and gfx tests, to address bad
  platform handle usage
- fix to TransferableSocket mojom to make the internal handle
  optional, since that's how it's used in practice.

Bug: 1299283,1415046
Change-Id: Ied45f4ac1c64753d204695f08852352d34aa367b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4240555
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Reviewed-by: Joe Mason <joenotcharles@google.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/main@{#1105863}
2023-02-15 21:01:54 +00:00
Dave Tapuska
ae8b22dce8 [ios] Separate the test sink into a separate library
- Do not build all the ipc unittests for iOS since they largely require
multiprocess support.
- Separate the one file content/test needs out into a separate library

Bug: 1411704
Change-Id: I7edb42c18d1ad0a39001f33fa58bf6664b991999
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4240998
Reviewed-by: Ken Rockot <rockot@google.com>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1104324}
2023-02-12 17:28:10 +00:00
Will Harris
e61641f724 Enable explicit conversion checks for base::span sizes.
This CL adds compile-time checks that the size parameter passed
to base::span either by the constructor or the base::make_span
function will fit into a size_t type and are not unsigned.

This is achieved by use of base::StrictNumeric parameter to the
methods and constructor.

This has no runtime overhead, as the checks are done at compile
time.

This CL also contains all the remaining mechanical changes needed
to convert signed numeric literal values to unsigned by adding
a 'u' on the end. Any functional or more complex changes have
already landed in other CLs tagged to this bug with separate
owner review.

This CL also adds no-compile tests for the new APIs.

BUG=1385166

Change-Id: Ic2dbd950842dd811a8dc40ac539c8b824ed983a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4219636
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Owners-Override: danakj <danakj@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Commit-Queue: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1102320}
2023-02-07 19:35:02 +00:00
Antonio Gomes
d854cdd6aa [ios] Build ipc target when use_blink is enabled
This fixes the following linking error, when build
`blink_platform_unittests` target:

ninja: Entering directory `out/Release-iphonesimulator'
[1/231] LINK obj/third_party/blink/renderer/platform/arm64/blink_platform_unittests
FAILED: obj/third_party/blink/renderer/platform/arm64/blink_platform_unittests
(..)
ld64.lld: error: undefined symbol:
  IPC::<class>::~ScopedAllowOffSequenceChannelAssociatedBindings()
    referenced by command_buffer_proxy_impl.cc:144

BUG=1411704,1411461
R=dtapuska@chromium.org, tsepez@chromium.org

Change-Id: I125b08336a95583bb2c3888284f72659672239a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4227762
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Auto-Submit: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1102211}
2023-02-07 17:15:56 +00:00
Antonio Gomes
739f57489c Adapt missing //content, //services, //t_p/blink to GN use_blink flag
BUG=1411704
R=dtapuska@chromium.org

Change-Id: I7e21ec58de034bf3fb0407d2d8422a737c2b338a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4220335
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Wenbin Zhang <wenbinzhang@google.com>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1101164}
2023-02-03 20:23:35 +00:00
Dominic Farolino
3ff421c103 IPC: Fix flaky IPC unit test
For thread API conformance, a base::Thread must be
started/stopped/destructed on the same thread. For the IPC unit tests,
the IPC thread is created on the "listener" thread, and the CL
https://crrev.com/c/4116950 was created to ensure that the IPC thread
was also stopped/destroyed on the "listener" thread as well.

However, that CL introduced a race condition. The flow is like so:
  1. Main thread attempts to shut down, but must block on the listener
     thread, so it posts a task to the listener thread to finish up and
     notify a sync wait event (for the listener thread) that the main
     thread "waits" on
  2. Listener thread must destroy the IPC thread, so it creates a sync
     event and posts a task to the IPC thread to finish up and notify
     the sync event
  3. IPC thread finishes itself up, notifies the IPC event (that the
     listener thread is waiting for) and then posts another task back to
     the listener thread to notify the event (that the main thread is
     waiting on) that it is finished
  4. Back on the listener thread, which is now ublocked by the IPC
     waitable event, the IPC thread is `reset()`/destructed

This means it is possible for the main thread to get notified about the
listener thread shutdown, at the same time the listener thread is
attempting to `reset()`/destroy the IPC thread, which is a race.

To fix this, we have to serialize the operations. The new flow is:
  1. Main thread attempts to shut down, and blocks on the listener
     thread's waitable event (just like before)
  2. Listener thread creates an IPC waitable event, and posts a task to
     the IPC thread to finish up and notify the IPC waitable event
  3. Only when the IPC thread is finished, does the listener thread
     destroy the IPC thread and notify the main thread that the listener
     thread is finally done

This gives us the guarantee that when the listener event is finally
unblocked, and the main thread continues destruction, the IPC
base::Thread has already been `reset()`/destroyed, and there is no race
in destruction.

R=rockot@google.com

Bug: 1411770
Change-Id: I8f98cbf62a78ea363c6c67dc17ed424ee33cde05
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4210470
Reviewed-by: Ken Rockot <rockot@google.com>
Commit-Queue: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/main@{#1099554}
2023-02-01 00:04:15 +00:00
Avi Drissman
d2a736f985 Remove base::Value::Type::DICTIONARY
It is deprecated in favor of base::Value::Type::DICT, so change uses
of it to the new name and remove the enum value.

Fixed: 1291670
Change-Id: I26136fcb723e7dff1f5ffe3990d7011b18c16a43
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4198081
Auto-Submit: Avi Drissman <avi@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1098238}
2023-01-28 02:31:26 +00:00
Andrew Williams
228be95c58 Rename UnguessableToken Deserialize2 to Deserialize
This CL is part of a series to update
base::UnguessableToken::Deserialize to return an
absl::optional instead of an "empty" token in the
case where deserialization fails.

Previous CLs:

0. Add UnguessableToken::Deserialize method that returns optional
    - https://chromium-review.googlesource.com/c/chromium/src/+/4133328

1. Replace UnguessableToken::Deserialize with CreateForTesting in tests
    - https://chromium-review.googlesource.com/c/chromium/src/+/4162456

2. Use new UnguessableToken::Deserialize method in most places
    - https://chromium-review.googlesource.com/c/chromium/src/+/4135540

3. Return absl::optional from FromJavaUnguessableToken
    - https://chromium-review.googlesource.com/c/chromium/src/+/4135783

4. Return absl::optional from UnmarshalUnguessableToken
    - https://chromium-review.googlesource.com/c/chromium/src/+/4133481

5. Use new UnguessableToken::Deserialize in CreateForTesting
    - https://chromium-review.googlesource.com/c/chromium/src/+/4143338

6. Remove the old UnguessableToken::Deserialize
    - https://chromium-review.googlesource.com/c/chromium/src/+/4143958

Bug: 1402549
Change-Id: I2fda3d36e48e6af9b1e90d5a4fa2b1003546057a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4193090
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Andrew Williams <awillia@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1097381}
2023-01-26 15:13:01 +00:00
Andrew Williams
c07db02056 Use new UnguessableToken::Deserialize method in most places
This CL moves existing calls of UnguessableToken::Deserialize
to use the replacement method that returns an absl::optional
instead of an UnguessableToken directly. Once all calls have
been moved, the previous method will be removed and the new
method will be renamed to finish replacement.

There are three remaining Deserialize calls that we will replace
in follow-up CLs:
 - `UnguessableTokenAndroid::FromJavaUnguessableToken` and
   `PlatformHandleInternal::FromJavaUnguessableToken`, since we
   will want these to return an absl::optional also

 - `UnguessableToken::CreateForTesting`, since we won't update
   that to return an absl::optional and will instead just crash
   if high == 0 and low == 0 get passed.

Bug: 1402549
Change-Id: Ibea1abd9e11716f11fb127a6c42c6bfc756b79d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4135540
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Andrew Williams <awillia@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1096142}
2023-01-24 13:38:52 +00:00
Keishi Hattori
834fd1c7b3 Add RAW_PTR_EXCLUSION to files in ipc/ media/
Add RAW_PTR_EXCLUSION to files in ipc/ media/ where the rewriter could not automatically rewrite.

Change was generated by processing the output of the rewriter.

Bug: 1273182
Change-Id: Ie25b66133c0e422f9e7c6bef601b518537c92684
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4173489
Owners-Override: Keishi Hattori <keishi@chromium.org>
Reviewed-by: Bartek Nowierski <bartekn@chromium.org>
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1094331}
2023-01-19 07:47:03 +00:00
Avi Drissman
cac43f2dde Update header includes for /base/functional in /h* and /i*
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: I275e051fd6e47be3446a9d7bdb17d5e6e5033338
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4157178
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: 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>
Cr-Commit-Position: refs/heads/main@{#1091610}
2023-01-12 00:58:41 +00:00
Daniel Cheng
e2e26eb6a1 Add more IPC security reviewers.
This helps increase converage, especially in some timezones that are
currently underserved:

- UTC-8 (bookholt)
- UTC-5 (dom)
- UTC+1 (arthursonzogni, clamy)
- UTC+9 (toyoshim)
- UTC+10 (ortuno)

Change-Id: I7cddcb163ccd2f831e9197516d6a5b81f788687f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4149854
Reviewed-by: Dominic Farolino <dom@chromium.org>
Reviewed-by: Alex Gough <ajgo@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Chris Bookholt <bookholt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1091128}
2023-01-11 01:11:27 +00:00
Sean Maher
e672a665ff task posting v3: remove includes of runner handles and IWYU task runners
Turns out there's a lot of includes, so these will have to be removed
before deleting the implementation of the task runner handles.

To allow the deletion of the task runner handle headers, add
the sequenced/thread task runner handles where they are used in
the codebase with scripts.

This was done with an automated change, with a few touchups afterwards.
The code for the mass-refactor changes are here:
python:
https://paste.googleplex.com/5534570878337024
shell:
https://paste.googleplex.com/6466750748033024

In terms of touchups:
- add sequenced/thread task runner handles to
  the third_party/blink/public/DEPS, because multiple files were using
  it transitively anyways.
- rewrite certain parts of the codebase which used
  ThreadTaskRunnerHandles instead of CurrentDefaultHandles.
- fix a compile issue with forward-declaration in
  extensions/browser/extension_file_task_runner.h.

AX-Relnotes: n/a.
Bug: 1026641
Change-Id: I737ef32aee4e77c21eaa3a2bdc403a28322cf1b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4133323
Owners-Override: Gabriel Charette <gab@chromium.org>
Commit-Queue: Sean Maher <spvw@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1090532}
2023-01-09 21:42:28 +00:00
Dominic Farolino
866245b50f Base: Fix improper usage of the base::Thread API
As per crbug.com/629139, base::Thread::Stop() is occasionally called on
a different thread than base::Thread::Start(). When you enable the
sequence checker DCHECK in Stop(), various tests fail, some of which are
the IPC unit tests. This is because those tests Start() the "ipc" thread
on the "listener" thread, but Stop() the "ipc" thread on the main thread
in the "Worker" destructor.

This CL makes the "listener" thread itself Stop()/destruct the "ipc"
thread, which is the "proper" usage of the base::Thread API.

Bug: 629139
Change-Id: Iccfa66b114518e50412a3d18f5fbc3d4d3bfd92f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4116950
Commit-Queue: Dominic Farolino <dom@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/main@{#1088505}
2023-01-04 00:43:30 +00:00
Paul Semel
ff2ca67b0e DanglingPtr: Enforce receivers to have MayBeDangling<T> argument
Only receivers of bound arg UnsafeDangling should be enforced to receive
raw_ptr<T, MayDangle> as an argument. This will make it clearer that the
handled pointer might effectively be dangling and should not be trusted.

Bug: 1291138
Change-Id: If109264ed2e6c863354a5c8bc515b8b8d1d6886c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4056275
Reviewed-by: danakj <danakj@chromium.org>
Owners-Override: danakj <danakj@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1085924}
2022-12-21 15:46:02 +00:00
Xinchao Tian
a542ae12d5 ipc: Fix compile error when using IPC_MESSAGE_HANDLER_WITH_PARAM_DELAY_REPLY
If we use IPC_MESSAGE_HANDLER_WITH_PARAM_DELAY_REPLY inside an
IPC_BEGIN_MESSAGE_MAP_WITH_PARAM block,we get an compile error.
IPC_MESSAGE_HANDLER_WITH_PARAM_DELAY_REPLY is wrongly defined
because there are extra characters “/”
This CL fix that error.

BUG=1398425

Change-Id: I223e0780928e38ef8824f9c62c5541bd038f036d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4085582
Reviewed-by: Ken Rockot <rockot@google.com>
Commit-Queue: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/main@{#1082526}
2022-12-13 17:56:29 +00:00
Ken Rockot
7308d4b616 Mojo: Remove MessageQuotaChecker
This is effectively dead code, enabled only by feature flags which must
be manually enabled and which were added for investigations that are
no longer being done. The feature flags are also removed.

Fixed: 1399511
Change-Id: I3e6462c728c1ee39848670a2bff4f29be61f1865
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4093879
Reviewed-by: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1082320}
2022-12-13 06:35:56 +00:00
Matt Menke
b4ee00aeef Remove DictionaryValue IPC code.
It's no longer in use, and DictionaryValues are deprecated. Also update
tests not to use DictionaryValue or ListValue to construct lists and
dicts.

Bug: 1338341
Change-Id: I901807a2713bb6ff315d39810e09a166bd6d767e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4095134
Commit-Queue: Matt Menke <mmenke@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/main@{#1082254}
2022-12-13 03:36:25 +00:00
Robert Sesek
a4faabcd2a Clean up the sandbox::Seatbelt API a little.
Remove some unused constants; make the error handling API easier.

Bug: 1315988
Change-Id: Iec911b76395febdff0cc22c67c39b2bbd2163414
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4067687
Reviewed-by: Daniel Rubery <drubery@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Auto-Submit: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Alex Gough <ajgo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1078166}
2022-12-01 18:19:58 +00:00
Ali Hijazi
9594a64ebc DanglingPtr: Mark all of them as untriaged [11/N]
This patch is a no-op with all the common build flags.

Add the "DanglingUntriaged" raw_ptr annotation. It indicates a raw_ptr
becomes dangling, and it should be triaged/fixed. This will also disable
dangling protection for those pointers, once enabled.

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

Bug: 1291138
Change-Id: I0c1e264101adfb216581c75c93b76b2e3a08ac4d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4066015
Owners-Override: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Ali Hijazi <ahijazi@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1078042}
2022-12-01 14:30:56 +00:00
Ken Rockot
120b4b05ac Mojo: Fix potential UAF in IPC Channel
Fixed: 1394692
Change-Id: I1753b79eb6e9230ebb663eca47295d81dd859068
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4066994
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1077742}
2022-12-01 01:44:05 +00:00
Alex Kallam
0714db6fe1 Fix a typo.
Bug: 1394753
Change-Id: I500e2f69dba210d2551896e258693758f37ea132
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4067200
Auto-Submit: Alex Kallam <aakallam@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1077520}
2022-11-30 17:20:33 +00:00
Ari Chivukula
2bf6f29cda [UnsafeDanglingUntriaged] ipc/ipc_mojo_bootstrap.cc
This CL is part of a larger cleanup effort to triage dangling pointers
and ensure they aren't the cause of memory issues in Chrome. See:
https://docs.google.com/document/d/164SnySRX6MZgFkX8qLLLClTnZ0S8s5wLiNFWNyQ8f4E/edit

Bug: 1381430
Change-Id: I38b3598e24564a1cb205d793321d7395a626e5fb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4048606
Commit-Queue: Ari Chivukula <arichiv@chromium.org>
Auto-Submit: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1076306}
2022-11-28 18:29:46 +00:00
Keishi Hattori
c1b0023f5a [BRP] Apply raw_ptr rewriter
Rewrites generated by running the raw_ptr rewriter (win/android)
on ecf579231e

PS1: generated rewrite
PS2-PS5: manual build fixes and additional exclusions
PS6: rebase

Binary-Size: This is a batch rewrite so size increase is unavoidable
Change-Id: I23b244e715d6dcf559ce2df9cc8dc97ec9227fca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4044201
Owners-Override: Keishi Hattori <keishi@chromium.org>
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Reviewed-by: Bartek Nowierski <bartekn@chromium.org>
Owners-Override: Bartek Nowierski <bartekn@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1074510}
2022-11-22 09:04:26 +00:00
Sean Maher
5b9af51fdd task posting v3: moving away from ThreadTaskRunnerHandle
To continue the migration away from TaskRunnerHandles, the codebase
was refactored using the following scripts:
shell script:
https://paste.googleplex.com/4673967729147904
python:
https://paste.googleplex.com/5824001174667264

This will do a few sed-like modifications, changing calls to methods of
ThreadTaskRunnerHandle to calls to methods of
SingleThreadTaskRunner::CurrentDefaultHandle, and swapping includes.

Bug: 1026641
AX-Relnotes: n/a.
Change-Id: Ia33b6dfebb15937481c619f5c838720ce7bb2676
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4031817
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Owners-Override: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1074085}
2022-11-21 15:32:47 +00:00
Ali Hijazi
961e904e81 DanglingPtr: Mark all of them as untriaged [8/N]
This patch is a no-op with all the common build flags.

Add the "DanglingUntriaged" raw_ptr annotation. It indicates a raw_ptr
becomes dangling, and it should be triaged/fixed. This will also disable
dangling protection for those pointers, once enabled.

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

Bug: 1291138
Change-Id: I5e7827e752455b94392184338789c8365fb1597a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4029142
Owners-Override: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Ali Hijazi <ahijazi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1072120}
2022-11-16 09:29:39 +00:00
Sean Maher
52fa5a7f26 task posting v3: moving away from SequencedTaskRunnerHandle
To continue the migration away from TaskRunnerHandles, the codebase
was refactored using the following scripts:
shell script:
https://paste.googleplex.com/4673967729147904
python:
https://paste.googleplex.com/5302682490241024

This will do a few sed-like modifications, changing calls to methods of
SequencedTaskRunnerHandle to calls to methods of
SequencedTaskRunner::CurrentDefaultHandle, and swapping includes.

Bug: 1026641
AX-Relnotes: n/a.
Change-Id: I49e50a2bd1e78b00e7c067219fff96d2e0bc0b46
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3983373
Commit-Queue: Gabriel Charette <gab@chromium.org>
Owners-Override: Gabriel Charette <gab@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1071032}
2022-11-14 15:53:25 +00:00
Ali Hijazi
5517919606 Rewrite T& into raw_ref<T> under multiple directories [1]
The changes were generated by running
tools/clang/rewrite_raw_ref_fields/rewrite-multiple-platforms.sh with
tool-arg=--enable_raw_ref_rewrite

`raw_ref` is a smart pointer for a pointer which can not be null, and
which provides Use-after-Free protection in the same ways as raw_ptr.
This class acts like a combination of std::reference_wrapper and
raw_ptr.

See raw_ptr and //base/memory/raw_ptr.md for more details on the
Use-after-Free protection.

Bug: 1357022
Change-Id: Ibcd714bd5a8e408aa31f07a04c5fc67f7eff4e3e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4001524
Owners-Override: danakj <danakj@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1069181}
2022-11-09 16:28:51 +00:00
Ken Rockot
b6f921260e Mojo: Disable sync call interrupts in the browser
This changes the default Mojo sync call behavior in the browser process
to prevent any blocking sync calls from being interrupted by other
incoming sync IPC dispatches.

Bug: 1376099
Change-Id: I53681ef379fdd3c2bfc37d7e16b3de17acad5d20
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3989408
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1065369}
2022-10-31 04:52:24 +00:00
Peter Kasting
51b3c4fd33 Convert std::copy() to base::ranges::copy().
Bug: 1368812
Change-Id: I87aeca909203860f3d7aa0b535f2e816eb9f30b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3988852
Reviewed-by: Yuchen Liu <yucliu@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Reviewed-by: Will Harris <wfh@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1064863}
2022-10-28 16:05:55 +00:00
Daniel Cheng
bc4f6be6db Fix LAST_RESORT_SUGGESTION annotations in //ipc/SECURITY_OWNERS.
Oops.

Change-Id: Ic7dc99d540275c2f10bbc3135378e33f726668b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3972173
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1062377}
2022-10-21 22:13:11 +00:00
Lei Zhang
6ab371d176 Remove support for sending base::ListValue via IPC messages.
All the base::ListValue usage in IPC messages have been removed.

Bug: 1187062
Change-Id: I4c034c192f5e631b9211fcaefbef0173f6650eb9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3946292
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1058171}
2022-10-12 18:27:25 +00:00
Paul Semel
b0ce484707 [Reland] DanglingPtr: fix dangling ptr for UnretainedWrapper
This is a reland. It only adds macro check to disable
`BindUnretainedDanglingDeathTest.*` on Android.

Removing `DanglingUntriaged` from UnretainedWrapper is hard because
having a ptr being dangling is actually a feature for developers using
`Unretained`. To keep the benefits of having DPD on those, we chose to
make it a pointer not allowed to dangle only at invocation time.

This CL increases binary size, which is due to adding
`ReportIfDangling`.

Binary-Size: Size increase is unavoidable (see above).
Bug: 1291138
Change-Id: I22ad176eec2b19ce45e672d106842a5fbb4d8c9b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3916476
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Paul Semel <paulsemel@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1052278}
2022-09-28 08:09:53 +00:00
Tom Sepez
5489885767 Remove ChromotingMsgStart enum constant.
Recent work has removed the last messages that depended upon
this constant.

Change-Id: Idfc28891de4b9a4eddf9ffc18e0d04c69ed8d480
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3923016
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1052162}
2022-09-28 01:53:39 +00:00
Andrew Grieve
cfa0a25832 Revert "DanglingPtr: fix dangling ptr for UnretainedWrapper"
This reverts commit 21c70d1075.

Reason for revert: Broke BindUnretainedDanglingDeathTest
https://bugs.chromium.org/p/chromium/issues/detail?id=1367399

Original change's description:
> DanglingPtr: fix dangling ptr for UnretainedWrapper
>
> Removing `DanglingUntriaged` from UnretainedWrapper is hard because
> having a ptr being dangling is actually a feature for developers using
> `Unretained`. To keep the benefits of having DPD on those, we chose to
> make it a pointer not allowed to dangle only at invocation time.
>
> This CL increases binary size, which is due to adding
> `ReportPointeeAlive`.
>
> Binary-Size: Size increase is unavoidable (see above).
> Bug: 1291138
> Change-Id: Ib794c3b85af6630ef4141c80ef32757a515170a8
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3829315
> Reviewed-by: Sergei Glazunov <glazunov@google.com>
> Owners-Override: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: danakj <danakj@chromium.org>
> Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
> Commit-Queue: Paul Semel <paulsemel@chromium.org>
> Reviewed-by: Kentaro Hara <haraken@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1050647}

Bug: 1291138, 1367399
Change-Id: I04b6d5bb11a35408b3a16d1aeafbf80133a13b81
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3914677
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Owners-Override: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1050755}
2022-09-23 19:55:31 +00:00
Paul Semel
21c70d1075 DanglingPtr: fix dangling ptr for UnretainedWrapper
Removing `DanglingUntriaged` from UnretainedWrapper is hard because
having a ptr being dangling is actually a feature for developers using
`Unretained`. To keep the benefits of having DPD on those, we chose to
make it a pointer not allowed to dangle only at invocation time.

This CL increases binary size, which is due to adding
`ReportPointeeAlive`.

Binary-Size: Size increase is unavoidable (see above).
Bug: 1291138
Change-Id: Ib794c3b85af6630ef4141c80ef32757a515170a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3829315
Reviewed-by: Sergei Glazunov <glazunov@google.com>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Paul Semel <paulsemel@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1050647}
2022-09-23 15:12:22 +00:00
Sean Maher
25a1353d26 Remove unused includes of base/task/task_runner_util.h
These are all instances where the file is included erroneously.

There are also a few instances of a header including it, and then a
source file neglecting to because it was transiently included. These
have been fixed.

Bug: 1026641
Change-Id: I6beb9be69f7dd329bd2a210d51a8d9cc94787d0a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3891102
Auto-Submit: Sean Maher <spvw@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Owners-Override: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1047243}
2022-09-15 01:06:46 +00:00
Avi Drissman
ea1be23a8b Update copyright headers in ipc/, ios/, infra/
The methodology used to generate this CL is documented in
https://crbug.com/1098010#c95.

No-Try: true
Bug: 1098010
Change-Id: I958bc4caa48822ca0d15594e906783852cd0c499
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3893343
Reviewed-by: Mark Mentovai <mark@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1047189}
2022-09-14 23:29:06 +00:00
Ali Hijazi
1e598fadce DanglingPtr: triage dangling ptrs
Bug: 1291138
Change-Id: Iad9b09db509b1426d896c17020250b1d8a252209
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3846295
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@{#1038273}
2022-08-23 16:36:40 +00:00
Ken Rockot
f9df018024 mojo-ipcz: Implement driver API
This implements all IpczDriver API functions for the mojo-ipcz driver,
and registers the driver in ipc_tests so it gets coverage from ipcz
multinode tests.

This also mechanically shovels a bunch of code from PlatformChannel to
PlatformChannelEndpoint where it makes more sense and where it's needed
by the new test driver.

Bug: 1299283
Change-Id: Ib1df7017650b9378a82a87e3a9bf25d136558e99
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3822718
Reviewed-by: Alex Gough <ajgo@chromium.org>
Commit-Queue: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/main@{#1037869}
2022-08-22 19:12:18 +00:00