0
Commit Graph

190 Commits

Author SHA1 Message Date
Alexander Hendrich
d4ef154120 Revert "Fix truncated NetLogs by introducing the --net-log-duration"
This reverts commit c09e57c352.

Reason for revert: test failures on mac bots (https://g-issues.chromium.org/issues/40283474#comment13)

Original change's description:
> Fix truncated NetLogs by introducing the --net-log-duration
> flag.
>
> Net logs generated via the command line were often
> truncated due to insufficient mechanisms to catch
> close event.This change introduces the --net-log-duration
> flag,which specifies the duration (in seconds)
> for network logging. When provided with a positive
> integer X, Browser will automatically stop logging
> after X seconds and flush the complete NetLogs to disk.
>
> Bug: 40283474
> Change-Id: Ia958aae8caae4ffcfcfc78ce0e19516fcbaf4006
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6293542
> Reviewed-by: Andrew Williams <awillia@chromium.org>
> Commit-Queue: krishna dheeraj Pannala <kpannala@microsoft.com>
> Reviewed-by: Adam Rice <ricea@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1431364}

Bug: 40283474
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: Ie4390e81e77f05ecd96b164481f50b7a3df4db30
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6347498
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Alexander Hendrich <hendrich@chromium.org>
Auto-Submit: Alexander Hendrich <hendrich@chromium.org>
Commit-Queue: Alexander Hendrich <hendrich@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1431406}
2025-03-12 03:32:51 -07:00
Dheeraj Pannala
c09e57c352 Fix truncated NetLogs by introducing the --net-log-duration
flag.

Net logs generated via the command line were often
truncated due to insufficient mechanisms to catch
close event.This change introduces the --net-log-duration
flag,which specifies the duration (in seconds)
for network logging. When provided with a positive
integer X, Browser will automatically stop logging
after X seconds and flush the complete NetLogs to disk.

Bug: 40283474
Change-Id: Ia958aae8caae4ffcfcfc78ce0e19516fcbaf4006
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6293542
Reviewed-by: Andrew Williams <awillia@chromium.org>
Commit-Queue: krishna dheeraj Pannala <kpannala@microsoft.com>
Reviewed-by: Adam Rice <ricea@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1431364}
2025-03-12 01:16:51 -07:00
Chris Davis
08351ce7f8 Cleanup old code responsible for cache cleanup
Removal of unnecessary code for deleting the old cache data directory.

Bug: 40198348
Change-Id: Iedc433b50ae82249a6da99936983d84597252fd9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6317332
Commit-Queue: Chris Davis <chrdavis@microsoft.com>
Reviewed-by: Clark DuVall <cduvall@chromium.org>
Reviewed-by: Nikhil Nayunigari <nikhilcn@google.com>
Cr-Commit-Position: refs/heads/main@{#1427943}
2025-03-04 13:19:33 -08:00
Georg Neis
35ff854b7e Remove Lacros leftovers from content/browser, part 2
Main changes:
- Replace IS_CHROMEOS_ASH with the equivalent IS_CHROMEOS
- Remove obsolete build flag includes/dependencies

Bug: b:354842935
AX-Relnotes: n/a.
Change-Id: I079b003a4664a7a3f7281905323611b6fc4fe3da
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6090635
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1397108}
2024-12-16 18:02:08 -08:00
Georg Neis
0dce333643 Remove Lacros leftovers from content/browser, part 1
Main changes:
- Remove IS_CHROMEOS_LACROS code
- Remove Lacros references from comments

Bug: b:365742770
AX-Relnotes: n/a.
Change-Id: I17a5d33d42845d2d566912a518d088073892372e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6090534
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1395719}
2024-12-12 17:51:18 -08:00
Michael Thiessen
dd70b61356 Add end-to-end metric for mojo IPC latency
Records a subsampled metric for the time taken from when the sender
calls a mojo interface function to when the receiver's implementation
is called.

Metric is split by receiving thread for some important threads.

Bug: 356125152
Change-Id: I92154779b075d7815403a91919c2cee31ee67aae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5784162
Reviewed-by: Jonathan Ross <jonross@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1343233}
2024-08-17 18:25:25 +00:00
Dan McArdle
0c085b21fd Fix numeric edge cases when parsing "net-log-max-size-mb" flag
This CL makes the following changes:

* Renames GetNetMaximumFileSizeFromCommandLine() to
          GetNetLogMaximumFileSizeFromCommandLine().

* Changes its return type from int64_t to uint64_t, because it may
  return the maximum uint64_t value.

* Adds an explicit cast to uint64_t before shifting. This fixes parsing
  for values >= 2**12.

* Adds test coverage, including a regression test for the linked bug.

Bug: 352496169
Change-Id: Ifd44fe4a1b58f83ba806753899e2e55ad02b37b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5695988
Reviewed-by: Adam Rice <ricea@chromium.org>
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1326747}
2024-07-12 14:15:23 +00:00
Alison Gale
81f4f2c793 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: Iee14d10d544e9f0ec046117cc4ec8a55c427adc0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5469947
Reviewed-by: Darryl James <dljames@chromium.org>
Owners-Override: Alison Gale <agale@chromium.org>
Commit-Queue: Alison Gale <agale@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1290838}
2024-04-22 19:33:31 +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
Arthur Sonzogni
c686e8f4fd Rename {absl => std}::optional in //content/
Automated patch, intended to be effectively a no-op.

Context:
https://groups.google.com/a/chromium.org/g/cxx/c/nBD_1LaanTc/m/ghh-ZZhWAwAJ?utm_medium=email&utm_source=footer

As of https://crrev.com/1204351, absl::optional is now a type alias for
std::optional. We should migrate toward it.

