Update On Sun Sep 14 20:31:46 CEST 2025

This commit is contained in:
github-action[bot]
2025-09-14 20:31:46 +02:00
parent 8cbef33280
commit 05b4d8f15a
3362 changed files with 88454 additions and 64751 deletions
+1
View File
@@ -1120,3 +1120,4 @@ Update On Wed Sep 10 20:42:57 CEST 2025
Update On Thu Sep 11 20:34:24 CEST 2025
Update On Fri Sep 12 20:36:01 CEST 2025
Update On Sat Sep 13 20:34:27 CEST 2025
Update On Sun Sep 14 20:31:36 CEST 2025
+4 -4
View File
@@ -1,7 +1,7 @@
{
"version": "20250808",
"text": "",
"link": "",
"text_zh": "",
"link_zh": ""
"text": "I've purchased code signing certificates for all my product Windows apps",
"link": "https://www.txthinking.com/talks/articles/windows-code-sign-en.article",
"text_zh": "我已经为我的所有产品的 Windows 客户端购买了代码签名证书",
"link_zh": "https://www.txthinking.com/talks/articles/windows-code-sign.article"
}
+14 -8
View File
@@ -47,15 +47,21 @@ func ApplyPadding(buffer *buf.Buffer, command byte, userUUID *[]byte, paddingTLS
const xrayBufSize = 8192
func (vc *Conn) ReshapeBuffer(buffer *buf.Buffer) []*buf.Buffer {
if buffer.Len() <= xrayBufSize-PaddingHeaderLen {
const bufferLimit = xrayBufSize - PaddingHeaderLen
if buffer.Len() < bufferLimit {
return []*buf.Buffer{buffer}
}
cutAt := bytes.LastIndex(buffer.Bytes(), tlsApplicationDataStart)
if cutAt == -1 {
cutAt = xrayBufSize / 2
options := N.NewReadWaitOptions(nil, vc)
var buffers []*buf.Buffer
for buffer.Len() >= bufferLimit {
cutAt := bytes.LastIndex(buffer.Bytes(), tlsApplicationDataStart)
if cutAt < 21 || cutAt > bufferLimit {
cutAt = xrayBufSize / 2
}
buffer2 := options.NewBuffer() // ensure the new buffer can send used in vc.WriteBuffer
buf.Must(buf.Error(buffer2.ReadFullFrom(buffer, cutAt)))
buffers = append(buffers, buffer2)
}
buffer2 := N.NewReadWaitOptions(nil, vc).NewBuffer() // ensure the new buffer can send used in vc.WriteBuffer
buffer2.Write(buffer.From(cutAt))
buffer.Truncate(cutAt)
return []*buf.Buffer{buffer, buffer2}
buffers = append(buffers, buffer)
return buffers
}
+3 -1
View File
@@ -1,4 +1,6 @@
// Package vision implements VLESS flow `xtls-rprx-vision` introduced by Xray-core.
//
// same logic as https://github.com/XTLS/Xray-core/blob/v25.9.11/proxy/proxy.go
package vision
import (
@@ -27,7 +29,7 @@ func NewConn(conn net.Conn, tlsConn net.Conn, userUUID uuid.UUID) (*Conn, error)
ExtendedWriter: N.NewExtendedWriter(conn),
Conn: conn,
userUUID: userUUID,
packetsToFilter: 6,
packetsToFilter: 8,
readProcess: true,
readFilterUUID: true,
writeFilterApplicationData: true,
+18 -8
View File
@@ -8033,10 +8033,11 @@ checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
[[package]]
name = "serde"
version = "1.0.219"
version = "1.0.221"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
checksum = "341877e04a22458705eb4e131a1508483c877dca2792b3781d4e5d8a6019ec43"
dependencies = [
"serde_core",
"serde_derive",
]
@@ -8062,10 +8063,19 @@ dependencies = [
]
[[package]]
name = "serde_derive"
version = "1.0.219"
name = "serde_core"
version = "1.0.221"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
checksum = "0c459bc0a14c840cb403fc14b148620de1e0778c96ecd6e0c8c3cacb6d8d00fe"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.221"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6185cf75117e20e62b1ff867b9518577271e58abe0037c40bb4794969355ab0"
dependencies = [
"proc-macro2",
"quote",
@@ -8085,15 +8095,15 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.143"
version = "1.0.144"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d401abef1d108fbd9cbaebc3e46611f4b1021f714a0597a71f41ee463f5f4a5a"
checksum = "56177480b00303e689183f110b4e727bb4211d692c62d4fcd16d02be93077d40"
dependencies = [
"indexmap 2.11.1",
"itoa",
"memchr",
"ryu",
"serde",
"serde_core",
]
[[package]]
@@ -49,7 +49,7 @@
"react-use": "17.6.0",
"rxjs": "7.8.2",
"swr": "2.3.6",
"virtua": "0.43.0",
"virtua": "0.43.1",
"vite-bundle-visualizer": "1.2.1"
},
"devDependencies": {
@@ -59,9 +59,9 @@
"@iconify/json": "2.2.383",
"@monaco-editor/react": "4.7.0",
"@tanstack/react-query": "5.87.4",
"@tanstack/react-router": "1.131.36",
"@tanstack/react-router-devtools": "1.131.36",
"@tanstack/router-plugin": "1.131.36",
"@tanstack/react-router": "1.131.41",
"@tanstack/react-router-devtools": "1.131.42",
"@tanstack/router-plugin": "1.131.43",
"@tauri-apps/plugin-clipboard-manager": "2.3.0",
"@tauri-apps/plugin-dialog": "2.4.0",
"@tauri-apps/plugin-fs": "2.4.2",
@@ -93,6 +93,6 @@
"vite-plugin-sass-dts": "1.3.31",
"vite-plugin-svgr": "4.5.0",
"vite-tsconfig-paths": "5.1.4",
"zod": "4.1.5"
"zod": "4.1.8"
}
}
@@ -119,6 +119,9 @@ const ProxyGuardInterval = () => {
)
}
const DEFAULT_BYPASS =
'localhost;127.;192.168.;10.;172.16.;172.17.;172.18.;172.19.;172.20.;172.21.;172.22.;172.23.;172.24.;172.25.;172.26.;172.27.;172.28.;172.29.;172.30.;172.31.*'
const SystemProxyBypass = () => {
const { t } = useTranslation()
@@ -129,7 +132,13 @@ const SystemProxyBypass = () => {
label={t('Proxy Bypass')}
value={systemProxyBypass.data || ''}
onApply={(value) => {
systemProxyBypass.upsert(value)
if (!value || value.trim() === '') {
// 输入为空 → 重置为默认规则
systemProxyBypass.upsert(DEFAULT_BYPASS)
} else {
// 正常写入用户配置
systemProxyBypass.upsert(value)
}
}}
/>
)
+2 -2
View File
@@ -2,7 +2,7 @@
"manifest_version": 1,
"latest": {
"mihomo": "v1.19.13",
"mihomo_alpha": "alpha-4f4f13d",
"mihomo_alpha": "alpha-cea29e2",
"clash_rs": "v0.9.0",
"clash_premium": "2023-09-05-gdcc8d87",
"clash_rs_alpha": "0.9.0-alpha+sha.50f295d"
@@ -69,5 +69,5 @@
"linux-armv7hf": "clash-armv7-unknown-linux-gnueabihf"
}
},
"updated_at": "2025-09-12T22:20:41.506Z"
"updated_at": "2025-09-13T22:20:30.078Z"
}
+1 -1
View File
@@ -78,7 +78,7 @@
"eslint-import-resolver-alias": "1.1.2",
"eslint-plugin-html": "8.1.3",
"eslint-plugin-import": "2.32.0",
"eslint-plugin-n": "17.21.3",
"eslint-plugin-n": "17.22.0",
"eslint-plugin-prettier": "5.5.4",
"eslint-plugin-promise": "7.2.1",
"eslint-plugin-react": "7.37.5",
+61 -81
View File
@@ -83,8 +83,8 @@ importers:
specifier: 2.32.0
version: 2.32.0(@typescript-eslint/parser@8.43.0(eslint@9.35.0(jiti@2.5.1))(typescript@5.9.2))(eslint@9.35.0(jiti@2.5.1))
eslint-plugin-n:
specifier: 17.21.3
version: 17.21.3(eslint@9.35.0(jiti@2.5.1))(typescript@5.9.2)
specifier: 17.22.0
version: 17.22.0(eslint@9.35.0(jiti@2.5.1))(typescript@5.9.2)
eslint-plugin-prettier:
specifier: 5.5.4
version: 5.5.4(eslint-config-prettier@10.1.8(eslint@9.35.0(jiti@2.5.1)))(eslint@9.35.0(jiti@2.5.1))(prettier@3.6.2)
@@ -253,7 +253,7 @@ importers:
version: 4.1.13
'@tanstack/router-zod-adapter':
specifier: 1.81.5
version: 1.81.5(@tanstack/react-router@1.131.36(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(zod@4.1.5)
version: 1.81.5(@tanstack/react-router@1.131.41(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(zod@4.1.8)
'@tauri-apps/api':
specifier: 2.8.0
version: 2.8.0
@@ -330,8 +330,8 @@ importers:
specifier: 2.3.6
version: 2.3.6(react@19.1.1)
virtua:
specifier: 0.43.0
version: 0.43.0(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(solid-js@1.9.5)
specifier: 0.43.1
version: 0.43.1(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(solid-js@1.9.5)
vite-bundle-visualizer:
specifier: 1.2.1
version: 1.2.1(rollup@4.46.2)
@@ -355,14 +355,14 @@ importers:
specifier: 5.87.4
version: 5.87.4(react@19.1.1)
'@tanstack/react-router':
specifier: 1.131.36
version: 1.131.36(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
specifier: 1.131.41
version: 1.131.41(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
'@tanstack/react-router-devtools':
specifier: 1.131.36
version: 1.131.36(@tanstack/react-router@1.131.36(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(@tanstack/router-core@1.131.36)(csstype@3.1.3)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(solid-js@1.9.5)(tiny-invariant@1.3.3)
specifier: 1.131.42
version: 1.131.42(@tanstack/react-router@1.131.41(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(@tanstack/router-core@1.131.41)(csstype@3.1.3)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(solid-js@1.9.5)(tiny-invariant@1.3.3)
'@tanstack/router-plugin':
specifier: 1.131.36
version: 1.131.36(@tanstack/react-router@1.131.36(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(vite@7.1.5(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.92.1)(sass@1.92.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1))
specifier: 1.131.43
version: 1.131.43(@tanstack/react-router@1.131.41(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(vite@7.1.5(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.92.1)(sass@1.92.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1))
'@tauri-apps/plugin-clipboard-manager':
specifier: 2.3.0
version: 2.3.0
@@ -457,8 +457,8 @@ importers:
specifier: 5.1.4
version: 5.1.4(typescript@5.9.2)(vite@7.1.5(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.92.1)(sass@1.92.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1))
zod:
specifier: 4.1.5
version: 4.1.5
specifier: 4.1.8
version: 4.1.8
frontend/ui:
dependencies:
@@ -575,8 +575,8 @@ importers:
specifier: 7.7.2
version: 7.7.2
zod:
specifier: 4.1.5
version: 4.1.5
specifier: 4.1.8
version: 4.1.8
devDependencies:
'@octokit/types':
specifier: 14.1.0
@@ -1696,12 +1696,6 @@ packages:
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || >=8.0.0
'@eslint-community/eslint-utils@4.7.0':
resolution: {integrity: sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || >=8.0.0
'@eslint-community/eslint-utils@4.8.0':
resolution: {integrity: sha512-MJQFqrZgcW0UNYLGOuQpey/oTN59vyWwplvCGZztn1cKz9agZPPYpJB7h2OMmuu7VLqkvEjN8feFZJmxNF9D+Q==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@@ -3034,16 +3028,16 @@ packages:
peerDependencies:
react: ^18 || ^19
'@tanstack/react-router-devtools@1.131.36':
resolution: {integrity: sha512-2huBmW+mqPoJs6ZHfjuunEkVRfgWZh67IUjgdSyqdaYGLa3qsG3zcG4bpTIq6HwJuzcK00JRM3AQ4NLPdttaJQ==}
'@tanstack/react-router-devtools@1.131.42':
resolution: {integrity: sha512-7pymFB1CCimRHot2Zp0ZekQjd1iN812V88n9NLPSeiv9sVRtRVIaLphJjDeudx1NNgkfSJPx2lOhz6K38cuZog==}
engines: {node: '>=12'}
peerDependencies:
'@tanstack/react-router': ^1.131.36
'@tanstack/react-router': ^1.131.41
react: '>=18.0.0 || >=19.0.0'
react-dom: '>=18.0.0 || >=19.0.0'
'@tanstack/react-router@1.131.36':
resolution: {integrity: sha512-9tglm3Rf9qkANBIyYLbGlOjNj7GDBr0jOEOaADfwiGV3Ua3P562MGn7nHUOrfRfA6u2MCg0EKJ+LH7AeWxAqkg==}
'@tanstack/react-router@1.131.41':
resolution: {integrity: sha512-QEbTYpAosiD8e4qEZRr9aJipGSb8pQc+pfZwK6NCD2Tcxwu2oF6MVtwv0bIDLRpZP0VJMBpxXlTRISUDNMNqIA==}
engines: {node: '>=12'}
peerDependencies:
react: '>=18.0.0 || >=19.0.0'
@@ -3068,15 +3062,15 @@ packages:
react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
'@tanstack/router-core@1.131.36':
resolution: {integrity: sha512-faGrKwrJBjJDxbcyeaOXgQcyccmzIGkwk+tnFeJuMTnH5OMfArykYnTZ9BxIrlOY2Mori9DXmYKMlig6mVqmGA==}
'@tanstack/router-core@1.131.41':
resolution: {integrity: sha512-VoLly00DWM0abKuVPRm8wiwGtRBHOKs6K896fy48Q/KYoDVLs8kRCRjFGS7rGnYC2FIkmmvHqYRqNg7jgCx2yg==}
engines: {node: '>=12'}
'@tanstack/router-devtools-core@1.131.36':
resolution: {integrity: sha512-ToZVh1kBAcOt4lp7p/v9g4cjbSBlodxngIFx+lvmhCZ7Y+SG7Y6uP7ivw8WsUAdXAWLzIhIW6Jg57TT7sz8tkg==}
'@tanstack/router-devtools-core@1.131.42':
resolution: {integrity: sha512-o8jKTiwXcUSjmkozcMjIw1yhjVYeXcuQO7DtfgjKW3B85iveH6VzYK+bGEVU7wmLNMuUSe2eI/7RBzJ6a5+MCA==}
engines: {node: '>=12'}
peerDependencies:
'@tanstack/router-core': ^1.131.36
'@tanstack/router-core': ^1.131.41
csstype: ^3.0.10
solid-js: '>=1.9.5'
tiny-invariant: ^1.3.3
@@ -3084,16 +3078,16 @@ packages:
csstype:
optional: true
'@tanstack/router-generator@1.131.36':
resolution: {integrity: sha512-Rl1Q2DFcAFXaYSvHQwO+HKmp5zSBz8D3qZl+fJ0a0w4/2I+Km1xwjzDwBUkFVNJtTUor40uU76SYJzV0/9s1tw==}
'@tanstack/router-generator@1.131.41':
resolution: {integrity: sha512-HsDkBU1u/KvHrzn76v/9oeyMFuxvVlE3dfIu4fldZbPy/i903DWBwODIDGe6fVUsYtzPPrRvNtbjV18HVz5GCA==}
engines: {node: '>=12'}
'@tanstack/router-plugin@1.131.36':
resolution: {integrity: sha512-EU/NopEkQw3AyjZvB33r4uIfUtbU64rbdJDCgGfumv1wpi/B4lJTO9W6iiUsoIsi1mtlNQKbFKNIbx+VyGh19Q==}
'@tanstack/router-plugin@1.131.43':
resolution: {integrity: sha512-vBPBw5LBl+ogGZnFVyLmH65rYnr88cKRT1WtDZ+QYNsgto/SQbD+JxJgbm8YJdpteo3KZL6zHyZz30nmwbhC4A==}
engines: {node: '>=12'}
peerDependencies:
'@rsbuild/core': '>=1.0.2'
'@tanstack/react-router': ^1.131.36
'@tanstack/react-router': ^1.131.41
vite: '>=5.0.0 || >=6.0.0'
vite-plugin-solid: ^2.11.2
webpack: '>=5.92.0'
@@ -4777,10 +4771,6 @@ packages:
end-of-stream@1.4.4:
resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==}
enhanced-resolve@5.18.1:
resolution: {integrity: sha512-ZSW3ma5GkcQBIpwZTSRAI8N71Uuwgs93IezB7mf7R60tC8ZbJideoDNKjHn2O9KIlx6rkGTTEk1xUCK2E1Y2Yg==}
engines: {node: '>=10.13.0'}
enhanced-resolve@5.18.3:
resolution: {integrity: sha512-d4lC8xfavMeBjzGr2vECC3fsGXziXZQyJxD868h2M/mBI3PwAuODxAkLkq5HYuvrPYcUtiLzsTo8U3PgX3Ocww==}
engines: {node: '>=10.13.0'}
@@ -5005,8 +4995,8 @@ packages:
'@typescript-eslint/parser':
optional: true
eslint-plugin-n@17.21.3:
resolution: {integrity: sha512-MtxYjDZhMQgsWRm/4xYLL0i2EhusWT7itDxlJ80l1NND2AL2Vi5Mvneqv/ikG9+zpran0VsVRXTEHrpLmUZRNw==}
eslint-plugin-n@17.22.0:
resolution: {integrity: sha512-+YQ4dW8gg3eVZ3A8lL6zugEmA+Le5IEpCXsI8vKvDvSIB8gEh2N3PKqDwI+J8uLb7nphTJkwiv2e5OlnEDNvpQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
eslint: '>=8.23.0'
@@ -8397,8 +8387,8 @@ packages:
vfile@6.0.1:
resolution: {integrity: sha512-1bYqc7pt6NIADBJ98UiG0Bn/CHIVOoZ/IyEkqIruLg0mE1BKzkOXY2D6CSqQIcKqgadppE5lrxgWXJmXd7zZJw==}
virtua@0.43.0:
resolution: {integrity: sha512-sUjpvYcJ2UBq3RoES65BFt8SQvVllN8JWScGR1ETKW15GgocaDW4+R1ZriYdUGejFfFZkPEF02WsFOMhiyjqEw==}
virtua@0.43.1:
resolution: {integrity: sha512-379ETgqWgzugIJ/crFxNGbqUSMUv0cGxJdpXC7SYvsUpdFWzaqFJIz1XXnJVlTjmE5CYjT+2ipQvAn5N9efGag==}
peerDependencies:
react: '>=16.14.0'
react-dom: '>=16.14.0'
@@ -8694,8 +8684,8 @@ packages:
zod@3.25.76:
resolution: {integrity: sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==}
zod@4.1.5:
resolution: {integrity: sha512-rcUUZqlLJgBC33IT3PNMgsCq6TzLQEG/Ei/KTCU0PedSWRMAXoOUN+4t/0H+Q8bdnLPdqUYnvboJT0bn/229qg==}
zod@4.1.8:
resolution: {integrity: sha512-5R1P+WwQqmmMIEACyzSvo4JXHY5WiAFHRMg+zBZKgKS+Q1viRa0C1hmUKtHltoIFKtIdki3pRxkmpP74jnNYHQ==}
zwitch@2.0.4:
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
@@ -10086,11 +10076,6 @@ snapshots:
eslint: 9.35.0(jiti@2.5.1)
eslint-visitor-keys: 3.4.3
'@eslint-community/eslint-utils@4.7.0(eslint@9.35.0(jiti@2.5.1))':
dependencies:
eslint: 9.35.0(jiti@2.5.1)
eslint-visitor-keys: 3.4.3
'@eslint-community/eslint-utils@4.8.0(eslint@9.35.0(jiti@2.5.1))':
dependencies:
eslint: 9.35.0(jiti@2.5.1)
@@ -11306,10 +11291,10 @@ snapshots:
'@tanstack/query-core': 5.87.4
react: 19.1.1
'@tanstack/react-router-devtools@1.131.36(@tanstack/react-router@1.131.36(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(@tanstack/router-core@1.131.36)(csstype@3.1.3)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(solid-js@1.9.5)(tiny-invariant@1.3.3)':
'@tanstack/react-router-devtools@1.131.42(@tanstack/react-router@1.131.41(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(@tanstack/router-core@1.131.41)(csstype@3.1.3)(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(solid-js@1.9.5)(tiny-invariant@1.3.3)':
dependencies:
'@tanstack/react-router': 1.131.36(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
'@tanstack/router-devtools-core': 1.131.36(@tanstack/router-core@1.131.36)(csstype@3.1.3)(solid-js@1.9.5)(tiny-invariant@1.3.3)
'@tanstack/react-router': 1.131.41(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
'@tanstack/router-devtools-core': 1.131.42(@tanstack/router-core@1.131.41)(csstype@3.1.3)(solid-js@1.9.5)(tiny-invariant@1.3.3)
react: 19.1.1
react-dom: 19.1.1(react@19.1.1)
transitivePeerDependencies:
@@ -11318,11 +11303,11 @@ snapshots:
- solid-js
- tiny-invariant
'@tanstack/react-router@1.131.36(react-dom@19.1.1(react@19.1.1))(react@19.1.1)':
'@tanstack/react-router@1.131.41(react-dom@19.1.1(react@19.1.1))(react@19.1.1)':
dependencies:
'@tanstack/history': 1.131.2
'@tanstack/react-store': 0.7.0(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
'@tanstack/router-core': 1.131.36
'@tanstack/router-core': 1.131.41
isbot: 5.1.28
react: 19.1.1
react-dom: 19.1.1(react@19.1.1)
@@ -11348,7 +11333,7 @@ snapshots:
react: 19.1.1
react-dom: 19.1.1(react@19.1.1)
'@tanstack/router-core@1.131.36':
'@tanstack/router-core@1.131.41':
dependencies:
'@tanstack/history': 1.131.2
'@tanstack/store': 0.7.0
@@ -11358,9 +11343,9 @@ snapshots:
tiny-invariant: 1.3.3
tiny-warning: 1.0.3
'@tanstack/router-devtools-core@1.131.36(@tanstack/router-core@1.131.36)(csstype@3.1.3)(solid-js@1.9.5)(tiny-invariant@1.3.3)':
'@tanstack/router-devtools-core@1.131.42(@tanstack/router-core@1.131.41)(csstype@3.1.3)(solid-js@1.9.5)(tiny-invariant@1.3.3)':
dependencies:
'@tanstack/router-core': 1.131.36
'@tanstack/router-core': 1.131.41
clsx: 2.1.1
goober: 2.1.16(csstype@3.1.3)
solid-js: 1.9.5
@@ -11368,9 +11353,9 @@ snapshots:
optionalDependencies:
csstype: 3.1.3
'@tanstack/router-generator@1.131.36':
'@tanstack/router-generator@1.131.41':
dependencies:
'@tanstack/router-core': 1.131.36
'@tanstack/router-core': 1.131.41
'@tanstack/router-utils': 1.131.2
'@tanstack/virtual-file-routes': 1.131.2
prettier: 3.6.2
@@ -11381,7 +11366,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@tanstack/router-plugin@1.131.36(@tanstack/react-router@1.131.36(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(vite@7.1.5(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.92.1)(sass@1.92.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1))':
'@tanstack/router-plugin@1.131.43(@tanstack/react-router@1.131.41(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(vite@7.1.5(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.92.1)(sass@1.92.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1))':
dependencies:
'@babel/core': 7.28.3
'@babel/plugin-syntax-jsx': 7.27.1(@babel/core@7.28.3)
@@ -11389,8 +11374,8 @@ snapshots:
'@babel/template': 7.27.2
'@babel/traverse': 7.28.3
'@babel/types': 7.28.2
'@tanstack/router-core': 1.131.36
'@tanstack/router-generator': 1.131.36
'@tanstack/router-core': 1.131.41
'@tanstack/router-generator': 1.131.41
'@tanstack/router-utils': 1.131.2
'@tanstack/virtual-file-routes': 1.131.2
babel-dead-code-elimination: 1.0.10
@@ -11398,7 +11383,7 @@ snapshots:
unplugin: 2.3.9
zod: 3.25.76
optionalDependencies:
'@tanstack/react-router': 1.131.36(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
'@tanstack/react-router': 1.131.41(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
vite: 7.1.5(@types/node@24.3.1)(jiti@2.5.1)(less@4.2.0)(lightningcss@1.30.1)(sass-embedded@1.92.1)(sass@1.92.1)(stylus@0.62.0)(terser@5.36.0)(tsx@4.20.5)(yaml@2.8.1)
transitivePeerDependencies:
- supports-color
@@ -11414,10 +11399,10 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@tanstack/router-zod-adapter@1.81.5(@tanstack/react-router@1.131.36(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(zod@4.1.5)':
'@tanstack/router-zod-adapter@1.81.5(@tanstack/react-router@1.131.41(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(zod@4.1.8)':
dependencies:
'@tanstack/react-router': 1.131.36(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
zod: 4.1.5
'@tanstack/react-router': 1.131.41(react-dom@19.1.1(react@19.1.1))(react@19.1.1)
zod: 4.1.8
'@tanstack/store@0.7.0': {}
@@ -11923,7 +11908,7 @@ snapshots:
'@typescript-eslint/utils@8.41.0(eslint@9.35.0(jiti@2.5.1))(typescript@5.9.2)':
dependencies:
'@eslint-community/eslint-utils': 4.7.0(eslint@9.35.0(jiti@2.5.1))
'@eslint-community/eslint-utils': 4.8.0(eslint@9.35.0(jiti@2.5.1))
'@typescript-eslint/scope-manager': 8.41.0
'@typescript-eslint/types': 8.41.0
'@typescript-eslint/typescript-estree': 8.41.0(typescript@5.9.2)
@@ -13205,11 +13190,6 @@ snapshots:
dependencies:
once: 1.4.0
enhanced-resolve@5.18.1:
dependencies:
graceful-fs: 4.2.11
tapable: 2.2.1
enhanced-resolve@5.18.3:
dependencies:
graceful-fs: 4.2.11
@@ -13575,7 +13555,7 @@ snapshots:
eslint-plugin-es-x@7.8.0(eslint@9.35.0(jiti@2.5.1)):
dependencies:
'@eslint-community/eslint-utils': 4.7.0(eslint@9.35.0(jiti@2.5.1))
'@eslint-community/eslint-utils': 4.8.0(eslint@9.35.0(jiti@2.5.1))
'@eslint-community/regexpp': 4.12.1
eslint: 9.35.0(jiti@2.5.1)
eslint-compat-utils: 0.5.1(eslint@9.35.0(jiti@2.5.1))
@@ -13631,10 +13611,10 @@ snapshots:
- eslint-import-resolver-webpack
- supports-color
eslint-plugin-n@17.21.3(eslint@9.35.0(jiti@2.5.1))(typescript@5.9.2):
eslint-plugin-n@17.22.0(eslint@9.35.0(jiti@2.5.1))(typescript@5.9.2):
dependencies:
'@eslint-community/eslint-utils': 4.7.0(eslint@9.35.0(jiti@2.5.1))
enhanced-resolve: 5.18.1
'@eslint-community/eslint-utils': 4.8.0(eslint@9.35.0(jiti@2.5.1))
enhanced-resolve: 5.18.3
eslint: 9.35.0(jiti@2.5.1)
eslint-plugin-es-x: 7.8.0(eslint@9.35.0(jiti@2.5.1))
get-tsconfig: 4.10.1
@@ -15425,7 +15405,7 @@ snapshots:
eslint: 9.35.0(jiti@2.5.1)
eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import-x@4.16.1(@typescript-eslint/utils@8.43.0(eslint@9.35.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.35.0(jiti@2.5.1)))(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.43.0(eslint@9.35.0(jiti@2.5.1))(typescript@5.9.2))(eslint@9.35.0(jiti@2.5.1)))(eslint@9.35.0(jiti@2.5.1))
eslint-plugin-import-x: 4.16.1(@typescript-eslint/utils@8.43.0(eslint@9.35.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.35.0(jiti@2.5.1))
eslint-plugin-n: 17.21.3(eslint@9.35.0(jiti@2.5.1))(typescript@5.9.2)
eslint-plugin-n: 17.22.0(eslint@9.35.0(jiti@2.5.1))(typescript@5.9.2)
eslint-plugin-promise: 7.2.1(eslint@9.35.0(jiti@2.5.1))
eslint-plugin-react: 7.37.5(eslint@9.35.0(jiti@2.5.1))
find-up: 5.0.0
@@ -17428,7 +17408,7 @@ snapshots:
unist-util-stringify-position: 4.0.0
vfile-message: 4.0.2
virtua@0.43.0(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(solid-js@1.9.5):
virtua@0.43.1(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(solid-js@1.9.5):
optionalDependencies:
react: 19.1.1
react-dom: 19.1.1(react@19.1.1)
@@ -17750,6 +17730,6 @@ snapshots:
zod@3.25.76: {}
zod@4.1.5: {}
zod@4.1.8: {}
zwitch@2.0.4: {}
+1 -1
View File
@@ -10,7 +10,7 @@
"filesize": "11.0.2",
"p-retry": "7.0.0",
"semver": "7.7.2",
"zod": "4.1.5"
"zod": "4.1.8"
},
"devDependencies": {
"@octokit/types": "14.1.0",
@@ -221,6 +221,7 @@ CONFIG_HAS_IOPORT_MAP=y
CONFIG_HWMON=y
CONFIG_HW_RANDOM=y
CONFIG_HW_RANDOM_MTK=y
CONFIG_HW_RANDOM_MTK_V2=y
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_CHARDEV=y
@@ -220,6 +220,7 @@ CONFIG_HAS_IOPORT_MAP=y
CONFIG_HWMON=y
CONFIG_HW_RANDOM=y
CONFIG_HW_RANDOM_MTK=y
# CONFIG_HW_RANDOM_MTK_V2 is not set
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_CHARDEV=y
@@ -315,6 +315,7 @@ CONFIG_HOTPLUG_CPU=y
CONFIG_HWMON=y
CONFIG_HW_RANDOM=y
CONFIG_HW_RANDOM_MTK=y
# CONFIG_HW_RANDOM_MTK_V2 is not set
CONFIG_HZ_FIXED=0
CONFIG_I2C=y
CONFIG_I2C_ALGOBIT=y
@@ -160,6 +160,7 @@ CONFIG_HOTPLUG_CORE_SYNC_DEAD=y
CONFIG_HOTPLUG_CPU=y
CONFIG_HW_RANDOM=y
CONFIG_HW_RANDOM_MTK=y
# CONFIG_HW_RANDOM_MTK_V2 is not set
CONFIG_HZ_FIXED=0
# CONFIG_IDPF is not set
CONFIG_INITRAMFS_SOURCE=""
@@ -0,0 +1,133 @@
From 9837930d6738e9fdc323ad887ace7c236a61d70c Mon Sep 17 00:00:00 2001
From: Daniel Golle <daniel@makrotopia.org>
Date: Wed, 25 Jan 2023 00:27:49 +0000
Subject: [PATCH] hwrng: add driver for MediaTek TRNG SMC
Add driver providing kernel-side support for the Random Number
Generator hardware found on Mediatek SoCs which have a driver in ARM
TrustedFirmware-A allowing Linux to read random numbers using a
non-standard vendor-defined Secure Monitor Call.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
drivers/char/hw_random/Kconfig | 16 +++++++
drivers/char/hw_random/Makefile | 1 +
drivers/char/hw_random/mtk-rng-v2.c | 74 +++++++++++++++++++++++++++++
3 files changed, 91 insertions(+)
create mode 100644 drivers/char/hw_random/mtk-rng-v2.c
--- a/drivers/char/hw_random/Kconfig
+++ b/drivers/char/hw_random/Kconfig
@@ -451,6 +451,23 @@ config HW_RANDOM_MTK
If unsure, say Y.
+config HW_RANDOM_MTK_V2
+ tristate "Mediatek Random Number Generator support (v2/SMC)"
+ depends on HAVE_ARM_SMCCC
+ depends on HW_RANDOM
+ depends on (ARM64 && ARCH_MEDIATEK) || COMPILE_TEST
+ default y
+ help
+ This driver provides kernel-side support for the Random Number
+ Generator hardware found on Mediatek SoCs which have a driver
+ in ARM TrustedFirmware-A allowing Linux to read using a non-
+ standard vendor-defined Secure Monitor Call.
+
+ To compile this driver as a module, choose M here. the
+ module will be called mtk-rng-v2.
+
+ If unsure, say Y.
+
config HW_RANDOM_S390
tristate "S390 True Random Number Generator support"
depends on S390
--- a/drivers/char/hw_random/Makefile
+++ b/drivers/char/hw_random/Makefile
@@ -39,6 +39,7 @@ obj-$(CONFIG_HW_RANDOM_PIC32) += pic32-r
obj-$(CONFIG_HW_RANDOM_MESON) += meson-rng.o
obj-$(CONFIG_HW_RANDOM_CAVIUM) += cavium-rng.o cavium-rng-vf.o
obj-$(CONFIG_HW_RANDOM_MTK) += mtk-rng.o
+obj-$(CONFIG_HW_RANDOM_MTK_V2) += mtk-rng-v2.o
obj-$(CONFIG_HW_RANDOM_S390) += s390-trng.o
obj-$(CONFIG_HW_RANDOM_KEYSTONE) += ks-sa-rng.o
obj-$(CONFIG_HW_RANDOM_OPTEE) += optee-rng.o
--- /dev/null
+++ b/drivers/char/hw_random/mtk-rng-v2.c
@@ -0,0 +1,76 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Driver for Mediatek Hardware Random Number Generator (v2/SMCC)
+ *
+ * Copyright (C) 2023 Daniel Golle <daniel@makrotopia.org>
+ * based on patch from Mingming Su <Mingming.Su@mediatek.com>
+ */
+#define MTK_RNG_DEV KBUILD_MODNAME
+
+#include <linux/arm-smccc.h>
+#include <linux/err.h>
+#include <linux/hw_random.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <linux/soc/mediatek/mtk_sip_svc.h>
+
+#define MTK_SIP_KERNEL_GET_RND MTK_SIP_SMC_CMD(0x550)
+
+static int mtk_rng_v2_read(struct hwrng *rng, void *buf, size_t max, bool wait)
+{
+ struct arm_smccc_res res;
+ int retval = 0;
+
+ while (max >= sizeof(u32)) {
+ arm_smccc_smc(MTK_SIP_KERNEL_GET_RND, 0, 0, 0, 0, 0, 0, 0,
+ &res);
+ if (res.a0)
+ break;
+
+ *(u32 *)buf = res.a1;
+ retval += sizeof(u32);
+ buf += sizeof(u32);
+ max -= sizeof(u32);
+ }
+
+ return retval || !wait ? retval : -EIO;
+}
+
+static int mtk_rng_v2_probe(struct platform_device *pdev)
+{
+ struct hwrng *trng;
+
+ trng = devm_kzalloc(&pdev->dev, sizeof(*trng), GFP_KERNEL);
+ if (!trng)
+ return -ENOMEM;
+
+ trng->name = pdev->name;
+ trng->read = mtk_rng_v2_read;
+ trng->quality = 900;
+
+ return devm_hwrng_register(&pdev->dev, trng);
+}
+
+static const struct of_device_id mtk_rng_v2_match[] = {
+ { .compatible = "mediatek,mt7981-rng" },
+ { .compatible = "mediatek,mt7987-rng" },
+ { .compatible = "mediatek,mt7988-rng" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, mtk_rng_v2_match);
+
+static struct platform_driver mtk_rng_v2_driver = {
+ .probe = mtk_rng_v2_probe,
+ .driver = {
+ .name = KBUILD_MODNAME,
+ .of_match_table = mtk_rng_v2_match,
+ },
+};
+module_platform_driver(mtk_rng_v2_driver);
+
+MODULE_DESCRIPTION("Mediatek Random Number Generator Driver (v2/SMC)");
+MODULE_AUTHOR("Daniel Golle <daniel@makrotopia.org>");
+MODULE_LICENSE("GPL");
+14 -8
View File
@@ -47,15 +47,21 @@ func ApplyPadding(buffer *buf.Buffer, command byte, userUUID *[]byte, paddingTLS
const xrayBufSize = 8192
func (vc *Conn) ReshapeBuffer(buffer *buf.Buffer) []*buf.Buffer {
if buffer.Len() <= xrayBufSize-PaddingHeaderLen {
const bufferLimit = xrayBufSize - PaddingHeaderLen
if buffer.Len() < bufferLimit {
return []*buf.Buffer{buffer}
}
cutAt := bytes.LastIndex(buffer.Bytes(), tlsApplicationDataStart)
if cutAt == -1 {
cutAt = xrayBufSize / 2
options := N.NewReadWaitOptions(nil, vc)
var buffers []*buf.Buffer
for buffer.Len() >= bufferLimit {
cutAt := bytes.LastIndex(buffer.Bytes(), tlsApplicationDataStart)
if cutAt < 21 || cutAt > bufferLimit {
cutAt = xrayBufSize / 2
}
buffer2 := options.NewBuffer() // ensure the new buffer can send used in vc.WriteBuffer
buf.Must(buf.Error(buffer2.ReadFullFrom(buffer, cutAt)))
buffers = append(buffers, buffer2)
}
buffer2 := N.NewReadWaitOptions(nil, vc).NewBuffer() // ensure the new buffer can send used in vc.WriteBuffer
buffer2.Write(buffer.From(cutAt))
buffer.Truncate(cutAt)
return []*buf.Buffer{buffer, buffer2}
buffers = append(buffers, buffer)
return buffers
}
+3 -1
View File
@@ -1,4 +1,6 @@
// Package vision implements VLESS flow `xtls-rprx-vision` introduced by Xray-core.
//
// same logic as https://github.com/XTLS/Xray-core/blob/v25.9.11/proxy/proxy.go
package vision
import (
@@ -27,7 +29,7 @@ func NewConn(conn net.Conn, tlsConn net.Conn, userUUID uuid.UUID) (*Conn, error)
ExtendedWriter: N.NewExtendedWriter(conn),
Conn: conn,
userUUID: userUUID,
packetsToFilter: 6,
packetsToFilter: 8,
readProcess: true,
readFilterUUID: true,
writeFilterApplicationData: true,
+1 -1
View File
@@ -519,7 +519,7 @@ jobs:
openwrt_release: '24.10.0'
openwrt_gcc_ver: '13.3.0'
env:
EXTRA_FLAGS: target_cpu="${{ matrix.target_cpu }}" target_os="openwrt" ${{ matrix.extra }} enable_shadow_metadata=false
EXTRA_FLAGS: target_cpu="${{ matrix.target_cpu }}" target_os="openwrt" ${{ matrix.extra }}
OPENWRT_FLAGS: arch=${{ matrix.arch }} release=${{ matrix.openwrt_release || '18.06.0' }} gcc_ver=${{ matrix.openwrt_gcc_ver || '7.3.0' }} ${{ matrix.openwrt }}
BUNDLE: naiveproxy-${{ github.event.release.tag_name }}-${{ github.job }}-${{ matrix.arch }}
steps:
+1 -1
View File
@@ -1 +1 @@
139.0.7258.62
140.0.7339.123
+1 -4
View File
@@ -49,7 +49,7 @@ IncludeCategories:
Priority: 5
# ref: https://clang.llvm.org/docs/ClangFormatStyleOptions.html#includeismainregex
IncludeIsMainRegex: "\
(_(32|64|android|apple|chromeos|freebsd|fuchsia|fuzzer|ios|linux|mac|nacl|openbsd|posix|stubs?|win))?\
(_(32|64|android|apple|chromeos|freebsd|fuchsia|fuzzer|ios|linux|mac|openbsd|posix|stubs?|win))?\
(_(unit|browser|perf)?tests?)?$"
# Make sure code like:
@@ -65,8 +65,6 @@ CR_BEGIN_MSG_MAP_EX|\
IPC_BEGIN_MESSAGE_MAP|\
IPC_BEGIN_MESSAGE_MAP_WITH_PARAM|\
IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN|\
IPC_STRUCT_BEGIN|\
IPC_STRUCT_BEGIN_WITH_PARENT|\
IPC_STRUCT_TRAITS_BEGIN|\
POLPARAMS_BEGIN|\
PPAPI_BEGIN_MESSAGE_MAP$"
@@ -75,7 +73,6 @@ CR_END_MSG_MAP|\
END_MSG_MAP|\
IPC_END_MESSAGE_MAP|\
IPC_PROTOBUF_MESSAGE_TRAITS_END|\
IPC_STRUCT_END|\
IPC_STRUCT_TRAITS_END|\
POLPARAMS_END|\
PPAPI_END_MESSAGE_MAP$"
+12
View File
@@ -100,6 +100,7 @@ Alper Çakan <alpercakan98@gmail.com>
Alvaro Silva <alvaro.fagner@gmail.com>
Ambareesh Balaji <ambareeshbalaji@gmail.com>
Ambarish Rapte <ambarish.r@samsung.com>
Ameen Basha <ameenbasha111@gmail.com>
Amey Jahagirdar <jahagird@amazon.com>
Amit Paul <a.paul@samsung.com>
Amit Sarkar <amit.srkr@samsung.com>
@@ -187,6 +188,7 @@ Ayush Dubey <dubeyaayush07@gmail.com>
Ayush Khandelwal <k.ayush@samsung.com>
Azhar Shaikh <azhar.shaikh@intel.com>
Balazs Kelemen <b.kelemen@samsung.com>
Baoyu Xu <xubaoyu@bytedance.com>
Baul Eun <baul.eun@samsung.com>
Behara Mani Shyam Patro <behara.ms@samsung.com>
Bem Jones-Bey <bemajaniman@gmail.com>
@@ -460,6 +462,7 @@ Fernando Jiménez Moreno <ferjmoreno@gmail.com>
Finbar Crago <finbar.crago@gmail.com>
François Beaufort <beaufort.francois@gmail.com>
François Devatine <devatine@verizonmedia.com>
Franco Pieri <geo22therm@gmail.com>
Francois Kritzinger <francoisk777@gmail.com>
Francois Rauch <leopardb@gmail.com>
Frankie Dintino <fdintino@theatlantic.com>
@@ -506,6 +509,7 @@ Guangzhen Li <guangzhen.li@intel.com>
Guobin Wu <wuguobin.1229@bytedance.com>
Gurpreet Kaur <k.gurpreet@samsung.com>
Gustav Tiger <gustav.tiger@sonymobile.com>
Gustavo Martin <gusmartin@google.com>
Gyuyoung Kim <gyuyoung.kim@navercorp.com>
Gzob Qq <gzobqq@gmail.com>
Habib Virji <habib.virji@samsung.com>
@@ -526,6 +530,7 @@ Haoxuan Zhang <zhanghaoxuan.59@bytedance.com>
Hari Singh <hari.singh1@samsung.com>
Harpreet Singh Khurana <harpreet.sk@samsung.com>
Harry Chen <harpsichen@gmail.com>
Harsh Singh <harshsinghiitism@gmail.com>
Harshal Gupta <gupta.h@samsung.com>
Harshikesh Kumar <harshikeshnobug@gmail.com>
Harshit Pal <harshitp12345@gmail.com>
@@ -699,6 +704,7 @@ Jihun Brent Kim <devgrapher@gmail.com>
Jihwan Marc Kim <bluewhale.marc@gmail.com>
Jihye Hyun <jijinny26@gmail.com>
Jihyeon Lee <wlgus7464@gmail.com>
Jim Wu <lofoz.tw@gmail.com>
Jin Yang <jin.a.yang@intel.com>
Jincheol Jo <jincheol.jo@navercorp.com>
Jinfeng Ma <majinfeng1@xiaomi.com>
@@ -1280,6 +1286,7 @@ Ruben Terrazas <rubentopo@gmail.com>
Rufus Hamade <rufus.hamade@imgtec.com>
Ruiyi Luo <luoruiyi2008@gmail.com>
Rulong Chen <rulong.crl@alibaba-inc.com>
Rulong Chen(陈汝龙) <rulongchen@live.com>
Russell Davis <russell.davis@gmail.com>
Ryan Ackley <ryanackley@gmail.com>
Ryan Gonzalez <rymg19@gmail.com>
@@ -1399,6 +1406,7 @@ Simeon Kuran <simeon.kuran@gmail.com>
Simon Arlott <simon.arlott@gmail.com>
Simon Cadman <simon@cadman.uk>
Simon Jackson <simon.jackson@sonocent.com>
Simon Knott <info@simonknott.de>
Simon La Macchia <smacchia@amazon.com>
Siva Kumar Gunturi <siva.gunturi@samsung.com>
Slava Aseev <nullptrnine@gmail.com>
@@ -1577,6 +1585,7 @@ Wanming Lin <wanming.lin@intel.com>
Wei Li <wei.c.li@intel.com>
Weicong Yu <yuweicong666@gmail.com>
Wen Fan <fanwen1@huawei.com>
Wendi Gan <ganwendix@gmail.com>
Wenxiang Qian <leonwxqian@gmail.com>
WenSheng He <wensheng.he@samsung.com>
Wesley Lancel <wesleylancel@gmail.com>
@@ -1627,6 +1636,7 @@ Yash Vempati <vempatiy@amazon.com>
Yash Vinayak <yash.vinayak@samsung.com>
Ye Liu <cbakgly@gmail.com>
Yeol Park <peary2@gmail.com>
Yeonghan Kim <soosungp33@gmail.com>
Yeonwoo Jo <yeonwoo.jo.92@gmail.com>
Yi Shen <yi.shen@samsung.com>
Yi Sun <ratsunny@gmail.com>
@@ -1711,6 +1721,8 @@ Zsolt Borbely <zsborbely.u-szeged@partner.samsung.com>
郑苏波 (Super Zheng) <superzheng@tencent.com>
一丝 (Yisi) <yiorsi@gmail.com>
林训杰 (XunJie Lin) <wick.linxunjie@gmail.com>
郭燚 (Yi Guo) <guoyi122622@gmail.com>
Kevin Wang <wangpengqiang@bytedance.com>
# Please DO NOT APPEND here. See comments at the top of the file.
# END individuals section.
+317 -1290
View File
File diff suppressed because it is too large Load Diff
+35 -18
View File
@@ -208,6 +208,7 @@ component("base") {
"bit_cast.h",
"bits.h",
"build_time.h",
"byte_count.h",
"callback_list.cc",
"callback_list.h",
"cancelable_callback.h",
@@ -415,6 +416,13 @@ component("base") {
"memory/weak_ptr.h",
"memory/writable_shared_memory_region.cc",
"memory/writable_shared_memory_region.h",
"memory_coordinator/async_memory_consumer_registration.cc",
"memory_coordinator/async_memory_consumer_registration.h",
"memory_coordinator/memory_consumer.cc",
"memory_coordinator/memory_consumer.h",
"memory_coordinator/memory_consumer_registry.cc",
"memory_coordinator/memory_consumer_registry.h",
"memory_coordinator/traits.h",
"message_loop/io_watcher.cc",
"message_loop/io_watcher.h",
"message_loop/message_pump.cc",
@@ -1125,7 +1133,13 @@ component("base") {
"android/build_info_stub.cc",
"android/content_uri_utils.h",
"android/content_uri_utils_stub.cc",
"android/virtual_document_path.cc",
"android/virtual_document_path.h",
"android/yield_to_looper_checker.cc",
"android/yield_to_looper_checker.h",
"debug/stack_trace_android.cc",
"files/file_android.cc",
"files/file_android.h",
"files/file_util_android.cc",
"files/scoped_file_android.cc",
"message_loop/message_pump_android.cc",
@@ -1203,11 +1217,12 @@ component("base") {
}
if (is_robolectric) {
sources += [
"android/base_jni_onload.cc",
"android/base_jni_onload.h",
"android/base_jni_init.cc",
"android/base_jni_init.h",
"android/callback_android.cc",
"android/callback_android.h",
"android/command_line_android.cc",
"android/command_line_android.h",
"android/int_string_callback.cc",
"android/int_string_callback.h",
"android/java_exception_reporter.cc",
@@ -1248,20 +1263,9 @@ component("base") {
]
}
if (is_android || is_robolectric) {
public_deps += [ "//third_party/jni_zero:jni_zero" ]
public_deps += [ "//third_party/jni_zero" ]
} # is_android || is_robolectric
if (is_android && !is_robolectric) {
# The robolectic toolchain doesn't provide the NDK headers required for data
# and function type definitions used by BinderApi et al.
sources += [
"android/binder.cc",
"android/binder.h",
"android/binder_box.cc",
"android/binder_box.h",
]
}
# Chromeos.
if (is_chromeos) {
sources += [
@@ -1598,6 +1602,8 @@ component("base") {
"allocator/partition_alloc_features.h",
"allocator/partition_alloc_support.cc",
"allocator/partition_alloc_support.h",
"allocator/scheduler_loop_quarantine_config.cc",
"allocator/scheduler_loop_quarantine_config.h",
]
}
if (use_allocator_shim) {
@@ -2080,10 +2086,16 @@ component("base") {
]
}
# We include launch_mac on simulator builds so unittests can fork. But,
# platforms like tvOS continue to use launch_ios since they do not support
# multi-processes.
if (target_environment == "simulator" && target_platform == "iphoneos") {
# We include launch_mac on simulator builds so unit and browser tests can
# fork.
# iOS-based platforms like tvOS need special treatment in launch_mac.cc
# due to some symbols being marked unavailable despite being present,
# which is why this condition is restricted to specific `target_platform`
# values.
# In all cases, this is restricted to simulator builds because App Store
# restrictions forbid the use of multiple processes in applications.
if (target_environment == "simulator" &&
(target_platform == "iphoneos" || target_platform == "tvos")) {
sources += [
"process/kill_mac.cc",
"process/launch_mac.cc",
@@ -2216,6 +2228,11 @@ component("base") {
# TODO(b/167763382) Find an alternate solution for Chromecast devices, since
# adding the icui18n and icuuc deps significantly increases the binary size.
# This dependency was added to deal with Y2038 problem where time_t is
# represented via int32. However, Android builds specifically have time64
# headers which allows representing time as int64, which makes this entire
# problem moot. Hence, why `!is_cronet_build` flag has been added.
# See crbug.com/431972096#comment10 for more information.
if (false) {
sources += [ "time/time_exploded_icu.cc" ]
+1
View File
@@ -4,3 +4,4 @@ wfh@chromium.org
per-file allocator.gni=file://base/allocator/partition_allocator/OWNERS
per-file partition_alloc*=file://base/allocator/partition_allocator/OWNERS
per-file BUILD.gn=file://base/allocator/partition_allocator/OWNERS
per-file scheduler_loop_quarantine_config*=file://base/allocator/partition_allocator/OWNERS
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "base/allocator/allocator_check.h"
#include "build/build_config.h"
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef BASE_ALLOCATOR_ALLOCATOR_CHECK_H_
#define BASE_ALLOCATOR_ALLOCATOR_CHECK_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef BASE_ALLOCATOR_DISPATCHER_CONFIGURATION_H_
#define BASE_ALLOCATOR_DISPATCHER_CONFIGURATION_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "base/allocator/dispatcher/dispatcher.h"
#include "base/allocator/dispatcher/internal/dispatch_data.h"
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef BASE_ALLOCATOR_DISPATCHER_DISPATCHER_H_
#define BASE_ALLOCATOR_DISPATCHER_DISPATCHER_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef BASE_ALLOCATOR_DISPATCHER_INITIALIZER_H_
#define BASE_ALLOCATOR_DISPATCHER_INITIALIZER_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "base/allocator/dispatcher/internal/dispatch_data.h"
#include "partition_alloc/buildflags.h"
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef BASE_ALLOCATOR_DISPATCHER_INTERNAL_DISPATCH_DATA_H_
#define BASE_ALLOCATOR_DISPATCHER_INTERNAL_DISPATCH_DATA_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef BASE_ALLOCATOR_DISPATCHER_INTERNAL_DISPATCHER_INTERNAL_H_
#define BASE_ALLOCATOR_DISPATCHER_INTERNAL_DISPATCHER_INTERNAL_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef BASE_ALLOCATOR_DISPATCHER_INTERNAL_TOOLS_H_
#define BASE_ALLOCATOR_DISPATCHER_INTERNAL_TOOLS_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "base/allocator/dispatcher/memory_tagging.h"
namespace base::allocator::dispatcher {
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef BASE_ALLOCATOR_DISPATCHER_MEMORY_TAGGING_H_
#define BASE_ALLOCATOR_DISPATCHER_MEMORY_TAGGING_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef BASE_ALLOCATOR_DISPATCHER_NOTIFICATION_DATA_H_
#define BASE_ALLOCATOR_DISPATCHER_NOTIFICATION_DATA_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "base/allocator/dispatcher/reentry_guard.h"
#include "base/check.h"
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef BASE_ALLOCATOR_DISPATCHER_REENTRY_GUARD_H_
#define BASE_ALLOCATOR_DISPATCHER_REENTRY_GUARD_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef BASE_ALLOCATOR_DISPATCHER_SUBSYSTEM_H_
#define BASE_ALLOCATOR_DISPATCHER_SUBSYSTEM_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef BASE_ALLOCATOR_DISPATCHER_TESTING_DISPATCHER_TEST_H_
#define BASE_ALLOCATOR_DISPATCHER_TESTING_DISPATCHER_TEST_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef BASE_ALLOCATOR_DISPATCHER_TESTING_OBSERVER_MOCK_H_
#define BASE_ALLOCATOR_DISPATCHER_TESTING_OBSERVER_MOCK_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef BASE_ALLOCATOR_DISPATCHER_TESTING_TOOLS_H_
#define BASE_ALLOCATOR_DISPATCHER_TESTING_TOOLS_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "base/allocator/dispatcher/tls.h"
#include <string_view>
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef BASE_ALLOCATOR_DISPATCHER_TLS_H_
#define BASE_ALLOCATOR_DISPATCHER_TLS_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "base/allocator/early_zone_registration_apple.h"
#include <mach/mach.h>
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef BASE_ALLOCATOR_EARLY_ZONE_REGISTRATION_APPLE_H_
#define BASE_ALLOCATOR_EARLY_ZONE_REGISTRATION_APPLE_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "base/allocator/miracle_parameter.h"
#include "base/command_line.h"
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef BASE_ALLOCATOR_MIRACLE_PARAMETER_H_
#define BASE_ALLOCATOR_MIRACLE_PARAMETER_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "base/allocator/partition_alloc_features.h"
#include "base/allocator/miracle_parameter.h"
@@ -29,11 +34,6 @@ static constexpr char kBrowserAndRendererStr[] = "browser-and-renderer";
static constexpr char kNonRendererStr[] = "non-renderer";
static constexpr char kAllProcessesStr[] = "all-processes";
#if PA_CONFIG(ENABLE_SHADOW_METADATA)
static constexpr char kRendererOnlyStr[] = "renderer-only";
static constexpr char kAllChildProcessesStr[] = "all-child-processes";
#endif // PA_CONFIG(ENABLE_SHADOW_METADATA)
} // namespace
BASE_FEATURE(kPartitionAllocUnretainedDanglingPtr,
@@ -139,22 +139,12 @@ constinit const FeatureParam<PartitionAllocWithAdvancedChecksEnabledProcesses>
BASE_FEATURE(kPartitionAllocSchedulerLoopQuarantine,
"PartitionAllocSchedulerLoopQuarantine",
FEATURE_DISABLED_BY_DEFAULT);
// Scheduler Loop Quarantine's per-branch capacity in bytes.
// Scheduler Loop Quarantine's config.
// Note: Do not use the prepared macro as of no need for a local cache.
constinit const FeatureParam<int>
kPartitionAllocSchedulerLoopQuarantineBranchCapacity{
constinit const FeatureParam<std::string>
kPartitionAllocSchedulerLoopQuarantineConfig{
&kPartitionAllocSchedulerLoopQuarantine,
"PartitionAllocSchedulerLoopQuarantineBranchCapacity", 0};
// Scheduler Loop Quarantine's capacity for the UI thread in bytes.
BASE_FEATURE_PARAM(int,
kPartitionAllocSchedulerLoopQuarantineBrowserUICapacity,
&kPartitionAllocSchedulerLoopQuarantine,
"PartitionAllocSchedulerLoopQuarantineBrowserUICapacity",
0);
BASE_FEATURE(kPartitionAllocZappingByFreeFlags,
"PartitionAllocZappingByFreeFlags",
FEATURE_DISABLED_BY_DEFAULT);
"PartitionAllocSchedulerLoopQuarantineConfig", "{}"};
BASE_FEATURE(kPartitionAllocEventuallyZeroFreedMemory,
"PartitionAllocEventuallyZeroFreedMemory",
@@ -486,29 +476,6 @@ BASE_FEATURE(kPartitionAllocAdjustSizeWhenInForeground,
FEATURE_DISABLED_BY_DEFAULT);
#endif
#if PA_CONFIG(ENABLE_SHADOW_METADATA)
BASE_FEATURE(kPartitionAllocShadowMetadata,
"PartitionAllocShadowMetadata",
#if BUILDFLAG(IS_LINUX)
FEATURE_ENABLED_BY_DEFAULT);
#else
FEATURE_DISABLED_BY_DEFAULT);
#endif
constexpr FeatureParam<ShadowMetadataEnabledProcesses>::Option
kShadowMetadataEnabledProcessesOptions[] = {
{ShadowMetadataEnabledProcesses::kRendererOnly, kRendererOnlyStr},
{ShadowMetadataEnabledProcesses::kAllChildProcesses,
kAllChildProcessesStr}};
// Note: Do not use the prepared macro as of no need for a local cache.
constinit const FeatureParam<ShadowMetadataEnabledProcesses>
kShadowMetadataEnabledProcessesParam{
&kPartitionAllocShadowMetadata, kPAFeatureEnabledProcessesStr,
ShadowMetadataEnabledProcesses::kRendererOnly,
&kShadowMetadataEnabledProcessesOptions};
#endif // PA_CONFIG(ENABLE_SHADOW_METADATA)
#if PA_BUILDFLAG(ENABLE_PARTITION_LOCK_PRIORITY_INHERITANCE)
BASE_FEATURE(kPartitionAllocUsePriorityInheritanceLocks,
"PartitionAllocUsePriorityInheritanceLocks",
@@ -2,9 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef BASE_ALLOCATOR_PARTITION_ALLOC_FEATURES_H_
#define BASE_ALLOCATOR_PARTITION_ALLOC_FEATURES_H_
#include <string>
#include "base/base_export.h"
#include "base/compiler_specific.h"
#include "base/feature_list.h"
@@ -34,15 +41,6 @@ enum class PAFeatureEnabledProcesses {
kAllProcesses,
};
enum class SchedulerLoopQuarantineBranchType {
// The global quarantine branch, shared across threads.
kGlobal,
// Default configuration for thread-local branches on new threads.
kThreadLocalDefault,
// Specialized configuration for the main thread of a process.
kMain,
};
} // namespace internal
BASE_EXPORT BASE_DECLARE_FEATURE(kPartitionAllocUnretainedDanglingPtr);
@@ -98,17 +96,10 @@ BASE_EXPORT BASE_DECLARE_FEATURE_PARAM(
PartitionAllocWithAdvancedChecksEnabledProcesses,
kPartitionAllocWithAdvancedChecksEnabledProcessesParam);
BASE_EXPORT BASE_DECLARE_FEATURE(kPartitionAllocSchedulerLoopQuarantine);
// Scheduler Loop Quarantine's per-thread capacity in bytes.
// See "base/allocator/scheduler_loop_quarantine_config.h" for details.
BASE_EXPORT BASE_DECLARE_FEATURE_PARAM(
int,
kPartitionAllocSchedulerLoopQuarantineBranchCapacity);
// Scheduler Loop Quarantine's capacity for the UI thread in bytes.
// TODO(https://crbug.com/387470567): Support more thread types.
BASE_EXPORT BASE_DECLARE_FEATURE_PARAM(
int,
kPartitionAllocSchedulerLoopQuarantineBrowserUICapacity);
BASE_EXPORT BASE_DECLARE_FEATURE(kPartitionAllocZappingByFreeFlags);
std::string,
kPartitionAllocSchedulerLoopQuarantineConfig);
// Eventually zero out most PartitionAlloc memory. This is not meant as a
// security guarantee, but to increase the compression ratio of PartitionAlloc's
@@ -235,14 +226,6 @@ BASE_EXPORT BASE_DECLARE_FEATURE(kPartitionAllocAdjustSizeWhenInForeground);
// See also: https://crbug.com/333443437
BASE_EXPORT BASE_DECLARE_FEATURE(kPartitionAllocUseSmallSingleSlotSpans);
#if PA_CONFIG(ENABLE_SHADOW_METADATA)
using ShadowMetadataEnabledProcesses = internal::PAFeatureEnabledProcesses;
BASE_EXPORT BASE_DECLARE_FEATURE(kPartitionAllocShadowMetadata);
BASE_EXPORT BASE_DECLARE_FEATURE_PARAM(ShadowMetadataEnabledProcesses,
kShadowMetadataEnabledProcessesParam);
#endif // PA_CONFIG(ENABLE_SHADOW_METADATA)
#if PA_BUILDFLAG(ENABLE_PARTITION_LOCK_PRIORITY_INHERITANCE)
BASE_EXPORT BASE_DECLARE_FEATURE(kPartitionAllocUsePriorityInheritanceLocks);
#endif // PA_BUILDFLAG(ENABLE_PARTITION_LOCK_PRIORITY_INHERITANCE)
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "base/allocator/partition_alloc_support.h"
#include <algorithm>
@@ -14,6 +19,7 @@
#include <string_view>
#include "base/allocator/partition_alloc_features.h"
#include "base/allocator/scheduler_loop_quarantine_config.h"
#include "base/at_exit.h"
#include "base/check.h"
#include "base/containers/span.h"
@@ -45,6 +51,7 @@
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "partition_alloc/allocation_guard.h"
#include "partition_alloc/allocator_config.h"
#include "partition_alloc/buildflags.h"
#include "partition_alloc/dangling_raw_ptr_checks.h"
#include "partition_alloc/in_slot_metadata.h"
@@ -141,17 +148,6 @@ void RunThreadCachePeriodicPurge() {
} // namespace
// When enabled, disable the memory reclaimer in background.
BASE_FEATURE(kDisableMemoryReclaimerInBackground,
"DisableMemoryReclaimerInBackground",
base::FEATURE_ENABLED_BY_DEFAULT);
// When enabled, limit the time memory reclaimer may take, returning early when
// exceeded.
BASE_FEATURE(kPartitionAllocShortMemoryReclaim,
"PartitionAllocShortMemoryReclaim",
base::FEATURE_ENABLED_BY_DEFAULT);
// static
MemoryReclaimerSupport& MemoryReclaimerSupport::Instance() {
static base::NoDestructor<MemoryReclaimerSupport> instance;
@@ -209,16 +205,7 @@ void MemoryReclaimerSupport::Run() {
TRACE_EVENT0("base", "partition_alloc::MemoryReclaimer::Reclaim()");
has_pending_task_ = false;
{
// Micros, since memory reclaiming should typically take at most a few ms.
SCOPED_UMA_HISTOGRAM_TIMER_MICROS("Memory.PartitionAlloc.MemoryReclaim");
if (base::FeatureList::IsEnabled(kPartitionAllocShortMemoryReclaim)) {
::partition_alloc::MemoryReclaimer::Instance()->ReclaimFast();
} else {
::partition_alloc::MemoryReclaimer::Instance()->ReclaimNormal();
}
}
::partition_alloc::MemoryReclaimer::Instance()->ReclaimFast();
MaybeScheduleTask();
}
@@ -234,10 +221,7 @@ TimeDelta MemoryReclaimerSupport::GetInterval() {
}
void MemoryReclaimerSupport::MaybeScheduleTask(TimeDelta delay) {
if (has_pending_task_ ||
(base::FeatureList::IsEnabled(kDisableMemoryReclaimerInBackground) &&
!in_foreground_) ||
!task_runner_) {
if (has_pending_task_ || !in_foreground_ || !task_runner_) {
return;
}
@@ -330,6 +314,23 @@ std::map<std::string, std::string> ProposeSyntheticFinchTrials() {
}
#endif // PA_BUILDFLAG(HAS_MEMORY_TAGGING)
#if PA_CONFIG(MOVE_METADATA_OUT_OF_GIGACAGE) && \
PA_BUILDFLAG(ENABLE_MOVE_METADATA_OUT_OF_GIGACAGE_TRIAL)
switch (partition_alloc::GetExternalMetadataTrialGroup()) {
case partition_alloc::ExternalMetadataTrialGroup::kEnabled:
trials.emplace(partition_alloc::kExternalMetadataTrialName,
partition_alloc::kExternalMetadataTrialGroup_Enabled);
break;
case partition_alloc::ExternalMetadataTrialGroup::kDisabled:
trials.emplace(partition_alloc::kExternalMetadataTrialName,
partition_alloc::kExternalMetadataTrialGroup_Disabled);
break;
default:
break;
}
#endif // PA_CONFIG(MOVE_METADATA_OUT_OF_GIGACAGE) &&
// PA_BUILDFLAG(ENABLE_MOVE_METADATA_OUT_OF_GIGACAGE_TRIAL)
return trials;
}
@@ -354,17 +355,6 @@ bool ShouldEnableFeatureOnProcess(
}
}
#if PA_CONFIG(ENABLE_SHADOW_METADATA)
bool ShouldEnableShadowMetadata(const std::string& process_type) {
if (!base::FeatureList::IsEnabled(
base::features::kPartitionAllocShadowMetadata)) {
return false;
}
return ShouldEnableFeatureOnProcess(
features::kShadowMetadataEnabledProcessesParam.Get(), process_type);
}
#endif // PA_CONFIG(ENABLE_SHADOW_METADATA)
} // namespace
#if PA_BUILDFLAG(ENABLE_DANGLING_RAW_PTR_CHECKS)
@@ -837,7 +827,6 @@ bool PartitionAllocSupport::ShouldEnableMemoryTagging(
return false;
}
DCHECK(base::FeatureList::GetInstance());
if (base::FeatureList::IsEnabled(
base::features::kKillPartitionAllocMemoryTagging)) {
return false;
@@ -851,53 +840,6 @@ bool PartitionAllocSupport::ShouldEnableMemoryTaggingInRendererProcess() {
return ShouldEnableMemoryTagging(switches::kRendererProcess);
}
// static
::partition_alloc::internal::SchedulerLoopQuarantineConfig
PartitionAllocSupport::GetSchedulerLoopQuarantineConfiguration(
const std::string& process_type,
features::internal::SchedulerLoopQuarantineBranchType branch_type) {
::partition_alloc::internal::SchedulerLoopQuarantineConfig config;
#if PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
if (!base::FeatureList::IsEnabled(
base::features::kPartitionAllocSchedulerLoopQuarantine)) {
return config;
}
config.enable_quarantine = true;
config.branch_capacity_in_bytes = static_cast<size_t>(
base::features::kPartitionAllocSchedulerLoopQuarantineBranchCapacity
.Get());
config.enable_zapping = base::FeatureList::IsEnabled(
base::features::kPartitionAllocZappingByFreeFlags);
switch (branch_type) {
case features::internal::SchedulerLoopQuarantineBranchType::kGlobal:
config.leak_on_destruction = true;
break;
case features::internal::SchedulerLoopQuarantineBranchType::
kThreadLocalDefault:
config.leak_on_destruction = false;
break;
case features::internal::SchedulerLoopQuarantineBranchType::kMain:
config.leak_on_destruction = false;
if (process_type == "") {
config.branch_capacity_in_bytes = static_cast<size_t>(
base::features::
kPartitionAllocSchedulerLoopQuarantineBrowserUICapacity.Get());
}
break;
}
#endif // PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
if (config.branch_capacity_in_bytes == 0) {
config.enable_quarantine = false;
config.enable_zapping = false;
}
return config;
}
// static
bool PartitionAllocSupport::ShouldEnablePartitionAllocWithAdvancedChecks(
const std::string& process_type) {
@@ -918,9 +860,6 @@ bool PartitionAllocSupport::ShouldEnablePartitionAllocWithAdvancedChecks(
// static
PartitionAllocSupport::BrpConfiguration
PartitionAllocSupport::GetBrpConfiguration(const std::string& process_type) {
// TODO(bartekn): Switch to DCHECK once confirmed there are no issues.
CHECK(base::FeatureList::GetInstance());
#if PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && \
PA_BUILDFLAG(ENABLE_BACKUP_REF_PTR_SUPPORT) && \
!PA_BUILDFLAG(FORCE_DISABLE_BACKUP_REF_PTR_FEATURE)
@@ -1024,7 +963,15 @@ void PartitionAllocSupport::ReconfigureAfterZygoteFork(
void PartitionAllocSupport::ReconfigureAfterFeatureListInit(
const std::string& process_type,
bool configure_dangling_pointer_detector) {
bool configure_dangling_pointer_detector,
bool is_in_death_test_child) {
// In Death Tests, `FeatureList` is never initialized. Even in these cases
// we call this method to finalize the allocator configuration.
// TODO(https://crbug.com/432019338): Remove this param once fixed.
if (!is_in_death_test_child) {
CHECK(base::FeatureList::GetInstance());
}
if (configure_dangling_pointer_detector) {
base::allocator::InstallDanglingRawPtrChecks();
}
@@ -1106,12 +1053,10 @@ void PartitionAllocSupport::ReconfigureAfterFeatureListInit(
const auto scheduler_loop_quarantine_global_config =
GetSchedulerLoopQuarantineConfiguration(
process_type,
features::internal::SchedulerLoopQuarantineBranchType::kGlobal);
process_type, SchedulerLoopQuarantineBranchType::kGlobal);
const auto scheduler_loop_quarantine_thread_local_config =
GetSchedulerLoopQuarantineConfiguration(
process_type, features::internal::SchedulerLoopQuarantineBranchType::
kThreadLocalDefault);
process_type, SchedulerLoopQuarantineBranchType::kThreadLocalDefault);
const bool eventually_zero_freed_memory = base::FeatureList::IsEnabled(
base::features::kPartitionAllocEventuallyZeroFreedMemory);
@@ -1241,8 +1186,7 @@ void PartitionAllocSupport::ReconfigureAfterFeatureListInit(
// `ReconfigureAfterTaskRunnerInit()` is called on the Main thread.
partition_alloc::internal::SchedulerLoopQuarantineConfig quarantine_config =
GetSchedulerLoopQuarantineConfiguration(
process_type,
features::internal::SchedulerLoopQuarantineBranchType::kMain);
process_type, SchedulerLoopQuarantineBranchType::kMain);
allocator_shim::internal::PartitionAllocMalloc::Allocator()
->ReconfigureSchedulerLoopQuarantineForCurrentThread(quarantine_config);
}
@@ -1367,15 +1311,6 @@ void PartitionAllocSupport::ReconfigureAfterTaskRunnerInit(
partition_alloc::PartitionRoot::SetSortActiveSlotSpansEnabled(
base::FeatureList::IsEnabled(
base::features::kPartitionAllocSortActiveSlotSpans));
#if PA_CONFIG(ENABLE_SHADOW_METADATA)
if (ShouldEnableShadowMetadata(process_type)) {
partition_alloc::PartitionRoot::EnableShadowMetadata(
partition_alloc::internal::PoolHandleMask::kRegular |
partition_alloc::internal::PoolHandleMask::kBRP |
partition_alloc::internal::PoolHandleMask::kConfigurable);
}
#endif // PA_CONFIG(ENABLE_SHADOW_METADATA)
}
void PartitionAllocSupport::OnForegrounded(bool has_main_frame) {
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef BASE_ALLOCATOR_PARTITION_ALLOC_SUPPORT_H_
#define BASE_ALLOCATOR_PARTITION_ALLOC_SUPPORT_H_
@@ -86,7 +91,8 @@ class BASE_EXPORT PartitionAllocSupport {
void ReconfigureAfterZygoteFork(const std::string& process_type);
void ReconfigureAfterFeatureListInit(
const std::string& process_type,
bool configure_dangling_pointer_detector = true);
bool configure_dangling_pointer_detector = true,
bool is_in_death_test_child = false);
void ReconfigureAfterTaskRunnerInit(const std::string& process_type);
// |has_main_frame| tells us if the renderer contains a main frame.
@@ -116,12 +122,6 @@ class BASE_EXPORT PartitionAllocSupport {
static bool ShouldEnablePartitionAllocWithAdvancedChecks(
const std::string& process_type);
// Returns quarantine configuration for `process_name` and `branch_type`.
static ::partition_alloc::internal::SchedulerLoopQuarantineConfig
GetSchedulerLoopQuarantineConfiguration(
const std::string& process_type,
features::internal::SchedulerLoopQuarantineBranchType branch_type);
private:
PartitionAllocSupport();
@@ -140,8 +140,6 @@ class BASE_EXPORT PartitionAllocSupport {
#endif
};
BASE_EXPORT BASE_DECLARE_FEATURE(kDisableMemoryReclaimerInBackground);
// Visible in header for testing.
class BASE_EXPORT MemoryReclaimerSupport {
public:
@@ -180,6 +178,7 @@ BASE_EXPORT void CheckHeapIntegrity(const void* ptr);
// to the function, and it may use that for debugging purpose.
BASE_EXPORT void SetDoubleFreeOrCorruptionDetectedFn(void (*fn)(uintptr_t));
using partition_alloc::SchedulerLoopQuarantineScanPolicyUpdater;
using partition_alloc::ScopedSchedulerLoopQuarantineExclusion;
} // namespace base::allocator
@@ -13,7 +13,7 @@ group("buildflags") {
if (use_partition_alloc && is_clang_or_gcc) {
group("partition_alloc") {
public_deps = [ "src/partition_alloc:partition_alloc" ]
public_deps = [ "src/partition_alloc" ]
}
}
@@ -10,6 +10,7 @@
build_with_chromium = false
is_asan = false
is_hwasan = false
# It's best to keep the names and defaults of is_foo flags consistent with:
# - Chrome
@@ -0,0 +1,77 @@
# PA_CHECK()
PartitionAlloc is not re-entrant. This means that when a crash happens inside PartitionAllocator, PA_CHECK() is intended not to be symbolized, because memory allocation is required to symbolize addresses. Inside PartitionAllocator, it is not allowed to use the same PartitionRoot for another memory operation, e.g. malloc() and free(). If malloc() is replaced with PartitionAllocator and the malloc() hits PA_CHECK() failure, the symbolization will also use the same PartitionRoot for malloc() and will cause another crash or hang.
## Symbolize unsymbolized addresses
To symbolize addresses, we can use `//tools/valgrind/asan/asan_symbolizer.py`. However we should be careful about the order of addresses, because the addresses are not sorted, e.g.
```
#0 (module1.so + address1)
#2 (module1.so + address2)
#3 (module1.so + address3)
#1 (module2.so + address4)
```
PA_CHECK() makes addresses relative addresses inside each module, but it does the following on linux (or Android):
- open /proc/self/maps.
- parse each line and get a module name and its address space.
- check whether the given addresses are in the address space or not. If in the address space, output the relative addresses with the module name. e.g. `base_unittests + 0x0023f8`
To avoid memory allocation, the code does not remember module names with their address spaces. Instead, it outputs the relative addresses as soon as modules, which contain the addresses, are found. On the other hand, `asan_symbolize.py` doesnt keep `#[0-9]+`. E.g. `asan_symbolize.py` generates the following:
```
#0 module1.cc:line_number1
#1 module1.cc:line_number2 (was #2)
#2 module1.cc:line_number3 (was #3)
#3 module2.cc:line_number4 (was #1)
```
c.f. `//tools/valgrind/asan/third_party/asan_symbolize.py` sets `frame_no = 0` at `frameno_str == 0` and increments `frame_no` by 1
If we want to symbolize the addresses manually, we can use `//third_party/llvm-build/Release+Asserts/bin/llvm-symbolizer`.
E.g.
```
llvm-symbolizer -e module1.so -f -C -i address1 address2 address3
```
If the module is very large, it takes much time to symbolize. It is better to provide multiple addresses for a symbolizer at once.
Instead of `llvm-symbolizer`, `addr2line` also works for the symbolization. However `addr2line` is much slower than `llvm-symbolizer`.
Regarding MacOS, we can use `atos` for symbolization.
E.g. if we have:
```
#0 (base_unittests+address1)
```
we will try:
```
atos -offset -inlineFrames -arch x86_64 -o base_unittests address1
```
If we have a minidump (e.g. `base_unittests`'s `mindump.dmp`), lldb is also useful for symbolization.
```
lldb -c minidump.dmp -f base_unittests
(lldb) bt
```
## Symbolize unsymbolized addresses shown in cq or try-bots
(googler-only) Regarding cq or tri, we can get binaries from `cas input`. We will open the “swarming task page” and follow the “Download inputs files into directory foo:” steps in the “Reproducing the task locally”.
## PA_NOTREACHED hit
Since PA_NOTREACHED() causes immediate crash and no stack frames are shown, the following makes it easier to debug PA_NOTREACHED():
`//base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/check.cc`
```
void RawCheckFailure(const char* message) {
//RawLog(LOGGING_FATAL, message);
//PA_IMMEDIATE_CRASH();
PA_CHECK(false) << message;
}
```
@@ -343,11 +343,21 @@ declare_args() {
}
declare_args() {
# Shadow metadata is still under development and only supports Linux
# for now.
enable_shadow_metadata = is_linux && has_64_bit_pointers
# Because of address space issue, this feature cannot be enabled on
# 32bit OS and iOS, i.e. has_64_bit_pointers && !is_ios
move_metadata_outside_gigacage = false && has_64_bit_pointers && !is_ios
}
declare_args() {
enable_move_metadata_outside_gigacage_trial =
false && move_metadata_outside_gigacage
}
assert(!enable_move_metadata_outside_gigacage_trial ||
move_metadata_outside_gigacage,
"Can't enable PartitionAllocExternalMetadata synthetic trial " +
"without move_metadata_outside_gigacage=true.")
declare_args() {
# Use full MTE protection available by changing the feature flag default
# values. So sync mode on all processes. Also disables permissive MTE.
@@ -155,7 +155,8 @@ pa_buildflag_header("buildflags") {
"ENABLE_POINTER_ARITHMETIC_TRAIT_CHECK=$enable_pointer_arithmetic_trait_check",
"ENABLE_POINTER_COMPRESSION=$enable_pointer_compression",
"ENABLE_POINTER_SUBTRACTION_CHECK=$enable_pointer_subtraction_check",
"ENABLE_SHADOW_METADATA_FOR_64_BITS_POINTERS=$enable_shadow_metadata",
"MOVE_METADATA_OUT_OF_GIGACAGE_FOR_64_BITS_POINTERS=$move_metadata_outside_gigacage",
"ENABLE_MOVE_METADATA_OUT_OF_GIGACAGE_TRIAL=$enable_move_metadata_outside_gigacage_trial",
"ENABLE_THREAD_ISOLATION=$enable_pkeys",
"EXPENSIVE_DCHECKS_ARE_ON=$enable_expensive_dchecks",
"FORCE_DISABLE_BACKUP_REF_PTR_FEATURE=$force_disable_backup_ref_ptr_feature",
@@ -400,6 +401,8 @@ if (is_clang_or_gcc) {
"address_space_stats.h",
"allocation_guard.cc",
"allocation_guard.h",
"allocator_config.cc",
"allocator_config.h",
"bucket_lookup.h",
"compressed_pointer.cc",
"compressed_pointer.h",
@@ -452,7 +455,6 @@ if (is_clang_or_gcc) {
"partition_page_constants.h",
"partition_root.cc",
"partition_root.h",
"partition_shared_mutex.h",
"partition_stats.cc",
"partition_stats.h",
"partition_superpage_extent_entry.h",
@@ -545,7 +547,7 @@ if (is_clang_or_gcc) {
if (use_partition_alloc_as_malloc_on_win_component_build) {
# We need to add explicit libc++ dependency here because of
# no_default_deps=true.
deps += [ "//buildtools/third_party/libc++:libc++" ]
deps += [ "//buildtools/third_party/libc++" ]
}
public_configs = []
@@ -587,8 +589,18 @@ if (is_clang_or_gcc) {
if (enable_pkeys && partition_alloc_is_debug) {
configs += [ ":no_stack_protector" ]
# -fno-stack-protector is incompatible with libc++ modules.
use_libcxx_modules = false
if (defined(is_debug) && is_debug) {
# Chromium debug build uses -fstack-protector for libc++ modules and the
# flag is not compatible with "no_stack_protector" config.
#
# Note that `is_debug`, `libcxx_modules` and `use_clang_modules`
# arguments are not part of partition_alloc. They are part of Chromium.
# They may be undefined or unused respectively.
use_libcxx_modules = false
if (!defined(use_clang_modules)) {
not_needed([ "use_libcxx_modules" ])
}
}
}
}
@@ -616,6 +628,7 @@ if (is_clang_or_gcc) {
"partition_alloc_base/containers/flat_tree.h",
"partition_alloc_base/cpu.cc",
"partition_alloc_base/cpu.h",
"partition_alloc_base/cxx20_identity.h",
"partition_alloc_base/cxx20_is_constant_evaluated.h",
"partition_alloc_base/cxx_wrapper/algorithm.h",
"partition_alloc_base/cxx_wrapper/optional.h",
@@ -799,7 +812,7 @@ if (is_clang_or_gcc) {
if (use_partition_alloc_as_malloc_on_win_component_build) {
# We need to add explicit libc++ dependency here because of
# no_default_deps=true.
deps += [ "//buildtools/third_party/libc++:libc++" ]
deps += [ "//buildtools/third_party/libc++" ]
}
if (is_fuchsia) {
public_deps += [ "//third_party/fuchsia-sdk/sdk/pkg/fit" ]
@@ -1061,8 +1074,18 @@ if (build_with_chromium) {
# the test.
configs += [ ":no_stack_protector" ]
# -fno-stack-protector is incompatible with libc++ modules.
use_libcxx_modules = false
if (defined(is_debug) && is_debug) {
# Chromium debug build uses -fstack-protector for libc++ modules and the
# flag is not compatible with "no_stack_protector" config.
#
# Note that `is_debug`, `libcxx_modules` and `use_clang_modules`
# arguments are not part of partition_alloc. They are part of Chromium.
# They may be undefined or unused respectively.
use_libcxx_modules = false
if (!defined(use_clang_modules)) {
not_needed([ "use_libcxx_modules" ])
}
}
}
frameworks = []
@@ -1082,6 +1105,10 @@ if (build_with_chromium) {
configs -= partition_alloc_remove_configs
configs += partition_alloc_add_configs
# TODO(crbug.com/40031409): Fix code that adds exit-time destructors and
# enable the diagnostic by removing this line.
configs += [ "//build/config/compiler:no_exit_time_destructors" ]
}
}
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_AARCH64_SUPPORT_H_
#define PARTITION_ALLOC_AARCH64_SUPPORT_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "partition_alloc/address_pool_manager.h"
#include <atomic>
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_ADDRESS_POOL_MANAGER_H_
#define PARTITION_ALLOC_ADDRESS_POOL_MANAGER_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "partition_alloc/address_pool_manager_bitmap.h"
#include "partition_alloc/buildflags.h"
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_ADDRESS_POOL_MANAGER_BITMAP_H_
#define PARTITION_ALLOC_ADDRESS_POOL_MANAGER_BITMAP_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_ADDRESS_POOL_MANAGER_TYPES_H_
#define PARTITION_ALLOC_ADDRESS_POOL_MANAGER_TYPES_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "partition_alloc/address_space_randomization.h"
#include "partition_alloc/build_config.h"
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_ADDRESS_SPACE_RANDOMIZATION_H_
#define PARTITION_ALLOC_ADDRESS_SPACE_RANDOMIZATION_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_ADDRESS_SPACE_STATS_H_
#define PARTITION_ALLOC_ADDRESS_SPACE_STATS_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "partition_alloc/allocation_guard.h"
#include "partition_alloc/partition_alloc_base/immediate_crash.h"
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_ALLOCATION_GUARD_H_
#define PARTITION_ALLOC_ALLOCATION_GUARD_H_
@@ -0,0 +1,60 @@
// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "partition_alloc/allocator_config.h"
#include <limits>
#include "partition_alloc/random.h"
namespace partition_alloc {
#if PA_CONFIG(MOVE_METADATA_OUT_OF_GIGACAGE) && \
PA_BUILDFLAG(ENABLE_MOVE_METADATA_OUT_OF_GIGACAGE_TRIAL)
namespace {
enum ExternalMetadataTrialGroupPercentage {
kEnabled = 10, // 10%
kDisabled = 10, // 10%
};
ExternalMetadataTrialGroup s_externalMetadataJoinedGroup =
ExternalMetadataTrialGroup::kUndefined;
void SetExternalMetadataTrialGroup(ExternalMetadataTrialGroup group) {
s_externalMetadataJoinedGroup = group;
}
} // namespace
namespace internal {
ExternalMetadataTrialGroup SelectExternalMetadataTrialGroup() {
uint32_t random = internal::RandomValue() /
static_cast<double>(std::numeric_limits<uint32_t>::max()) *
100.0;
ExternalMetadataTrialGroup group;
if (random < ExternalMetadataTrialGroupPercentage::kEnabled) {
group = ExternalMetadataTrialGroup::kEnabled;
} else if (random < ExternalMetadataTrialGroupPercentage::kEnabled +
ExternalMetadataTrialGroupPercentage::kDisabled) {
group = ExternalMetadataTrialGroup::kDisabled;
} else {
group = ExternalMetadataTrialGroup::kDefault;
}
SetExternalMetadataTrialGroup(group);
return group;
}
} // namespace internal
ExternalMetadataTrialGroup GetExternalMetadataTrialGroup() {
return s_externalMetadataJoinedGroup;
}
#endif // PA_CONFIG(MOVE_METADATA_OUT_OF_GIGACAGE) &&
// PA_BUILDFLAG(ENABLE_MOVE_METADATA_OUT_OF_GIGACAGE_TRIAL)
} // namespace partition_alloc
@@ -0,0 +1,47 @@
// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef PARTITION_ALLOC_ALLOCATOR_CONFIG_H_
#define PARTITION_ALLOC_ALLOCATOR_CONFIG_H_
#include "partition_alloc/buildflags.h"
#include "partition_alloc/partition_alloc_base/compiler_specific.h"
#include "partition_alloc/partition_alloc_base/component_export.h"
#include "partition_alloc/partition_alloc_config.h"
namespace partition_alloc {
// partition_alloc_support.cc will see the configuration and invoke
// RegisterSyntheticTrialGroup().
#if PA_CONFIG(MOVE_METADATA_OUT_OF_GIGACAGE) && \
PA_BUILDFLAG(ENABLE_MOVE_METADATA_OUT_OF_GIGACAGE_TRIAL)
inline constexpr const char kExternalMetadataTrialName[] =
"PartitionAllocExternalMetadata";
inline constexpr const char kExternalMetadataTrialGroup_Enabled[] = "Enabled";
inline constexpr const char kExternalMetadataTrialGroup_Disabled[] = "Disabled";
// For synthetic field trial: PartitionAllocExternalMetadata
enum ExternalMetadataTrialGroup {
kUndefined = 0,
kDefault,
kDisabled,
kEnabled,
};
PA_COMPONENT_EXPORT(PARTITION_ALLOC)
ExternalMetadataTrialGroup GetExternalMetadataTrialGroup();
namespace internal {
ExternalMetadataTrialGroup SelectExternalMetadataTrialGroup();
} // namespace internal
#endif // PA_CONFIG(MOVE_METADATA_OUT_OF_GIGACAGE) &&
// PA_BUILDFLAG(ENABLE_MOVE_METADATA_OUT_OF_GIGACAGE_TRIAL)
} // namespace partition_alloc
#endif // PARTITION_ALLOC_ALLOCATOR_CONFIG_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_ARM_BTI_TEST_FUNCTIONS_H_
#define PARTITION_ALLOC_ARM_BTI_TEST_FUNCTIONS_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_BUCKET_LOOKUP_H_
#define PARTITION_ALLOC_BUCKET_LOOKUP_H_
@@ -1,6 +1,11 @@
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_BUILD_CONFIG_H_
#define PARTITION_ALLOC_BUILD_CONFIG_H_
@@ -17,7 +22,7 @@
//
// Operating system:
// IS_IOS / IS_AIX / IS_ASMJS / IS_FREEBSD / IS_FUCHSIA / IS_LINUX / IS_MAC /
// IS_NACL / IS_NETBSD / IS_OPENBSD / IS_QNX / IS_SOLARIS / IS_WIN
// IS_NETBSD / IS_OPENBSD / IS_QNX / IS_SOLARIS / IS_WIN
//
// Operating system family:
// IS_APPLE / IS_BSD / IS_POSIX
@@ -55,10 +60,7 @@
// IWYU pragma: always_keep
// A set of macros to use for platform detection.
#if defined(__native_client__)
// __native_client__ must be first, so that other IS_ defines are not set.
#define PA_IS_NACL
#elif PA_BUILDFLAG(IS_ANDROID)
#if PA_BUILDFLAG(IS_ANDROID)
// The IS_ANDROID PA_BUILDFLAG macro is defined in buildflags.h.
//
// PartitionAlloc's embedders (Chromium, Dawn, Pdfium, Skia) define different
@@ -119,10 +121,10 @@
#define PA_IS_BSD
#endif
#if defined(PA_IS_AIX) || defined(PA_IS_ASMJS) || defined(PA_IS_FREEBSD) || \
defined(PA_IS_IOS) || defined(PA_IS_LINUX) || defined(PA_IS_CHROMEOS) || \
defined(PA_IS_MAC) || defined(PA_IS_NACL) || defined(PA_IS_NETBSD) || \
defined(PA_IS_OPENBSD) || defined(PA_IS_QNX) || defined(PA_IS_SOLARIS) || \
#if defined(PA_IS_AIX) || defined(PA_IS_ASMJS) || defined(PA_IS_FREEBSD) || \
defined(PA_IS_IOS) || defined(PA_IS_LINUX) || defined(PA_IS_CHROMEOS) || \
defined(PA_IS_MAC) || defined(PA_IS_NETBSD) || defined(PA_IS_OPENBSD) || \
defined(PA_IS_QNX) || defined(PA_IS_SOLARIS) || \
PA_BUILDFLAG(IS_ANDROID) || PA_BUILDFLAG(IS_CHROMEOS)
#define PA_IS_POSIX
#endif
@@ -179,7 +181,7 @@
#define PA_ARCH_CPU_ARM64
#define PA_ARCH_CPU_64_BITS
#define PA_ARCH_CPU_LITTLE_ENDIAN
#elif defined(__pnacl__) || defined(__asmjs__) || defined(__wasm__)
#elif defined(__asmjs__) || defined(__wasm__)
#define PA_ARCH_CPU_32_BITS
#define PA_ARCH_CPU_LITTLE_ENDIAN
#elif defined(__MIPSEL__)
@@ -449,13 +451,6 @@
#endif
#undef PA_IS_MAC
#if defined(PA_IS_NACL)
#define PA_BUILDFLAG_INTERNAL_IS_NACL() (1)
#else
#define PA_BUILDFLAG_INTERNAL_IS_NACL() (0)
#endif
#undef PA_IS_NACL
#if defined(PA_IS_NETBSD)
#define PA_BUILDFLAG_INTERNAL_IS_NETBSD() (1)
#else
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_BUILDFLAG_H_
#define PARTITION_ALLOC_BUILDFLAG_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "partition_alloc/compressed_pointer.h"
#include "partition_alloc/buildflags.h"
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_COMPRESSED_POINTER_H_
#define PARTITION_ALLOC_COMPRESSED_POINTER_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "partition_alloc/dangling_raw_ptr_checks.h"
#include "partition_alloc/partition_alloc_base/component_export.h"
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_DANGLING_RAW_PTR_CHECKS_H_
#define PARTITION_ALLOC_DANGLING_RAW_PTR_CHECKS_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_ENCODED_NEXT_FREELIST_H_
#define PARTITION_ALLOC_ENCODED_NEXT_FREELIST_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "partition_alloc/extended_api.h"
#include "partition_alloc/buildflags.h"
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_EXTENDED_API_H_
#define PARTITION_ALLOC_EXTENDED_API_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
// This header provides a type-safe way of storing OR-combinations of enum
// values.
//
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "partition_alloc/gwp_asan_support.h"
#if PA_BUILDFLAG(ENABLE_GWP_ASAN_SUPPORT)
@@ -90,7 +95,7 @@ void* GwpAsanSupport::MapRegion(size_t slot_count,
for (uintptr_t super_page = super_page_span_start;
super_page < super_page_span_end; super_page += kSuperPageSize) {
auto* page_metadata =
internal::PartitionSuperPageToMetadataArea(super_page);
internal::PartitionSuperPageToMetadataArea(super_page, root);
// Index 0 is invalid because it is the super page extent metadata.
for (size_t partition_page_idx = 1;
@@ -99,10 +104,9 @@ void* GwpAsanSupport::MapRegion(size_t slot_count,
partition_page_idx += bucket->get_pages_per_slot_span()) {
auto* slot_span_metadata =
&page_metadata[partition_page_idx].slot_span_metadata;
bucket->InitializeSlotSpanForGwpAsan(slot_span_metadata, root);
auto slot_span_start =
internal::SlotSpanMetadata<internal::MetadataKind::kReadOnly>::
ToSlotSpanStart(slot_span_metadata);
bucket->InitializeSlotSpanForGwpAsan(slot_span_metadata);
auto slot_span_start = internal::SlotSpanMetadata::ToSlotSpanStart(
slot_span_metadata, root);
for (uintptr_t slot_idx = 0; slot_idx < kSlotsPerSlotSpan; ++slot_idx) {
auto slot_start = slot_span_start + slot_idx * kSlotSize;
@@ -140,8 +144,7 @@ bool GwpAsanSupport::CanReuse(uintptr_t slot_start) {
// static
void GwpAsanSupport::DestructForTesting() {
static PartitionRoot* root = RootInstance();
internal::ScopedGuard locker{internal::PartitionRootLock(root)};
root->DestructForTesting(); // IN-TEST
root->ResetForTesting(true); // IN-TEST
}
} // namespace partition_alloc
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_GWP_ASAN_SUPPORT_H_
#define PARTITION_ALLOC_GWP_ASAN_SUPPORT_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "partition_alloc/in_slot_metadata.h"
#include <atomic>
@@ -23,7 +28,7 @@ namespace {
// If double-free, the freed `slot` will be a freelist entry.
bool IsInFreelist(uintptr_t slot_start,
SlotSpanMetadata<MetadataKind::kReadOnly>* slot_span,
SlotSpanMetadata* slot_span,
size_t& position) {
size_t slot_size = slot_span->bucket->slot_size;
@@ -98,10 +103,9 @@ PA_NOINLINE PA_NOT_TAIL_CALLED void CorruptionDetected() {
[[noreturn]]
#endif // !PA_BUILDFLAG(IS_IOS)
PA_NOINLINE PA_NOT_TAIL_CALLED void
InSlotMetadata::DoubleFreeOrCorruptionDetected(
InSlotMetadata::CountType count,
uintptr_t slot_start,
SlotSpanMetadata<MetadataKind::kReadOnly>* slot_span) {
InSlotMetadata::DoubleFreeOrCorruptionDetected(InSlotMetadata::CountType count,
uintptr_t slot_start,
SlotSpanMetadata* slot_span) {
// Lock the PartitionRoot here, because to travserse SlotSpanMetadata's
// freelist, we need PartitionRootLock().
PartitionRoot* root = PartitionRoot::FromSlotSpanMetadata(slot_span);
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_IN_SLOT_METADATA_H_
#define PARTITION_ALLOC_IN_SLOT_METADATA_H_
@@ -243,9 +248,8 @@ class PA_COMPONENT_EXPORT(PARTITION_ALLOC) InSlotMetadata {
// Returns true if the allocation should be reclaimed.
// This function should be called by the allocator during Free().
PA_ALWAYS_INLINE bool ReleaseFromAllocator(
uintptr_t slot_start,
SlotSpanMetadata<MetadataKind::kReadOnly>* slot_span) {
PA_ALWAYS_INLINE bool ReleaseFromAllocator(uintptr_t slot_start,
SlotSpanMetadata* slot_span) {
CheckCookieIfSupported();
CountType old_count =
@@ -296,9 +300,8 @@ class PA_COMPONENT_EXPORT(PARTITION_ALLOC) InSlotMetadata {
}
// Assertion to allocation which ought to be alive.
PA_ALWAYS_INLINE void EnsureAlive(
uintptr_t slot_start,
SlotSpanMetadata<MetadataKind::kReadOnly>* slot_span) {
PA_ALWAYS_INLINE void EnsureAlive(uintptr_t slot_start,
SlotSpanMetadata* slot_span) {
CountType count = count_.load(std::memory_order_relaxed);
if (!(count & kMemoryHeldByAllocatorBit)) {
DoubleFreeOrCorruptionDetected(count, slot_start, slot_span);
@@ -448,7 +451,7 @@ class PA_COMPONENT_EXPORT(PARTITION_ALLOC) InSlotMetadata {
PA_NOINLINE PA_NOT_TAIL_CALLED static void DoubleFreeOrCorruptionDetected(
CountType count,
uintptr_t slot_start,
SlotSpanMetadata<MetadataKind::kReadOnly>*);
SlotSpanMetadata*);
// Note that in free slots, this is overwritten by encoded freelist
// pointer(s). The way the pointers are encoded on 64-bit little-endian
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "partition_alloc/internal_allocator.h"
namespace partition_alloc::internal {
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_INTERNAL_ALLOCATOR_H_
#define PARTITION_ALLOC_INTERNAL_ALLOCATOR_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_INTERNAL_ALLOCATOR_FORWARD_H_
#define PARTITION_ALLOC_INTERNAL_ALLOCATOR_FORWARD_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "partition_alloc/memory_reclaimer.h"
#include "partition_alloc/buildflags.h"
@@ -42,12 +47,6 @@ void MemoryReclaimer::ReclaimAll() {
Reclaim(kFlags);
}
void MemoryReclaimer::ReclaimNormal() {
constexpr int kFlags = PurgeFlags::kDecommitEmptySlotSpans |
PurgeFlags::kDiscardUnusedSystemPages;
Reclaim(kFlags);
}
void MemoryReclaimer::ReclaimFast() {
constexpr int kFlags = PurgeFlags::kDecommitEmptySlotSpans |
PurgeFlags::kDiscardUnusedSystemPages |
@@ -55,6 +54,12 @@ void MemoryReclaimer::ReclaimFast() {
Reclaim(kFlags);
}
void MemoryReclaimer::ReclaimForTesting() {
constexpr int kFlags = PurgeFlags::kDecommitEmptySlotSpans |
PurgeFlags::kDiscardUnusedSystemPages;
Reclaim(kFlags);
}
void MemoryReclaimer::Reclaim(int flags) {
internal::ScopedGuard lock(
lock_); // Has to protect from concurrent (Un)Register calls.
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_MEMORY_RECLAIMER_H_
#define PARTITION_ALLOC_MEMORY_RECLAIMER_H_
@@ -33,16 +38,10 @@ class PA_COMPONENT_EXPORT(PARTITION_ALLOC) MemoryReclaimer {
// Internal. Do not use.
// Registers a partition to be tracked by the reclaimer.
void RegisterPartition(PartitionRoot* partition);
void RegisterPartition(PartitionRoot* partition) PA_LOCKS_EXCLUDED(lock_);
// Internal. Do not use.
// Unregisters a partition to be tracked by the reclaimer.
void UnregisterPartition(PartitionRoot* partition);
// Triggers an explicit reclaim now to reclaim as much free memory as
// possible. The API callers need to invoke this method periodically
// if they want to use memory reclaimer.
// See also GetRecommendedReclaimIntervalInMicroseconds()'s comment.
void ReclaimNormal();
void UnregisterPartition(PartitionRoot* partition) PA_LOCKS_EXCLUDED(lock_);
// Returns a recommended interval to invoke ReclaimNormal.
int64_t GetRecommendedReclaimIntervalInMicroseconds() {
@@ -50,16 +49,18 @@ class PA_COMPONENT_EXPORT(PARTITION_ALLOC) MemoryReclaimer {
}
// Triggers an explicit reclaim now reclaiming all free memory
void ReclaimAll();
void ReclaimAll() PA_LOCKS_EXCLUDED(lock_);
// Same as ReclaimNormal(), but return early if reclaim takes too long.
void ReclaimFast();
void ReclaimFast() PA_LOCKS_EXCLUDED(lock_);
// Same as above, but does not limit reclaim time to avoid test flakiness.
void ReclaimForTesting() PA_LOCKS_EXCLUDED(lock_);
private:
MemoryReclaimer();
~MemoryReclaimer();
// |flags| is an OR of base::PartitionPurgeFlags
void Reclaim(int flags);
void ResetForTesting();
void Reclaim(int flags) PA_LOCKS_EXCLUDED(lock_);
void ResetForTesting() PA_LOCKS_EXCLUDED(lock_);
internal::Lock lock_;
std::set<PartitionRoot*> partitions_ PA_GUARDED_BY(lock_);
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "partition_alloc/oom.h"
#include "partition_alloc/build_config.h"
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_OOM_H_
#define PARTITION_ALLOC_OOM_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "partition_alloc/oom_callback.h"
#include "partition_alloc/partition_alloc_check.h"
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_OOM_CALLBACK_H_
#define PARTITION_ALLOC_OOM_CALLBACK_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#include "partition_alloc/page_allocator.h"
#include <atomic>
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_PAGE_ALLOCATOR_H_
#define PARTITION_ALLOC_PAGE_ALLOCATOR_H_
@@ -2,6 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif
#ifndef PARTITION_ALLOC_PAGE_ALLOCATOR_CONSTANTS_H_
#define PARTITION_ALLOC_PAGE_ALLOCATOR_CONSTANTS_H_

Some files were not shown because too many files have changed in this diff Show More