From 6db1c30d5f4dfe75f2d6894fb8a3d6228d699d88 Mon Sep 17 00:00:00 2001 From: shatoboar <57257492+shatoboar@users.noreply.github.com> Date: Mon, 20 Dec 2021 13:31:04 +0100 Subject: sys/linux: add Damon description * sys/linux/damon.txt: initial description description of DAMON's interface mounted in debugfs: target_ids, attrs, init_regions, monitor_on * sys/linux/damon.txt: additional damon interface description added added DAMON interface descriptions for schemes, kdamond_pid, mk_contexts, rm_contexts prefix of all the files with damon to avoid colliding naming * sys/linux/damon.txt: standard copyright statement added * sys/linux/damon.txt.const: const file of sys/linux/damon.txt added * sys/linux/damon.txt: type fix of pid to fmt * dashboard/config/linux/bits/subsystems.yml: damon configs added for Syzbot * dashboard/config/linux: generated kernel configs with added damon config * sys/linux/damon.txt: fmt type fix * sys/linux/damon.txt: read and close syscalls removed write and read mk_contexts summarized into one syscall some refining of syscall interfaces --- dashboard/config/linux/bits/subsystems.yml | 3 + .../config/linux/upstream-apparmor-kasan.config | 5 +- dashboard/config/linux/upstream-arm-kasan.config | 7 +- dashboard/config/linux/upstream-arm64-kasan.config | 5 +- dashboard/config/linux/upstream-arm64-mte.config | 5 +- dashboard/config/linux/upstream-kmsan.config | 5 +- dashboard/config/linux/upstream-leak.config | 5 +- .../config/linux/upstream-riscv64-kasan.config | 5 +- dashboard/config/linux/upstream-s390-kasan.config | 4 +- .../config/linux/upstream-selinux-kasan.config | 5 +- dashboard/config/linux/upstream-smack-kasan.config | 5 +- sys/linux/damon.txt | 77 ++++++++++++++++++++++ sys/linux/damon.txt.const | 5 ++ 13 files changed, 125 insertions(+), 11 deletions(-) create mode 100644 sys/linux/damon.txt create mode 100644 sys/linux/damon.txt.const diff --git a/dashboard/config/linux/bits/subsystems.yml b/dashboard/config/linux/bits/subsystems.yml index 72cdcb907..8f8da7f5c 100644 --- a/dashboard/config/linux/bits/subsystems.yml +++ b/dashboard/config/linux/bits/subsystems.yml @@ -538,3 +538,6 @@ config: - THERMAL_NETLINK: [v5.8] - VMWARE_VMCI: [x86_64] - W1: n + - DAMON + - DAMON-VADDR + - DAMON-DBGFS diff --git a/dashboard/config/linux/upstream-apparmor-kasan.config b/dashboard/config/linux/upstream-apparmor-kasan.config index 57e23a9f3..c688566f8 100644 --- a/dashboard/config/linux/upstream-apparmor-kasan.config +++ b/dashboard/config/linux/upstream-apparmor-kasan.config @@ -999,6 +999,7 @@ CONFIG_ZSMALLOC=y # CONFIG_ZSMALLOC_STAT is not set CONFIG_GENERIC_EARLY_IOREMAP=y # CONFIG_DEFERRED_STRUCT_PAGE_INIT is not set +CONFIG_PAGE_IDLE_FLAG=y # CONFIG_IDLE_PAGE_TRACKING is not set CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y CONFIG_ARCH_HAS_PTE_DEVMAP=y @@ -1022,7 +1023,9 @@ CONFIG_SECRETMEM=y # # Data Access Monitoring # -# CONFIG_DAMON is not set +CONFIG_DAMON=y +CONFIG_DAMON_VADDR=y +CONFIG_DAMON_DBGFS=y # end of Data Access Monitoring # end of Memory Management options diff --git a/dashboard/config/linux/upstream-arm-kasan.config b/dashboard/config/linux/upstream-arm-kasan.config index de9a4394a..df3a8bdb9 100644 --- a/dashboard/config/linux/upstream-arm-kasan.config +++ b/dashboard/config/linux/upstream-arm-kasan.config @@ -895,6 +895,7 @@ CONFIG_ZBUD=y CONFIG_ZSMALLOC=y # CONFIG_ZSMALLOC_STAT is not set CONFIG_GENERIC_EARLY_IOREMAP=y +CONFIG_PAGE_IDLE_FLAG=y # CONFIG_IDLE_PAGE_TRACKING is not set CONFIG_HMM_MIRROR=y CONFIG_PERCPU_STATS=y @@ -905,7 +906,9 @@ CONFIG_KMAP_LOCAL=y # # Data Access Monitoring # -# CONFIG_DAMON is not set +CONFIG_DAMON=y +CONFIG_DAMON_VADDR=y +CONFIG_DAMON_DBGFS=y # end of Data Access Monitoring # end of Memory Management options @@ -6821,7 +6824,7 @@ CONFIG_DEBUG_MISC=y # # Memory Debugging # -# CONFIG_PAGE_EXTENSION is not set +CONFIG_PAGE_EXTENSION=y # CONFIG_PAGE_OWNER is not set CONFIG_PAGE_POISONING=y # CONFIG_DEBUG_PAGE_REF is not set diff --git a/dashboard/config/linux/upstream-arm64-kasan.config b/dashboard/config/linux/upstream-arm64-kasan.config index a20ab89aa..2689ae138 100644 --- a/dashboard/config/linux/upstream-arm64-kasan.config +++ b/dashboard/config/linux/upstream-arm64-kasan.config @@ -957,6 +957,7 @@ CONFIG_ZSMALLOC=y # CONFIG_ZSMALLOC_STAT is not set CONFIG_GENERIC_EARLY_IOREMAP=y # CONFIG_DEFERRED_STRUCT_PAGE_INIT is not set +CONFIG_PAGE_IDLE_FLAG=y # CONFIG_IDLE_PAGE_TRACKING is not set CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y CONFIG_ARCH_HAS_PTE_DEVMAP=y @@ -977,7 +978,9 @@ CONFIG_SECRETMEM=y # # Data Access Monitoring # -# CONFIG_DAMON is not set +CONFIG_DAMON=y +CONFIG_DAMON_VADDR=y +CONFIG_DAMON_DBGFS=y # end of Data Access Monitoring # end of Memory Management options diff --git a/dashboard/config/linux/upstream-arm64-mte.config b/dashboard/config/linux/upstream-arm64-mte.config index f1997602a..d076fc9ad 100644 --- a/dashboard/config/linux/upstream-arm64-mte.config +++ b/dashboard/config/linux/upstream-arm64-mte.config @@ -951,6 +951,7 @@ CONFIG_ZSMALLOC=y # CONFIG_ZSMALLOC_STAT is not set CONFIG_GENERIC_EARLY_IOREMAP=y # CONFIG_DEFERRED_STRUCT_PAGE_INIT is not set +CONFIG_PAGE_IDLE_FLAG=y # CONFIG_IDLE_PAGE_TRACKING is not set CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y CONFIG_ARCH_HAS_PTE_DEVMAP=y @@ -971,7 +972,9 @@ CONFIG_SECRETMEM=y # # Data Access Monitoring # -# CONFIG_DAMON is not set +CONFIG_DAMON=y +CONFIG_DAMON_VADDR=y +CONFIG_DAMON_DBGFS=y # end of Data Access Monitoring # end of Memory Management options diff --git a/dashboard/config/linux/upstream-kmsan.config b/dashboard/config/linux/upstream-kmsan.config index 5560f0b42..22b8bb17d 100644 --- a/dashboard/config/linux/upstream-kmsan.config +++ b/dashboard/config/linux/upstream-kmsan.config @@ -1005,6 +1005,7 @@ CONFIG_ZSMALLOC=y # CONFIG_ZSMALLOC_STAT is not set CONFIG_GENERIC_EARLY_IOREMAP=y # CONFIG_DEFERRED_STRUCT_PAGE_INIT is not set +CONFIG_PAGE_IDLE_FLAG=y # CONFIG_IDLE_PAGE_TRACKING is not set CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y CONFIG_ARCH_HAS_PTE_DEVMAP=y @@ -1027,7 +1028,9 @@ CONFIG_SECRETMEM=y # # Data Access Monitoring # -# CONFIG_DAMON is not set +CONFIG_DAMON=y +CONFIG_DAMON_VADDR=y +CONFIG_DAMON_DBGFS=y # end of Data Access Monitoring # end of Memory Management options diff --git a/dashboard/config/linux/upstream-leak.config b/dashboard/config/linux/upstream-leak.config index 28c123bfd..7942fbb65 100644 --- a/dashboard/config/linux/upstream-leak.config +++ b/dashboard/config/linux/upstream-leak.config @@ -990,6 +990,7 @@ CONFIG_ZSMALLOC=y # CONFIG_ZSMALLOC_STAT is not set CONFIG_GENERIC_EARLY_IOREMAP=y # CONFIG_DEFERRED_STRUCT_PAGE_INIT is not set +CONFIG_PAGE_IDLE_FLAG=y # CONFIG_IDLE_PAGE_TRACKING is not set CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y CONFIG_ARCH_HAS_PTE_DEVMAP=y @@ -1012,7 +1013,9 @@ CONFIG_SECRETMEM=y # # Data Access Monitoring # -# CONFIG_DAMON is not set +CONFIG_DAMON=y +CONFIG_DAMON_VADDR=y +CONFIG_DAMON_DBGFS=y # end of Data Access Monitoring # end of Memory Management options diff --git a/dashboard/config/linux/upstream-riscv64-kasan.config b/dashboard/config/linux/upstream-riscv64-kasan.config index 43e5d01df..06e2832e4 100644 --- a/dashboard/config/linux/upstream-riscv64-kasan.config +++ b/dashboard/config/linux/upstream-riscv64-kasan.config @@ -591,6 +591,7 @@ CONFIG_ZSMALLOC=y # CONFIG_ZSMALLOC_STAT is not set CONFIG_GENERIC_EARLY_IOREMAP=y # CONFIG_DEFERRED_STRUCT_PAGE_INIT is not set +CONFIG_PAGE_IDLE_FLAG=y # CONFIG_IDLE_PAGE_TRACKING is not set CONFIG_ZONE_DMA32=y CONFIG_HMM_MIRROR=y @@ -602,7 +603,9 @@ CONFIG_SECRETMEM=y # # Data Access Monitoring # -# CONFIG_DAMON is not set +CONFIG_DAMON=y +CONFIG_DAMON_VADDR=y +CONFIG_DAMON_DBGFS=y # end of Data Access Monitoring # end of Memory Management options diff --git a/dashboard/config/linux/upstream-s390-kasan.config b/dashboard/config/linux/upstream-s390-kasan.config index 9bf8471eb..9b04c574e 100644 --- a/dashboard/config/linux/upstream-s390-kasan.config +++ b/dashboard/config/linux/upstream-s390-kasan.config @@ -715,7 +715,9 @@ CONFIG_ARCH_HAS_PTE_SPECIAL=y # # Data Access Monitoring # -# CONFIG_DAMON is not set +CONFIG_DAMON=y +CONFIG_DAMON_VADDR=y +CONFIG_DAMON_DBGFS=y # end of Data Access Monitoring # end of Memory Management options diff --git a/dashboard/config/linux/upstream-selinux-kasan.config b/dashboard/config/linux/upstream-selinux-kasan.config index dd60eedfb..ccb447be2 100644 --- a/dashboard/config/linux/upstream-selinux-kasan.config +++ b/dashboard/config/linux/upstream-selinux-kasan.config @@ -993,6 +993,7 @@ CONFIG_ZSMALLOC=y # CONFIG_ZSMALLOC_STAT is not set CONFIG_GENERIC_EARLY_IOREMAP=y # CONFIG_DEFERRED_STRUCT_PAGE_INIT is not set +CONFIG_PAGE_IDLE_FLAG=y # CONFIG_IDLE_PAGE_TRACKING is not set CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y CONFIG_ARCH_HAS_PTE_DEVMAP=y @@ -1016,7 +1017,9 @@ CONFIG_SECRETMEM=y # # Data Access Monitoring # -# CONFIG_DAMON is not set +CONFIG_DAMON=y +CONFIG_DAMON_VADDR=y +CONFIG_DAMON_DBGFS=y # end of Data Access Monitoring # end of Memory Management options diff --git a/dashboard/config/linux/upstream-smack-kasan.config b/dashboard/config/linux/upstream-smack-kasan.config index da6583a97..62847598d 100644 --- a/dashboard/config/linux/upstream-smack-kasan.config +++ b/dashboard/config/linux/upstream-smack-kasan.config @@ -998,6 +998,7 @@ CONFIG_ZSMALLOC=y # CONFIG_ZSMALLOC_STAT is not set CONFIG_GENERIC_EARLY_IOREMAP=y # CONFIG_DEFERRED_STRUCT_PAGE_INIT is not set +CONFIG_PAGE_IDLE_FLAG=y # CONFIG_IDLE_PAGE_TRACKING is not set CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y CONFIG_ARCH_HAS_PTE_DEVMAP=y @@ -1021,7 +1022,9 @@ CONFIG_SECRETMEM=y # # Data Access Monitoring # -# CONFIG_DAMON is not set +CONFIG_DAMON=y +CONFIG_DAMON_VADDR=y +CONFIG_DAMON_DBGFS=y # end of Data Access Monitoring # end of Memory Management options diff --git a/sys/linux/damon.txt b/sys/linux/damon.txt new file mode 100644 index 000000000..35313faa0 --- /dev/null +++ b/sys/linux/damon.txt @@ -0,0 +1,77 @@ +# Copyright 2018 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 +include + +resource fd_damon_target_ids[fd] +resource fd_damon_attrs[fd] +resource fd_damon_monitor_on[fd] +resource fd_damon_init_regions[fd] +resource fd_damon_schemes[fd] +resource fd_damon_contexts[fd] + +openat$damon_target_ids(fd const[AT_FDCWD], file ptr[in, string["/sys/kernel/debug/damon/target_ids"]], flags flags[open_flags], mode flags[open_mode]) fd_damon_target_ids +openat$damon_attrs(fd const[AT_FDCWD], file ptr[in, string["/sys/kernel/debug/damon/attrs"]], flags flags[open_flags], mode flags[open_mode]) fd_damon_attrs +openat$damon_init_regions(fd const[AT_FDCWD], file ptr[in, string["/sys/kernel/debug/damon/init_regions"]], flags flags[open_flags], mode flags[open_mode]) fd_damon_init_regions +openat$damon_monitor_on(fd const[AT_FDCWD], file ptr[in, string["/sys/kernel/debug/damon/monitor_on"]], flags flags[open_flags], mode flags[open_mode]) fd_damon_monitor_on +openat$damon_schemes(fd const[AT_FDCWD], file ptr[in, string["/sys/kernel/debug/damon/schemes"]], flags flags[open_flags], mode flags[open_mode]) fd_damon_schemes +openat$damon_kdamond_pid(fd const[AT_FDCWD], file ptr[in, string["/sys/kernel/debug/damon/kdamond_pid"]], flags flags[open_flags], mode flags[open_mode]) fd +openat$damon_mk_contexts(fd const[AT_FDCWD], file ptr[in, string["/sys/kernel/debug/damon/mk_contexts"]], flags flags[open_flags], mode flags[open_mode]) fd_damon_contexts +openat$damon_rm_contexts(fd const[AT_FDCWD], file ptr[in, string["/sys/kernel/debug/damon/rm_contexts"]], flags flags[open_flags], mode flags[open_mode]) fd_damon_contexts + +write$damon_target_ids(fd fd_damon_target_ids, buf ptr[in, damon_target_id_input], count len[buf]) +write$damon_attrs(fd fd_damon_attrs, buf ptr[in, damon_attrs], count len[buf]) +write$damon_init_regions(fd fd_damon_init_regions, buf ptr[in, damon_init_regions], count len[buf]) +write$damon_monitor_on(fd fd_damon_monitor_on, buf ptr[in, string["on"]], count len[buf]) +write$damon_schemes(fd fd_damon_schemes, buf ptr[in, damon_schemes], count len[buf]) +write$damon_contexts(fd fd_damon_contexts, buf ptr[in, array[damon_contexts]], count len[buf]) + +damon_schemes { + min_size fmt[dec, int32] + max_size fmt[dec, int32] + min_acc const[' ', int8] + max_acc const[' ', int8] + min_age fmt[dec, int32] + max_age fmt[dec, int32] + action fmt[dec, int32] +} [packed] + +damon_target_id_input { + paddr optional[string["paddr\n"]] + pids array[damon_target_pid] +} [packed] + +damon_target_pid { + space stringnoz[" "] + pid fmt[dec, pid] +} + +damon_attrs { + sampl_interval damon_attr + aggr_interval damon_attr + reg_upd_interval damon_attr + min damon_attr + max damon_attr +} [packed] + +damon_attr { + space stringnoz[" "] + val fmt[dec, int32] +} + +damon_init_regions { + target damon_target_pid + start damon_addr + end damon_addr +} [packed] + +damon_addr { + space stringnoz[" "] + val fmt[dec, int64] +} + +damon_contexts { + space stringnoz[" "] + dir_name stringnoz[filename] +} diff --git a/sys/linux/damon.txt.const b/sys/linux/damon.txt.const new file mode 100644 index 000000000..30259d4b7 --- /dev/null +++ b/sys/linux/damon.txt.const @@ -0,0 +1,5 @@ +# Code generated by syz-sysgen. DO NOT EDIT. +arches = 386, amd64, arm, arm64, mips64le, ppc64le, riscv64, s390x +AT_FDCWD = 18446744073709551516 +__NR_openat = 56, 386:295, amd64:257, arm:322, mips64le:5247, ppc64le:286, s390x:288 +__NR_write = 4, amd64:1, arm64:riscv64:64, mips64le:5001 -- cgit mrf-deployment