Script:
```
function replace {
  echo "Replacing $1 by $2"
  git grep -l "$1" \
    | cut -f1 -d: \
    | grep \
      -e "^content" \
    | sort \
    | uniq \
    | grep \
      -e "\.h" \
      -e "\.cc" \
      -e "\.mm" \
      -e "\.py" \
    | xargs sed -i "s/$1/$2/g"
}
replace "absl::make_optional" "std::make_optional"
replace "absl::optional" "std::optional"
replace "absl::nullopt" "std::nullopt"
replace "absl::in_place" "std::in_place"
replace "absl::in_place_t" "std::in_place_t"
replace "\"third_party\/abseil-cpp\/absl\/types\/optional.h\"" "<optional>"
git cl format
```

# Skipping unrelated "check_network_annotation" errors.
NOTRY=True

Bug: chromium:1500249
Change-Id: Icfd31a71d8faf63a2e8d5401127e7ee74cc1c413
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5185537
Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1245739}
2024-01-11 08:36:37 +00:00
Matt Mueller
47a15271a8 Reapply "Refactor so CTVerifier is owned and called by CertVerifyProc"
Includes fix for fuchsia build failure in original CL.

This reverts commit 913f4f5eb6 and is a
reland of commit 9778c34a8f.

Original commit message:

Removes the CertAndCTVerifier wrapper and moves the CTVerifier log list
updates to happen through the CertVerifierServiceFactory mojom interface
instead of the network service. (CT log lists are also still sent to the
network service as CT policy enforcement is not refactored in this CL.)

Only CertVerifyProcBuiltin implements CT verification, as CT is not
enabled on iOS or on Android Webview.

Bug: 848277, 1211074
Change-Id: I053b36bb779e1ae46ffb9e87f4a4c311f435cf96
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5113240
Reviewed-by: Sorin Jianu <sorin@chromium.org>
Reviewed-by: Mustafa Emre Acer <meacer@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Matt Mueller <mattm@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1236095}
2023-12-12 01:44:16 +00:00
Igor Ruvinov
913f4f5eb6 Revert "Refactor so CTVerifier is owned and called by CertVerifyProc"
This reverts commit 9778c34a8f.

Reason for revert: Likely culprit for tree closure. Example failure: https://ci.chromium.org/ui/p/chromium/builders/ci/fuchsia-arm64-rel/11250/overview

Original change's description:
> Refactor so CTVerifier is owned and called by CertVerifyProc
>
> Removes the CertAndCTVerifier wrapper and moves the CTVerifier log list
> updates to happen through the CertVerifierServiceFactory mojom interface
> instead of the network service. (CT log lists are also still sent to the
> network service as CT policy enforcement is not refactored in this CL.)
>
> Only CertVerifyProcBuiltin implements CT verification, as CT is not enabled on iOS or on Android Webview.
>
> Bug: 848277, 1211074
> Change-Id: I654f9ae9b5795728199e44c0737b061d08b50cf7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5068490
> Reviewed-by: John Abd-El-Malek <jam@chromium.org>
> Reviewed-by: Sorin Jianu <sorin@chromium.org>
> Reviewed-by: Carlos IL <carlosil@chromium.org>
> Commit-Queue: Matt Mueller <mattm@chromium.org>
> Reviewed-by: Mustafa Emre Acer <meacer@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1235934}

Bug: 848277, 1211074
Change-Id: I7f3e5b53eb8bbb100b024d5ddfc488f879717184
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5112360
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Igor Ruvinov <igorruvinov@chromium.org>
Commit-Queue: Igor Ruvinov <igorruvinov@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1235960}
2023-12-11 21:53:22 +00:00
Matt Mueller
9778c34a8f Refactor so CTVerifier is owned and called by CertVerifyProc
Removes the CertAndCTVerifier wrapper and moves the CTVerifier log list
updates to happen through the CertVerifierServiceFactory mojom interface
instead of the network service. (CT log lists are also still sent to the
network service as CT policy enforcement is not refactored in this CL.)

Only CertVerifyProcBuiltin implements CT verification, as CT is not enabled on iOS or on Android Webview.

Bug: 848277, 1211074
Change-Id: I654f9ae9b5795728199e44c0737b061d08b50cf7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5068490
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Sorin Jianu <sorin@chromium.org>
Reviewed-by: Carlos IL <carlosil@chromium.org>
Commit-Queue: Matt Mueller <mattm@chromium.org>
Reviewed-by: Mustafa Emre Acer <meacer@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1235934}
2023-12-11 21:04:37 +00:00
Abhijith Nair
7c7be7660c [AW-IPP] Allow embedders to set IPP bypass policy
Currently, Chrome specific logic for bypassing IP Protection
exists in the underlying networking layers. The network stack
considers that first-party requests to top level frame will
not be IP Protected. While this is true for Chrome, this is
not in line with WebView's policy. Architecturally, network
stack (or other underlying layers) should be agnostic to
embedder specific logic.

This CL refactors the network stack in such a way that the
network stack support multiple bypass policies and allows
the embedder to set the policy it requires using the general
interfaces provided to plumb data between the layers
in Chromium.

Additionally, some minor clean up is also done along the way.
(e.g. making tests adhere to go/gunitfaq).

Bug: 1499905
Change-Id: I3230fd22ac34d8c82973d5f9a23a3d73e7fba1f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5002096
Reviewed-by: Alex Kallam <aakallam@chromium.org>
Reviewed-by: Peter Beverloo <peter@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Abhijith Nair <abhijithnair@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1224325}
2023-11-14 16:25:37 +00:00
Matt Mueller
f783962d1b Reapply "Refactor how additional certificates are configured."
Originally landed in commit 264e35de52
and was reverted in commit 9192ea3942 due
to a test failure.

Updated with changes to policy_certs_browsertest.cc to
address possible sources of flake.

Original CL description:
Previously they were set through CertVerifier::Config and passed into
CertVerifyProc::Verify on every verification attempt. This also means
they needed to be passed from the browser to the network service on
configuration, and then passed back to the cert verifier service on
every verification attempt.

The new flow stores them in the CertVerifyProc instance and uses the
CertVerifierWithUpdatableProc interface to update them.

(this CL borrows some of the CertVerifierServiceUpdater parts from https://chromium-review.googlesource.com/c/chromium/src/+/4909292)

Bug: 1477317,1427326,978854
Change-Id: Ia64c2af672dc29b473eaa11ad1f5b663ffeaf3b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5015687
Reviewed-by: Chris Thompson <cthomp@chromium.org>
Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Matt Mueller <mattm@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
Reviewed-by: David Trainor <dtrainor@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1223813}
2023-11-13 20:23:15 +00:00
Matt Mueller
9192ea3942 Revert "Refactor how additional certificates are configured."
This reverts commit 264e35de52.

Reason for revert: Builder  linux-lacros-tester-rel is failing, see
https://bugs.chromium.org/p/chromium/issues/detail?id=1500787

Original change's description:
> Refactor how additional certificates are configured.
>
> Previously they were set through CertVerifier::Config and passed into
> CertVerifyProc::Verify on every verification attempt. This also means
> they needed to be passed from the browser to the network service on
> configuration, and then passed back to the cert verifier service on
> every verification attempt.
>
> The new flow stores them in the CertVerifyProc instance and uses the
> CertVerifierWithUpdatableProc interface to update them.
>
> (this CL borrows some of the CertVerifierServiceUpdater parts from https://chromium-review.googlesource.com/c/chromium/src/+/4909292)
>
> Bug: 1477317,1427326,978854
> Change-Id: I802d1bb05e999b97bbbec2a80566ca7cf429b774
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4957815
> Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
> Reviewed-by: David Trainor <dtrainor@chromium.org>
> Commit-Queue: Matt Mueller <mattm@chromium.org>
> Reviewed-by: Matthew Denton <mpdenton@chromium.org>
> Reviewed-by: Ken Buchanan <kenrb@chromium.org>
> Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
> Cr-Commit-Position: refs/heads/main@{#1221751}

Bug: 1477317,1427326,978854, 1500719
Change-Id: I92e840223dea1298a4570ce7ddf1490add0d7986
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5014407
Auto-Submit: Sophia Lin <sophialin@google.com>
Reviewed-by: Sophia Lin <sophialin@google.com>
Owners-Override: Sophia Lin <sophialin@google.com>
Commit-Queue: Sophia Lin <sophialin@google.com>
Cr-Commit-Position: refs/heads/main@{#1221994}
2023-11-09 00:56:42 +00:00
Liza Burakova
f7b8fe5f99 Adding socket broker support to TCPServerSockets.
This change modifies CreateTCPServerSocket to use a socket broker
on Windows for creating server sockets. It is necessary for support
for direct sockets to create server sockets in the network process.

This change adds two helper methods for CreateTCPServerSocket to support
the new IPC, and also adds an extra mojo::Remote<SocketBroker> to the
NetworkContextParams. The original socket_broker param has been renamed
to client_socket_factory_socket_broker to reflect that it is used
for client sockets, and the new param is called
server_socket_factory_socket_broker to reflect that it is used for
server sockets.

Bug: 1364137
Change-Id: Idd7d2f71f91bdbeb3a73bb857a57b1b6eb385f06
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4985697
Reviewed-by: Adam Rice <ricea@chromium.org>
Commit-Queue: Liza Burakova <liza@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1221923}
2023-11-08 22:37:27 +00:00
Matt Mueller
264e35de52 Refactor how additional certificates are configured.
Previously they were set through CertVerifier::Config and passed into
CertVerifyProc::Verify on every verification attempt. This also means
they needed to be passed from the browser to the network service on
configuration, and then passed back to the cert verifier service on
every verification attempt.

The new flow stores them in the CertVerifyProc instance and uses the
CertVerifierWithUpdatableProc interface to update them.

(this CL borrows some of the CertVerifierServiceUpdater parts from https://chromium-review.googlesource.com/c/chromium/src/+/4909292)

Bug: 1477317,1427326,978854
Change-Id: I802d1bb05e999b97bbbec2a80566ca7cf429b774
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4957815
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Reviewed-by: David Trainor <dtrainor@chromium.org>
Commit-Queue: Matt Mueller <mattm@chromium.org>
Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1221751}
2023-11-08 18:28:48 +00:00
Matthew Denton
095b69776b Remove duplication of RegisterNetworkServiceCrashHandler()
OnRestartNetworkServiceForTesting() ran a callback when the network
service was deliberately restarted. RegisterNetworkServiceCrashHandler()
ran a stack of callback handlers whenever the network service crashed.

The crash handlers wouldn't run when the network service was
deliberately restarted, but they probably should. And
OnRestartNetworkServiceForTesting() didn't allow registering multiple
callbacks. This CL combines the two functions into one.

The resulting RegisterNetworkServiceProcessGoneHandler() will be
useful for components that want to configure the network service, and
need to resend the configuration every time the network service
restarts.

Change-Id: I26a5c5a2849d0eb8878864738005d2376f372d80
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4990533
Reviewed-by: Adam Rice <ricea@chromium.org>
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1219135}
2023-11-02 21:56:17 +00:00
Felipe Andrade
fc9bc63744 Set Kerberos environment variables in a centralized place
Centralize the logic that sets Kerberos environment variables on
ChromeOS. The variables are KRB5CCNAME and KRB5_CONFIG, and they
correspond to the file path of the Kerberos credentials cache and
configuration, respectively.

This CL removes the logic from KerberosFileHandler that used to update
these variables inside the user session. Now, the variables are only set
when the network service starts, or restarts. This prevents crashes that
can be caused by modifying environment variables in multi-threaded
processes. See crbug.com/1258587 and the bugs linked to this CL for more
details.

Additionally, the environment variables on ChromeOS are now using
`/home/chronos/user`, which is the bind mount of the active user. The
`/home/chronos/u-<hash>` format can't always be used because the network
service often starts before a user signs in to the device.

Bug: 1259918, b:260520562
Change-Id: I5a29f9fb3d46cf2bccbb7d5eee20891f61205bfb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4975125
Reviewed-by: Clark DuVall <cduvall@chromium.org>
Commit-Queue: Felipe Andrade <fsandrade@chromium.org>
Reviewed-by: Pavol Marko <pmarko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1215715}
2023-10-26 20:26:07 +00:00
Matthew Denton
850436d0c9 ChromeOS Ash: send kerberos environment vars to restarted net service
In Ash, the kerberos environment variables (KRB5CCNAME and KRB5_CONFIG)
were only sent to the network service (which runs gssapi libraries) the
first time it starts. If the network service crashes or restarts, the
env vars would not be sent to the new network service.

Lacros correctly sends the env vars as initialization params to each new
network service, and uses the same values as Ash. Reuse the Lacros code
for Ash.

Change-Id: Ib26f3ae29360361f661de65ec7101b947b98a26b
Bug: 1494567
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4960622
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Auto-Submit: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Clark DuVall <cduvall@chromium.org>
Reviewed-by: Felipe Andrade <fsandrade@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1213785}
2023-10-23 22:29:29 +00:00
Yoichi Osato
ccb0837af8 Remove empty network service
Since the  project is canceled.

Bug: 1448414, 1487447
Change-Id: I15f21104842be9c633703dc339eb496550d008e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4904306
Auto-Submit: Yoichi Osato <yoichio@chromium.org>
Commit-Queue: Takashi Toyoshima <toyoshim@chromium.org>
Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1203874}
2023-10-02 08:34:37 +00:00
Liza Burakova
1595a781b3 Reland "Remove USE_SOCKET_BROKER buildflag"
This is a reland of commit 4f0b23a34a

Original change's description:
> Remove USE_SOCKET_BROKER buildflag
>
> The USE_SOCKET_BROKER flag was just "is_android || is_win" and since
> the network service sandbox will not run on android this flag can be
> replaced with just IS_WIN
>
> Bug: 1485298
> Change-Id: I8f153aa4ce3afc6442f47ce62db675385e9ff7e5
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4880087
> Commit-Queue: Liza Burakova <liza@chromium.org>
> Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1201616}

Bug: 1485298
Change-Id: I8b304773a4433fdac38fc2ee6ce8850f8196eb51
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4894375
Commit-Queue: Liza Burakova <liza@chromium.org>
Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1201983}
2023-09-27 15:03:32 +00:00
luci-bisection@appspot.gserviceaccount.com
8e8f67232b Revert "Remove USE_SOCKET_BROKER buildflag"
This reverts commit 4f0b23a34a.

Reason for revert:
LUCI Bisection identified this CL as the culprit of a build failure. See the analysis: https://luci-bisection.appspot.com/analysis/b/8768877340792539265

Sample failed build: https://ci.chromium.org/b/8768877340792539265

If this is a false positive, please report it at https://bugs.chromium.org/p/chromium/issues/entry?comment=Analysis%3A+https%3A%2F%2Fluci-bisection.appspot.com%2Fanalysis%2Fb%2F8768877340792539265&components=Tools%3ETest%3EFindit&labels=LUCI-Bisection-Wrong%2CPri-3%2CType-Bug&status=Available&summary=Wrongly+blamed+https%3A%2F%2Fchromium-review.googlesource.com%2Fc%2Fchromium%2Fsrc%2F%2B%2F4880087

Original change's description:
> Remove USE_SOCKET_BROKER buildflag
>
> The USE_SOCKET_BROKER flag was just "is_android || is_win" and since
> the network service sandbox will not run on android this flag can be
> replaced with just IS_WIN
>
> Bug: 1485298
> Change-Id: I8f153aa4ce3afc6442f47ce62db675385e9ff7e5
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4880087
> Commit-Queue: Liza Burakova <liza@chromium.org>
> Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1201616}
>

Bug: 1485298
Change-Id: I81062da7919b4ea40a8138d51356bc7af1f3b9f9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4893896
Commit-Queue: luci-bisection@appspot.gserviceaccount.com <luci-bisection@appspot.gserviceaccount.com>
Bot-Commit: luci-bisection@appspot.gserviceaccount.com <luci-bisection@appspot.gserviceaccount.com>
Owners-Override: luci-bisection@appspot.gserviceaccount.com <luci-bisection@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1201634}
2023-09-26 16:22:48 +00:00
Liza Burakova
4f0b23a34a Remove USE_SOCKET_BROKER buildflag
The USE_SOCKET_BROKER flag was just "is_android || is_win" and since
the network service sandbox will not run on android this flag can be
replaced with just IS_WIN

Bug: 1485298
Change-Id: I8f153aa4ce3afc6442f47ce62db675385e9ff7e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4880087
Commit-Queue: Liza Burakova <liza@chromium.org>
Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1201616}
2023-09-26 15:58:02 +00:00
Clark DuVall
f38b08c7ba Revert "Add a high priority queue for sync cookie calls in the network service"
This reverts commit a922565736.

Reason for revert: This did not show any improvement.

Original change's description:
> Add a high priority queue for sync cookie calls in the network service
>
> This change adds a minimal scheduler for the network service thread
> which has a default task queue and high priority task queue. The
> RestrictedCookieManager interface will be bound using the high priority
> task queue, which should make the sync cookie accesses/writes from the
> renderer faster if there are other tasks that need to be run in the
> network service.
>
> The hope is that re-ordering these tasks with other network tasks will
> not be a problem since they are generally called as sync calls from the
> renderer. If there turns out to be problems with this later we can
> revisit how tasks are prioritized.
>
> Bug: 1448685
> Change-Id: I42f7f4e895a0b7d8708c49db707aab6286ef18bf
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4561626
> Commit-Queue: Clark DuVall <cduvall@chromium.org>
> Reviewed-by: Scott Haseley <shaseley@chromium.org>
> Reviewed-by: John Abd-El-Malek <jam@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1149519}

