Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_packages_modules_Connectivity
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LMODroid
platform_packages_modules_Connectivity
Commits
063193b3
Commit
063193b3
authored
1 year ago
by
Ken Chen
Committed by
Gerrit Code Review
1 year ago
Browse files
Options
Downloads
Plain Diff
Merge "Add error trace in BpfHandler::initPrograms" into main
parents
684f92b9
5d14649a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
netd/BpfHandler.cpp
+33
-7
33 additions, 7 deletions
netd/BpfHandler.cpp
with
33 additions
and
7 deletions
netd/BpfHandler.cpp
+
33
−
7
View file @
063193b3
...
...
@@ -76,23 +76,43 @@ static Status checkProgramAccessible(const char* programPath) {
}
static
Status
initPrograms
(
const
char
*
cg2_path
)
{
if
(
!
cg2_path
)
{
ALOGE
(
"cg2_path is NULL"
);
return
statusFromErrno
(
EINVAL
,
"cg2_path is NULL"
);
}
// This code was mainlined in T, so this should be trivially satisfied.
if
(
!
modules
::
sdklevel
::
IsAtLeastT
())
abort
();
if
(
!
modules
::
sdklevel
::
IsAtLeastT
())
{
ALOGE
(
"S- platform is unsupported"
);
abort
();
}
// S requires eBPF support which was only added in 4.9, so this should be satisfied.
if
(
!
bpf
::
isAtLeastKernelVersion
(
4
,
9
,
0
))
abort
();
if
(
!
bpf
::
isAtLeastKernelVersion
(
4
,
9
,
0
))
{
ALOGE
(
"kernel version < 4.9.0 is unsupported"
);
abort
();
}
// U bumps the kernel requirement up to 4.14
if
(
modules
::
sdklevel
::
IsAtLeastU
()
&&
!
bpf
::
isAtLeastKernelVersion
(
4
,
14
,
0
))
abort
();
if
(
modules
::
sdklevel
::
IsAtLeastU
()
&&
!
bpf
::
isAtLeastKernelVersion
(
4
,
14
,
0
))
{
ALOGE
(
"U+ platform with kernel version < 4.14.0 is unsupported"
);
abort
();
}
if
(
modules
::
sdklevel
::
IsAtLeastV
())
{
// V bumps the kernel requirement up to 4.19
// see also: //system/netd/tests/kernel_test.cpp TestKernel419
if
(
!
bpf
::
isAtLeastKernelVersion
(
4
,
19
,
0
))
abort
();
if
(
!
bpf
::
isAtLeastKernelVersion
(
4
,
19
,
0
))
{
ALOGE
(
"V+ platform with kernel version < 4.19.0 is unsupported"
);
abort
();
}
// Technically already required by U, but only enforce on V+
// see also: //system/netd/tests/kernel_test.cpp TestKernel64Bit
if
(
bpf
::
isKernel32Bit
()
&&
bpf
::
isAtLeastKernelVersion
(
5
,
16
,
0
))
abort
();
if
(
bpf
::
isKernel32Bit
()
&&
bpf
::
isAtLeastKernelVersion
(
5
,
16
,
0
))
{
ALOGE
(
"V+ platform with 32 bit kernel, version >= 5.16.0 is unsupported"
);
abort
();
}
}
// Linux 6.1 is highest version supported by U, starting with V new kernels,
...
...
@@ -102,10 +122,16 @@ static Status initPrograms(const char* cg2_path) {
// it does not affect unprivileged apps, the 32-on-64 compatibility
// problems are AFAIK limited to various CAP_NET_ADMIN protected interfaces.
// see also: //system/bpf/bpfloader/BpfLoader.cpp main()
if
(
bpf
::
isUserspace32bit
()
&&
bpf
::
isAtLeastKernelVersion
(
6
,
2
,
0
))
abort
();
if
(
bpf
::
isUserspace32bit
()
&&
bpf
::
isAtLeastKernelVersion
(
6
,
2
,
0
))
{
ALOGE
(
"32 bit userspace with Kernel version >= 6.2.0 is unsupported"
);
abort
();
}
// U mandates this mount point (though it should also be the case on T)
if
(
modules
::
sdklevel
::
IsAtLeastU
()
&&
!!
strcmp
(
cg2_path
,
"/sys/fs/cgroup"
))
abort
();
if
(
modules
::
sdklevel
::
IsAtLeastU
()
&&
!!
strcmp
(
cg2_path
,
"/sys/fs/cgroup"
))
{
ALOGE
(
"U+ platform with cg2_path != /sys/fs/cgroup is unsupported"
);
abort
();
}
unique_fd
cg_fd
(
open
(
cg2_path
,
O_DIRECTORY
|
O_RDONLY
|
O_CLOEXEC
));
if
(
!
cg_fd
.
ok
())
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment