Skip to content

Commit 8cf6f23

Browse files
lmbti-mo
authored andcommitted
Revert "features: tolerate EPERM in haveObjName and objNameAllowsDot"
This reverts commit cfd8515. Now that the ELF reader doesn't rely on feature tests anymore we can undo the change to treat EPERM specially. Signed-off-by: Lorenz Bauer <[email protected]>
1 parent 9c66e91 commit 8cf6f23

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

syscalls.go

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -206,17 +206,9 @@ var haveObjName = internal.NewFeatureTest("object names", func() error {
206206
MapName: sys.NewObjName("feature_test"),
207207
}
208208

209-
// Tolerate EPERM as this runs during ELF loading which is potentially
210-
// unprivileged. Only EINVAL is conclusive, thrown from CHECK_ATTR.
211209
fd, err := sys.MapCreate(&attr)
212-
if errors.Is(err, unix.EPERM) {
213-
return nil
214-
}
215-
if errors.Is(err, unix.EINVAL) {
216-
return internal.ErrNotSupported
217-
}
218210
if err != nil {
219-
return err
211+
return internal.ErrNotSupported
220212
}
221213

222214
_ = fd.Close()
@@ -241,18 +233,9 @@ var objNameAllowsDot = internal.NewFeatureTest("dot in object names", func() err
241233
MapName: sys.NewObjName(".test"),
242234
}
243235

244-
// Tolerate EPERM, otherwise MapSpec.Name has its dots removed when run by
245-
// unprivileged tools. (bpf2go, other code gen). Only EINVAL is conclusive,
246-
// thrown from bpf_obj_name_cpy().
247236
fd, err := sys.MapCreate(&attr)
248-
if errors.Is(err, unix.EPERM) {
249-
return nil
250-
}
251-
if errors.Is(err, unix.EINVAL) {
252-
return internal.ErrNotSupported
253-
}
254237
if err != nil {
255-
return err
238+
return internal.ErrNotSupported
256239
}
257240

258241
_ = fd.Close()

0 commit comments

Comments
 (0)