Bug: 1448685
Change-Id: I23d627113a8697bc14521d4673588c226b97c573
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4880044
Reviewed-by: Scott Haseley <shaseley@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1199314}
2023-09-20 23:52:44 +00:00
Matthew Denton
542c43cbdf Reland "Cros network service sandbox: Unsandboxed if kerberos is enabled"
This is a reland of commit 5dfa5d11f4

The new sandbox tests should be skipped if the sandbox is disabled
on the command line.

Original change's description:
> Cros network service sandbox: Unsandboxed if kerberos is enabled
>
> The Linux/cros network service sandbox is incompatible with kerberos.
> So, the network service will start unsandboxed if kerberos is
> enabled, regardless of feature state or enterprise policy.
>
> The KerberosEnabled enterprise policy can change at runtime. If it
> flips to enabled, shut down the network service so it restarts
> unsandboxed. This is not a sandbox hole because only admins
> can enable kerberos.
>
> Change-Id: I4ae1356f31c3f9182a0db803a2ee22ec7bd1744e
> Bug: 1079808
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4753004
> Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
> Reviewed-by: Matt Menke <mmenke@chromium.org>
> Commit-Queue: Matthew Denton <mpdenton@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1180982}

Bug: 1079808, 1473197
Change-Id: I877ff17df78e1d3d34f90ff95ebd0e8886b3cf2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4777750
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Auto-Submit: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Adam Rice <ricea@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1185061}
2023-08-18 07:32:17 +00:00
Christos Froussios
e193949361 Revert "Cros network service sandbox: Unsandboxed if kerberos is enabled"
This reverts commit 5dfa5d11f4.

Reason for revert:
SystemNetworkContextManagerNetworkServiceSandboxEnabledBrowsertest.NetworkServiceRestartsUnsandboxedOnKerberosEnabled
is failing on Linux Chromium OS ASan LSan
First failure: https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Chromium%20OS%20ASan%20LSan%20Tests%20(1)/52807/overview

Original change's description:
> Cros network service sandbox: Unsandboxed if kerberos is enabled
>
> The Linux/cros network service sandbox is incompatible with kerberos.
> So, the network service will start unsandboxed if kerberos is
> enabled, regardless of feature state or enterprise policy.
>
> The KerberosEnabled enterprise policy can change at runtime. If it
> flips to enabled, shut down the network service so it restarts
> unsandboxed. This is not a sandbox hole because only admins
> can enable kerberos.
>
> Change-Id: I4ae1356f31c3f9182a0db803a2ee22ec7bd1744e
> Bug: 1079808
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4753004
> Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
> Reviewed-by: Matt Menke <mmenke@chromium.org>
> Commit-Queue: Matthew Denton <mpdenton@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1180982}

Bug: 1079808
Change-Id: Ida288eec87d64b363f7c68ce327e2904f00769ad
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4763626
Auto-Submit: Christos Froussios <cfroussios@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Christos Froussios <cfroussios@google.com>
Owners-Override: Christos Froussios <cfroussios@google.com>
Cr-Commit-Position: refs/heads/main@{#1181303}
2023-08-09 03:38:49 +00:00
Matthew Denton
5dfa5d11f4 Cros network service sandbox: Unsandboxed if kerberos is enabled
The Linux/cros network service sandbox is incompatible with kerberos.
So, the network service will start unsandboxed if kerberos is
enabled, regardless of feature state or enterprise policy.

The KerberosEnabled enterprise policy can change at runtime. If it
flips to enabled, shut down the network service so it restarts
unsandboxed. This is not a sandbox hole because only admins
can enable kerberos.

Change-Id: I4ae1356f31c3f9182a0db803a2ee22ec7bd1744e
Bug: 1079808
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4753004
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1180982}
2023-08-08 16:46:23 +00:00
Will Harris
e06ce8727a Call CreateNetworkContextInNetworkService in SystemNetworkContextManager
Rather than calling directly to the network service remote, network
contexts should be created using the
CreateNetworkContextInNetworkService to ensure that appropriate
initialization such as socket broker connection occurs.

On Android, since CreateNetworkContextInNetworkService is called early
during init from DownloadManagerService, the thread checks in the
function are made consistent with other functions in
network_service_instance_impl.cc.

This is covered by existing tests, namely
SystemNetworkContext/NetworkContextConfigurationBrowserTest* when
run with network sandbox enabled.

BUG=1469732

Change-Id: Ia67d2ec63fb86893d24cbfb875aaed3423f8fb3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4744763
Commit-Queue: Will Harris <wfh@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1179327}
2023-08-03 23:11:47 +00:00
sbingler
072b9784a1 Reland "Add net-log max size command line flag"
The reland fixes previous breakage by disabling the file size checks
for Fuchsia builds in NetworkServiceBoundedNetLogBrowserTest.

This CL adds support for a maximum file size flag when invoking
net-log export from the command line. The flag allows a user to specify the max size in MB for a net-log file.

Bug: 1463983, 1466701
Change-Id: I529d3efed9fa9cf312a0d091421becc8b2f89dd4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4706170
Reviewed-by: Bo Liu <boliu@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Commit-Queue: Steven Bingler <bingler@chromium.org>
Reviewed-by: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1175655}
2023-07-26 20:29:05 +00:00
Fergal Daly
19f45c9bd4 Revert "Add net-log max size command line flag"
This reverts commit 41a946c134.

