aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVikram Narayanan <vikram186@gmail.com>2021-10-18 12:46:13 -0700
committerDmitry Vyukov <dvyukov@google.com>2021-11-18 14:32:23 +0100
commit985076f2cce88f048e83459b99954a86a3f50cf5 (patch)
tree9f53920457a310fd220d1ed725a58fda5346fa83
parentcafff8b6ce51d6d1fa82eb96612a943db3c03541 (diff)
sys/linux: add /dev/cpu/X/msr to dev_msr.txt
-rw-r--r--sys/linux/dev_msr.txt15
-rw-r--r--sys/linux/dev_msr.txt.const7
-rw-r--r--sys/syz-extract/linux.go7
3 files changed, 26 insertions, 3 deletions
diff --git a/sys/linux/dev_msr.txt b/sys/linux/dev_msr.txt
new file mode 100644
index 000000000..07a3d3554
--- /dev/null
+++ b/sys/linux/dev_msr.txt
@@ -0,0 +1,15 @@
+# Copyright 2021 syzkaller project authors. All rights reserved.
+# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
+
+include <asm/msr.h>
+include <uapi/asm/msr.h>
+include <uapi/linux/fcntl.h>
+
+resource fd_msr[fd]
+
+syz_open_dev$MSR(dev ptr[in, string["/dev/cpu/#/msr"]], id intptr, flags const[O_RDONLY]) fd_msr
+read$msr(fd fd_msr, buf buffer[out], count len[buf])
+
+ioctl$X86_IOC_RDMSR_REGS(fd fd_msr, cmd const[X86_IOC_RDMSR_REGS], arg ptr[in, array[int32, 8]])
+# Disallow writing to MSRs
+_ = X86_IOC_WRMSR_REGS
diff --git a/sys/linux/dev_msr.txt.const b/sys/linux/dev_msr.txt.const
new file mode 100644
index 000000000..8d6ee993f
--- /dev/null
+++ b/sys/linux/dev_msr.txt.const
@@ -0,0 +1,7 @@
+# Code generated by syz-sysgen. DO NOT EDIT.
+arches = 386, amd64
+O_RDONLY = 0
+X86_IOC_RDMSR_REGS = 3223348128
+X86_IOC_WRMSR_REGS = 3223348129
+__NR_ioctl = 386:54, amd64:16
+__NR_read = 386:3, amd64:0
diff --git a/sys/syz-extract/linux.go b/sys/syz-extract/linux.go
index e4f8d1bfe..3fb4c5eb0 100644
--- a/sys/syz-extract/linux.go
+++ b/sys/syz-extract/linux.go
@@ -62,9 +62,10 @@ func (*linux) prepareArch(arch *Arch) error {
#define va_copy __builtin_va_copy
#define __va_copy __builtin_va_copy
`,
- "asm/a.out.h": "",
- "asm/prctl.h": "",
- "asm/mce.h": "",
+ "asm/a.out.h": "",
+ "asm/prctl.h": "",
+ "asm/mce.h": "",
+ "uapi/asm/msr.h": "",
} {
fullPath := filepath.Join(arch.buildDir, "syzkaller", hdr)
if err := osutil.MkdirAll(filepath.Dir(fullPath)); err != nil {