aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/host
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2021-02-08 08:47:37 +0100
committerDmitry Vyukov <dvyukov@google.com>2021-02-12 18:09:14 +0100
commit98682e5e2aefc9aad61354f4f3ac93be96002a2a (patch)
tree04d0977ddcf677cc32fe7c8376e79765058406be /pkg/host
parent394d4bf77bc71747a74968f49ef153a8c9ff0cd4 (diff)
sys/linux: add ieee802154 descriptions
Diffstat (limited to 'pkg/host')
-rw-r--r--pkg/host/features.go5
-rw-r--r--pkg/host/features_linux.go8
-rw-r--r--pkg/host/syscalls_linux.go2
3 files changed, 15 insertions, 0 deletions
diff --git a/pkg/host/features.go b/pkg/host/features.go
index 14d4f5c89..d7012e918 100644
--- a/pkg/host/features.go
+++ b/pkg/host/features.go
@@ -29,6 +29,7 @@ const (
FeatureUSBEmulation
FeatureVhciInjection
FeatureWifiEmulation
+ Feature802154Emulation
numFeatures
)
@@ -69,6 +70,7 @@ func Check(target *prog.Target) (*Features, error) {
FeatureUSBEmulation: {Name: "USB emulation", Reason: unsupported},
FeatureVhciInjection: {Name: "hci packet injection", Reason: unsupported},
FeatureWifiEmulation: {Name: "wifi device emulation", Reason: unsupported},
+ Feature802154Emulation: {Name: "802.15.4 emulation", Reason: unsupported},
}
if noHostChecks(target) {
return res, nil
@@ -111,6 +113,9 @@ func Setup(target *prog.Target, features *Features, featureFlags csource.Feature
if features[FeatureUSBEmulation].Enabled {
args = append(args, "usb")
}
+ if featureFlags["ieee802154"].Enabled && features[Feature802154Emulation].Enabled {
+ args = append(args, "802154")
+ }
_, err := osutil.RunCmd(5*time.Minute, "", executor, args...)
return err
}
diff --git a/pkg/host/features_linux.go b/pkg/host/features_linux.go
index fc925c00c..5c45bdcc1 100644
--- a/pkg/host/features_linux.go
+++ b/pkg/host/features_linux.go
@@ -33,6 +33,7 @@ func init() {
checkFeature[FeatureUSBEmulation] = checkUSBEmulation
checkFeature[FeatureVhciInjection] = checkVhciInjection
checkFeature[FeatureWifiEmulation] = checkWifiEmulation
+ checkFeature[Feature802154Emulation] = check802154Emulation
}
func checkCoverage() string {
@@ -233,6 +234,13 @@ func checkWifiEmulation() string {
return requireKernel(4, 17)
}
+func check802154Emulation() string {
+ if err := osutil.IsAccessible("/sys/bus/platform/devices/mac802154_hwsim"); err != nil {
+ return err.Error()
+ }
+ return ""
+}
+
func requireKernel(x, y int) string {
info := new(unix.Utsname)
if err := unix.Uname(info); err != nil {
diff --git a/pkg/host/syscalls_linux.go b/pkg/host/syscalls_linux.go
index e31e0dc24..a13af0caa 100644
--- a/pkg/host/syscalls_linux.go
+++ b/pkg/host/syscalls_linux.go
@@ -223,9 +223,11 @@ func isSyzGenetlinkGetFamilyIDSupported(c *prog.Syscall, target *prog.Target, sa
if fd == -1 {
return false, fmt.Sprintf("socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC) failed: %v", err)
}
+ // TODO: try to obtain actual family ID here. It will disable whole sets of sendmsg syscalls.
syscall.Close(fd)
return true, ""
}
+
func isSyzMountImageSupported(c *prog.Syscall, target *prog.Target, sandbox string) (bool, string) {
if ok, reason := onlySandboxNone(sandbox); !ok {
return ok, reason