This was not a clean revert due to https://crrev.com/c/4678102.

I was going to just disable but this impacts fuchsia AND chromeos

Reason for revert: Breaks on several Fuchsia bots

E.g.

https://ci.chromium.org/ui/p/chromium/builders/ci/fuchsia-arm64-rel/8062/overview

Original change's description:
> Add net-log max size command line flag
>
> This CL adds support for a maximum file size flag when invoking
> net-log export from the command line. The flag allows a user to specify the max size in MB for a net-log file.
>
> Bug: 1463983
> Change-Id: I5fb4b493cc00db3e0d0181ce8ffe2cc5a63abd91
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4678102
> Commit-Queue: Steven Bingler <bingler@chromium.org>
> Reviewed-by: Brendon Tiszka <tiszka@chromium.org>
> Reviewed-by: Matt Menke <mmenke@chromium.org>
> Reviewed-by: Bo Liu <boliu@chromium.org>
> Reviewed-by: Will Harris <wfh@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1173118}

Bug: 1463983
Change-Id: I290d388f00c258b02d96f349c004a8fd52dca43e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4707105
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Owners-Override: Fergal Daly <fergal@google.com>
Commit-Queue: Fergal Daly <fergal@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1173289}
2023-07-21 02:23:06 +00:00
sbingler
41a946c134 Add net-log max size command line flag
This CL adds support for a maximum file size flag when invoking
net-log export from the command line. The flag allows a user to specify the max size in MB for a net-log file.

Bug: 1463983
Change-Id: I5fb4b493cc00db3e0d0181ce8ffe2cc5a63abd91
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4678102
Commit-Queue: Steven Bingler <bingler@chromium.org>
Reviewed-by: Brendon Tiszka <tiszka@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Reviewed-by: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1173118}
2023-07-20 19:10:07 +00:00
Liza Burakova
d009fdd11f Move two params from NetworkContextParams to NetworkContextFilePaths.
This CL moves http_cache_directory and shared_dictionary_directory
to the NetworkContextFilePath struct. This is to keep all filepaths
consistently within the NetworkContextFilePaths.

For the most part there are no functional changes as these parameters already exist, the majority of the changes modify callers to make sure they set parameters correctly.

The only slight change is that MaybeGrantSandboxAccessToNetworkContextData() now checks if any file_paths exist in the beginning, and does a follow up check to see if data_directory is empty as there is now a possibility that the file_paths exist but the data_directory has not been set. The end result is the same, however, as the method still returns kDidNotAttemptToGrantSandboxAccess in these cases.

Bug: 1333558
Change-Id: I15cd6994b2a6c97305560d68c99eaa4f11b10a26
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4615930
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Liza Burakova <liza@chromium.org>
Reviewed-by: Will Harris <wfh@chromium.org>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1161873}
2023-06-23 18:43:23 +00:00
Matthew Denton
e497626d43 OutOfProcessSystemDnsResolution won't be enabled on ChromeOS
...so we can remove the code that checks if the feature is enabled.

Bug: 1312224
Change-Id: I04914089d3cdd362fcf2b9fd89b614b10edce659
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4617985
Auto-Submit: Matthew Denton <mpdenton@chromium.org>
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1159910}
2023-06-20 09:18:32 +00:00
Matthew Denton
402a9900e9 All system DNS resolution runs on a threadpool at USER_BLOCKING pri
System DNS resolution was being run at USER_VISIBLE task priority.
The definition of USER_BLOCKING includes the loading path, and
system DNS resolution is on the loading path, so it shouldn't
run at a lower priority.

Also, the browser's UI thread was handling requests from the network
service for out-of-process system DNS resolution and then farming
those requests out to the thread pool. There's no reason to deal
with the UI thread contention and so the dispatcher for system DNS
resolution requests will now run on a thread pool sequence at
USER_BLOCKING priority.

Bug: 1312224, 1320192
Change-Id: I1bcc7277fd22cd9deaf0dcdd1bb9c1e326d849b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4617671
Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1159880}
2023-06-20 08:19:38 +00:00
Yoichi Osato
a3c43f4fa7 Reenable empty network service
This CL reenables empty network service with
- introducing strict conditions to avoid the found crashes ([1]).
- add kRegisterEmptyNetworkService command line switch to launch the
service in the utility process correctly.

[1] https://crbug.com/1446571: Chrome_Android: Crash Report
  ChromeContentBrowserClient::GetApplicationLocale

Bug: 1448414
Change-Id: If1b340de582c189cad11192d827e1923692e7001
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4569853
Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
Commit-Queue: Yoichi Osato <yoichio@chromium.org>
Reviewed-by: Adam Rice <ricea@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1157972}
2023-06-15 05:53:12 +00:00
Yoichi Osato
55a287f218 Use ForceOutOfProcessNetworkService instead of flag
Since kNetworkServiceInProcess flag doesn't imply
IsInProcessNetworkService directly due to some environment
restriction, add new function to force that.

This CL also moves the flag check in the tests from SetUp() to
SetUpOnMainThread() because t/v/fieldtrial_testing_config.json applies
flags at content::ShellContentBrowserClient::SetUpFieldTrials(), which
is called after SetUp().

Bug: 1395707
Change-Id: Ice6205294e6633c03da927be5e15da2ca4216023
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4520651
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Auto-Submit: Yoichi Osato <yoichio@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Owners-Override: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1152173}
2023-06-01 22:16:27 +00:00
Yoichi Osato
e0400143c9 Move content/public/common/network_service_util.h to c/p/browser/
That's because all functions are called from browser process.

For content/renderer/workers, IsOutOfProcessNetworkService() is
used ([1]) to terminate workers if the network service crashes.
However, if the crashed network service is in the browser process,
then the workers are going to get terminated anyway, so introducing
this condition doesn't actually help. Thus we can remove them.

[1] https://chromium-review.googlesource.com/c/chromium/src/+/1264139

Bug: 1329834
Change-Id: Iaf3c9847b2231aef9e413481d6bdf53f7e9065ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4547630
Auto-Submit: Yoichi Osato <yoichio@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Owners-Override: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1150766}
2023-05-30 19:35:40 +00:00
Clark DuVall
a922565736 Add a high priority queue for sync cookie calls in the network service
This change adds a minimal scheduler for the network service thread
which has a default task queue and high priority task queue. The
RestrictedCookieManager interface will be bound using the high priority
task queue, which should make the sync cookie accesses/writes from the
renderer faster if there are other tasks that need to be run in the
network service.

The hope is that re-ordering these tasks with other network tasks will
not be a problem since they are generally called as sync calls from the
renderer. If there turns out to be problems with this later we can
revisit how tasks are prioritized.

Bug: 1448685
Change-Id: I42f7f4e895a0b7d8708c49db707aab6286ef18bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4561626
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Reviewed-by: Scott Haseley <shaseley@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1149519}
2023-05-26 03:40:51 +00:00
Tsuyoshi Horo
2960a1e202 Set shared_dictionary_directory flag for non-incognito mode
After https://crrev.com/c/4535476, when
CompressionDictionaryTransportBackend feature is enabled,
StoragePartitionImpl sets shared_dictionary_enabled flag of
NetworkContextParams. And NetworkContext uses
SharedDictionaryManagerInMemory.

This CL introduces a new shared_dictionary_directory flag in
NetworkContextParams which is set when the StoragePartition is not in
memory (non-incognito). NetworkContext will
SharedDictionaryManagerOnDisk and the downloaded shared dictionary will
be persisted on disk.

This CL introduces Net.SharedDictionaryManagerOnDisk.DictionarySize
UMA which is recorded when SharedDictionaryManagerOnDisk succeeded to
store the dictionary on disk cache and database.

Binary-Size: Size increase is unavoidable
Fuchsia-Binary-Size: Size increase is unavoidable
Include-Ci-Only-Tests: true
Low-Coverage-Reason: Logging code for unexpected system failure.
Bug: 1413922
Change-Id: I4c159c91b9bcd9730921790d7557e9486caee8e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4546508
Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Commit-Queue: Tsuyoshi Horo <horo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1148255}
2023-05-23 23:25:45 +00:00
Yoichi Osato
7c4c434604 Add empty network service for metrics
This CL adds empty network service out of process for measuring memory
impact on Android.
The empty network service lives on new utility process and virtually does
nothing (implementation is ~20 lines of code in c/u/services.cc.)
The empty service is enabled only if the canonical network service
is in process to see additional process overhead on Android.

Bug: 1395707
Change-Id: Ieb0902a87134d1ae0af56f6b9d7940944863e450
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4374282
Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
Commit-Queue: Yoichi Osato <yoichio@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1143838}
2023-05-15 01:39:23 +00:00
Asami Doi
fe926740eb code health: remove expired Navigation.{CommitTimeout, IsSameProcess}.* histograms
This CL removes expired histograms:
- Navigation.CommitTimeout.NetworkServiceAvailability (expired as of M82)
- Navigation.CommitTimeout.NetworkServiceLastCrashTime (expired as of M82)
- Navigation.CommitTimeout.NetworkServicePingTime (expired as of M82)
- Navigation.CommitTimeout.Scheme (expired as of M82)
- Navigation.IsSameProcess.* (expired as of M85)

No behavior changes.

Bug: 1384581, 1088973
Change-Id: I1cac5483f960efcebc62f6839987c007bf987a5a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4442185
Reviewed-by: Luc Nguyen <lucnguyen@google.com>
Commit-Queue: Asami Doi <asamidoi@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Auto-Submit: Asami Doi <asamidoi@chromium.org>
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1134475}
2023-04-24 10:23:54 +00:00
Matthew Denton
e4eac437c7 Linux: Sync AddressTrackerLinux's diffs to the network service
The Network service's cached AddressMap and set of online links
can be out of sync with the browser process because it doesn't
receive updates when the browser process's AddressTrackerLinux receives
updates from the kernel. This CL syncs the diffs to the network
service.

Bug: 1312226, 1383352
Change-Id: I8597dc1f03b6f82c06dd2f4afe9a0325b3b137a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4062625
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Adam Rice <ricea@chromium.org>
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1133607}
2023-04-21 04:58:32 +00:00
Matthew Denton
1ca2b3d26a Sync initial AddressTrackerLinux AddressMap to network service
The network service will use a cached AddressMap and set of online links
to avoid using AddressTrackerLinux in the network service. The first
step is to send an initial version of the AddressMap and set of online
links in the NetworkServiceParams.

This includes a browsertest to check that sending (fake) netlink
messages to the AddressTrackerLinux results in the expected cached
info in the network service.

Bug: 1312226, 1383352
Change-Id: I671f9b85c39a561a4534a57aa4665bb9024d4c95
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4432091
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Adam Rice <ricea@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1132897}
2023-04-20 03:17:56 +00:00
Matt Mueller
e6df72cb1e Reland "Refactor how Chrome Root Store is enabled in builds where it is optional"
(Reland of https://crrev.com/c/4390596 with fixes for a race in a test
and CT errors in tests that only showed up on official builders.)

Previously the choice to use CRS is locked in by
cert_verifier_configuration.cc on the first time it is initialized.
However this would be problematic for enterprise policies especially on
chromeos where the profile policies won't be loaded during the login
screen, so the wrong value could get locked in. Make the policy support
dynamic_refresh, so that it would be applied once the profile policy
loads. Making it support dynamic_refresh also makes the policy more
user-friendly in other scenarios too.

To do this the CRS boolean is added as another parameter to the
CertVerifierWithUpdatableProc factory, so that the factory can create a
new verifier with or without CRS when the parameter changes. The
parameter is saved by the CertVerifierServiceFactory so that all
verifiers created by the factory will use the same setting, and any
existing verifiers created by the factory will be updated to use the new
setting if it changes.

Bug: 1340420, 1352171, 1432297
Validate-Test-Flakiness: skip
Change-Id: I3c04b1c9daf12660894d37ac520528b98c0bc511
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4415805
Commit-Queue: Matt Mueller <mattm@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Igor <igorcov@chromium.org>
Reviewed-by: Sorin Jianu <sorin@chromium.org>
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1129536}
2023-04-12 22:08:37 +00:00
Francois Pierre Doray
34347e7659 Revert "Refactor how Chrome Root Store is enabled in builds where it is optional"
This reverts commit e1f06cd9b6.

Reason for revert: Suspect for crbug.com/1432297

Original change's description:
> Refactor how Chrome Root Store is enabled in builds where it is optional
>
> Previously the choice to use CRS is locked in by
> cert_verifier_configuration.cc on the first time it is initialized.
> However this would be problematic for enterprise policies especially on
> chromeos where the profile policies won't be loaded during the login
> screen, so the wrong value could get locked in. Make the policy support
> dynamic_refresh, so that it would be applied once the profile policy
> loads. Making it support dynamic_refresh also makes the policy more
> user-friendly in other scenarios too.
>
> To do this the CRS boolean is added as another parameter to the
> CertVerifierWithUpdatableProc factory, so that the factory can create a
> new verifier with or without CRS when the parameter changes. The
> parameter is saved by the CertVerifierServiceFactory so that all
> verifiers created by the factory will use the same setting, and any
> existing verifiers created by the factory will be updated to use the new
> setting if it changes.
>
> Bug: 1340420, 1352171
> Change-Id: I4a6ad6abffb1036ab47db1795ed81c7adfaac7a5
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4390596
> Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
> Reviewed-by: Igor <igorcov@chromium.org>
> Reviewed-by: Matthew Denton <mpdenton@chromium.org>
> Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
> Reviewed-by: Sorin Jianu <sorin@chromium.org>
> Commit-Queue: Matt Mueller <mattm@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1128702}

Bug: 1340420, 1352171, 1432297
Change-Id: Ice5dcd0ab4f8c6dda49a07099268c9664dceed98
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4416236
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Francois Pierre Doray <fdoray@chromium.org>
Commit-Queue: Francois Pierre Doray <fdoray@chromium.org>
Auto-Submit: Francois Pierre Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1128848}
2023-04-11 20:03:04 +00:00
Matt Mueller
e1f06cd9b6 Refactor how Chrome Root Store is enabled in builds where it is optional
Previously the choice to use CRS is locked in by
cert_verifier_configuration.cc on the first time it is initialized.
However this would be problematic for enterprise policies especially on
chromeos where the profile policies won't be loaded during the login
screen, so the wrong value could get locked in. Make the policy support
dynamic_refresh, so that it would be applied once the profile policy
loads. Making it support dynamic_refresh also makes the policy more
user-friendly in other scenarios too.

To do this the CRS boolean is added as another parameter to the
CertVerifierWithUpdatableProc factory, so that the factory can create a
new verifier with or without CRS when the parameter changes. The
parameter is saved by the CertVerifierServiceFactory so that all
verifiers created by the factory will use the same setting, and any
existing verifiers created by the factory will be updated to use the new
setting if it changes.

Bug: 1340420, 1352171
Change-Id: I4a6ad6abffb1036ab47db1795ed81c7adfaac7a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4390596
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: Igor <igorcov@chromium.org>
Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Sorin Jianu <sorin@chromium.org>
Commit-Queue: Matt Mueller <mattm@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1128702}
2023-04-11 16:53:33 +00:00
Matt Mueller
4924f22eea Add bottom-up CertVerifier change observer flow.
Add CertVerifier::Observer::OnCertVerifierChanged interface that higher
levels can register for notifications with CertVerifier::AddObserver to
be notified when the CertVerifier configuration changes (currently, by
a Chrome Root Store update, or more things in the future).

This notification is then passed up the stack from the base
MultiThreadedCertVerifier until it reaches CertVerifierServiceImpl,
which sends the notification through the new CertVerifierServiceClient
mojo interface to the MojoCertVerifier, which then passes it back
through the CertVerifier::Observer machinery to invalidate the caches in
CoalescingCertVerifier and CachingCertVerifier which live in the network
service.

Bug: 1427208
Change-Id: I013085f9a3824cfa0240f175bd08b77468771cd9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4368281
Reviewed-by: Adam Rice <ricea@chromium.org>
Reviewed-by: Lambros Lambrou <lambroslambrou@chromium.org>
Reviewed-by: Kunihiko Sakamoto <ksakamoto@chromium.org>
Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Dmitry Titov <dimich@chromium.org>
Commit-Queue: Matt Mueller <mattm@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1127782}
2023-04-07 21:47:57 +00:00
Matthew Denton
09b7b4b509 Fix IsOutOfProcessNetworkService() in unit tests
In some unit tests, ForceCreateNetworkServiceDirectlyForTesting() but
ForceInProcessNetworkService(true) was not. So
IsOutOfProcessNetworkService() returned true even though it wasn't.
So have the former call the latter.

The NetworkService() constructor was using the existing of `registry_`
as an indication that the network service was out of process. That
also wasn't true. So just don't create a BinderRegistry if it's
unused (in the in-process case).

Bug: 1312226
Change-Id: I7aa319b5baa6017b2adf2d634ad22260f762b493
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4371542
Auto-Submit: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Adam Rice <ricea@chromium.org>
Commit-Queue: Adam Rice <ricea@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1122903}
2023-03-28 09:02:49 +00:00