diff --git a/rpm/sysak-build.sh b/rpm/sysak-build.sh index 8e236d502550ce67fa427b40ec8190bc7563dab8..df35d4630d29ab7ed10d458fce7044ed6ffb454e 100755 --- a/rpm/sysak-build.sh +++ b/rpm/sysak-build.sh @@ -38,19 +38,23 @@ fi %install mkdir -p \$RPM_BUILD_ROOT/usr/bin +mkdir -p \$RPM_BUILD_ROOT/etc/sysak mkdir -p \$RPM_BUILD_ROOT/usr/local/sysak/log mkdir -p \$RPM_BUILD_ROOT/usr/lib/systemd/system/ /bin/cp -rf $BUILD_DIR/.sysak_components \$RPM_BUILD_ROOT/usr/local/sysak/.sysak_components /bin/cp -rf $BUILD_DIR/sysak \$RPM_BUILD_ROOT/usr/bin/ /bin/cp $SOURCE_DIR/rpm/sysak.service \$RPM_BUILD_ROOT/usr/lib/systemd/system/ /bin/cp -f $BUILD_DIR/.sysak_components/tools/monitor/sysakmon.conf \$RPM_BUILD_ROOT/usr/local/sysak/ +/bin/cp -f $BUILD_DIR/.sysak_components/tools/monitor/monctl.conf \$RPM_BUILD_ROOT/usr/local/sysak +/bin/cp -f $BUILD_DIR/.sysak_components/tools/dist/app/etc/* \$RPM_BUILD_ROOT/etc/sysak/ /bin/cp $SOURCE_DIR/rpm/sysak_server.conf \$RPM_BUILD_ROOT/usr/local/sysak/ /bin/cp $SOURCE_DIR/rpm/.sysak.diag.config \$RPM_BUILD_ROOT/etc/sysak/ +/usr/bin/rm -rf \$RPM_BUILD_ROOT/usr/local/sysak/.sysak_components/tools/$LINUX_VERSION %preun - +systemctl stop sysak /sbin/lsmod | grep sysak > /dev/null -if [ $? -eq 0 ]; then +if [ \$? -eq 0 ]; then /sbin/rmmod sysak exit 0 fi @@ -61,6 +65,7 @@ if [ \$1 -eq 0 ]; then fi %files +/etc/sysak /usr/local/sysak /usr/bin/sysak /usr/lib/systemd/system/sysak.service diff --git a/source/mk/bpf.mk b/source/mk/bpf.mk index 8db94475c38e675c118f69cf8fd0014e4b62a16f..831bf7a29ef79fdb761f606c222be9cfd436b809 100644 --- a/source/mk/bpf.mk +++ b/source/mk/bpf.mk @@ -61,6 +61,11 @@ NEWVER := $(shell echo $(KERNEL_VERSION)|awk -F. '{if($$1>3) print 1; else print ifeq ($(NEWVER),1) KERN_VER := -DVER310_LATER endif + +ifneq ($(findstring 4.18.0,$(KERNEL_VERSION)),) + KERN_VER += $(KERN_VER) -DRHEL_RELEASE_GT_8_0 +endif + $(bpfobjs) : %.o : %.c dirs $(call msg,BPF,$@) $(CLANG) -g -O2 $(KERN_VER) -target bpf -D__TARGET_ARCH_$(ARCH) $(INCLUDES) -c $< -o $(OBJPATH)/$@ diff --git a/source/sysak.c b/source/sysak.c index 4333b3bd7fa0bf68cadeb95a80d65a81ab8674a0..f7fdc2fd0ed2f85a61da246e9770c4f0e2e4e80c 100755 --- a/source/sysak.c +++ b/source/sysak.c @@ -1075,7 +1075,7 @@ static int subcmd_parse(int argc, char *argv[]) } } exec: - #btf_support_check(); + // btf_support_check(); return exectue(argc, argv); } diff --git a/source/tools/detect/cgroup/cgtool_comm.h b/source/tools/detect/cgroup/cgtool_comm.h index 07af7325e5bfafc608c64a7594086449705cf9b1..fe06246ceb12fdd67741d1ec61794513fa11ea8f 100644 --- a/source/tools/detect/cgroup/cgtool_comm.h +++ b/source/tools/detect/cgroup/cgtool_comm.h @@ -74,6 +74,7 @@ struct mm_struct___MEMCG { long unsigned int cpu_bitmap[0]; }; +#if 0 struct page_counter { atomic_long_t usage; long unsigned int min; @@ -128,6 +129,7 @@ struct deferred_split { struct list_head split_queue; long unsigned int split_queue_len; }; +#endif union kernfs_node_id { struct { @@ -137,6 +139,7 @@ union kernfs_node_id { u64 id; }; +#if 0 struct mem_cgroup { struct cgroup_subsys_state css; struct mem_cgroup_id id; @@ -214,6 +217,7 @@ struct mem_cgroup { long: 64; long: 64; }; +#endif struct cgroup___MEMCG { struct cgroup_subsys_state self; diff --git a/source/tools/detect/cgroup/cgtoollib_bpf.h b/source/tools/detect/cgroup/cgtoollib_bpf.h index 80e553b1e365026f9f9d30241a1eb8065409294c..e797111c563ffdc76f09eb589ae6fc8dd65a5146 100644 --- a/source/tools/detect/cgroup/cgtoollib_bpf.h +++ b/source/tools/detect/cgroup/cgtoollib_bpf.h @@ -10,7 +10,9 @@ #include "cgtool_comm.h" #define BPF_ANY 0 +#if 0 #define NULL ((void*)0) +#endif static u64 get_knid_by_cgroup(struct cgroup___MEMCG *cgrp) { diff --git a/source/tools/detect/java/java_collect/Makefile b/source/tools/detect/java/java_collect/Makefile index bdfc15538f83cdae1a0fff06e49b1bef7a67fe1e..90fa5db2988531021df08492a53b2294cf61453c 100644 --- a/source/tools/detect/java/java_collect/Makefile +++ b/source/tools/detect/java/java_collect/Makefile @@ -9,6 +9,7 @@ all: $(target) target_rule $(target): $@ cp -r continuous-profile-collector $(TARGET_PATH)/ + rm -rf $(TARGET_PATH)/jruntime mv $(TARGET_PATH)/continuous-profile-collector $(TARGET_PATH)/jruntime cd src && pwd && sh venv.sh && cd ../ cp src/dist/java_collect $(TARGET_PATH)/ diff --git a/source/tools/detect/mem/pagescan/kernel/mm_types.h b/source/tools/detect/mem/pagescan/kernel/mm_types.h index ad4391e15de51cc6ca684d6c161427dbe9dd1182..eb53c4f036ae14f9294aa0c865fb425c4ea254c3 100644 --- a/source/tools/detect/mem/pagescan/kernel/mm_types.h +++ b/source/tools/detect/mem/pagescan/kernel/mm_types.h @@ -175,6 +175,145 @@ struct kmem_cache { unsigned int padding4; /* explicitly add 4 padding */ uintptr_t node[1024]; }; +#elif defined(KERNEL_4_18) +struct page { + long unsigned int flags; + union { + struct { + uintptr_t lru[2]; + uintptr_t mapping; + long unsigned int index; + long unsigned int private; + }; + struct { + uintptr_t dma_addr; + }; + struct { + union { + uintptr_t slab_list[2]; + struct { + uintptr_t next; + int pages; + int pobjects; + }; + }; + uintptr_t slab_cache; + void *freelist; + union { + void *s_mem; + long unsigned int counters; + struct { + unsigned int inuse: 16; + unsigned int objects: 15; + unsigned int frozen: 1; + }; + }; + }; + struct { + long unsigned int compound_head; + unsigned char compound_dtor; + unsigned char compound_order; + int compound_mapcount; + unsigned int mapcount_seqcount; + }; + struct { + long unsigned int _compound_pad_1; + union { + int hpage_pinned_refcount; + struct { + long unsigned int _compound_pad_2; + } rh_kabi_hidden_159; + union { }; + }; + uintptr_t deferred_list[2]; + }; + struct { + long unsigned int _pt_pad_1; + uintptr_t pmd_huge_pte; + long unsigned int _pt_pad_2; + union { + union { + uintptr_t pt_mm; + int pt_frag_refcount; + }; + struct { + uintptr_t pt_mm; + } rh_kabi_hidden_171; + union { }; + }; + unsigned int ptl; + }; + struct { + uintptr_t pgmap; + union { + void *zone_device_data; + struct { + long unsigned int hmm_data; + } rh_kabi_hidden_182; + union { }; + }; + long unsigned int _zd_pad_1; + }; + uintptr_t callback_head[2]; + }; + union { + int _mapcount; + unsigned int page_type; + unsigned int active; + int units; + }; + int _refcount; + union { + long unsigned int memcg_data; + struct { + uintptr_t mem_cgroup; + } rh_kabi_hidden_214; + union { }; + }; +}; + +struct kmem_cache { + uintptr_t cpu_slab; + unsigned int flags; + long unsigned int min_partial; + unsigned int size; + unsigned int object_size; + unsigned int offset; + unsigned int cpu_partial; + unsigned int oo; + unsigned int max; + unsigned int min; + unsigned int allocflags; + int refcount; + void (*ctor)(void *); + unsigned int inuse; + unsigned int align; + unsigned int red_left_pad; + const char *name; + uintptr_t list[2]; + uintptr_t kobj[12]; + union { + uintptr_t reciprocal_size; + struct { + uintptr_t kobj_remove_work[8]; + } rh_kabi_hidden_119; + union { }; + }; + uintptr_t rh_reserved_memcg_params[15]; + unsigned int rh_reserved_max_attr_size; + union { + long unsigned int random; + struct { + uintptr_t memcg_kset; + } rh_kabi_hidden_126; + union { }; + }; + unsigned int remote_node_defrag_ratio; + unsigned int *random_seq; + unsigned int useroffset; + unsigned int usersize; + uintptr_t node[1024]; +}; #elif defined(KERNEL_4_19) struct page { unsigned long flags; @@ -306,7 +445,7 @@ static inline unsigned int get_page_mapcount(struct page *page, { return GET_PAGE_MAPCOUNT(page); } -#elif defined(KERNEL_4_9) || defined(KERNEL_4_19) +#elif defined(KERNEL_4_9) || defined(KERNEL_4_18) || defined(KERNEL_4_19) #define GET_PAGE_REFCOUNT(pg) GET_PAGE_FIELD(pg, _refcount) #define GET_PAGE_COMPOUND_HEAD(pg) GET_PAGE_FIELD(pg, compound_head) #define GET_PAGE_COMPOUND_ORDER(pg) GET_PAGE_FIELD(pg, compound_order) diff --git a/source/tools/monitor/observ/xwatcher/Cargo.toml b/source/tools/monitor/observ/xwatcher/Cargo.toml index 233d476d62f75e68841573e4b66d22897a6f4a6a..cf6cee0dbc59c313b4259a3d73b553c2e8ab5fca 100644 --- a/source/tools/monitor/observ/xwatcher/Cargo.toml +++ b/source/tools/monitor/observ/xwatcher/Cargo.toml @@ -29,7 +29,7 @@ get_if_addrs = "0.5.3" rtrace = {path = "../../../detect/net/rtrace"} crossbeam = "0.8.2" once_cell = "1.18.0" -tokio = { version = "1.34.0", features = ["rt"] } +tokio = { version = "1.34.0", features = ["rt", "rt-multi-thread"] } [build-dependencies] diff --git a/source/tools/monitor/raptor/source/Makefile b/source/tools/monitor/raptor/source/Makefile index d1a729f8515d605c1e9968fbd7ee247857144fbf..85c31c1f8c58bf398b2f0018e35d907c0db7b16f 100644 --- a/source/tools/monitor/raptor/source/Makefile +++ b/source/tools/monitor/raptor/source/Makefile @@ -24,7 +24,7 @@ goenv: .PHONY: build build: - @echo "Complie Golong Code..." \ + @echo "Complie Golong Code..." CGO_CFLAGS="$(EXTRA_CGO_CFLAGS)" \ CGO_LDFLAGS="$(EXTRA_CGO_LDFLAGS)" \ go build -ldflags "-linkmode external -extldflags '-static' -X 'main.version=$(RELEASE_VERSION)' \ diff --git a/source/tools/monitor/raptor/source/config_goenv.sh b/source/tools/monitor/raptor/source/config_goenv.sh index 63df1f5c9db512795859838e027f7179f2cdb305..e6bb237248584acedaf2034b76e71374e90245b0 100755 --- a/source/tools/monitor/raptor/source/config_goenv.sh +++ b/source/tools/monitor/raptor/source/config_goenv.sh @@ -2,7 +2,7 @@ GOVERSION=$(go version | awk '{print $3}') -if [ "$GOVERSION" = "go.1.19.3" ]; then +if [ "$GOVERSION" = "go1.19.3" -o "$GOVERSION" \> "go1.19.3" ]; then echo "Golang Env Configed" else echo "No Golang Env, We Start To Config" diff --git a/source/tools/monitor/raptor/source/ebpf/src/Makefile b/source/tools/monitor/raptor/source/ebpf/src/Makefile index 9e78a71ada165183d5ea24fc04523bf2057a2ac1..1f0afdea3bf6499343e5aacebfb1f29ac4fca380 100644 --- a/source/tools/monitor/raptor/source/ebpf/src/Makefile +++ b/source/tools/monitor/raptor/source/ebpf/src/Makefile @@ -106,6 +106,8 @@ build_bpf: make -C libbpf/ cp -f libbpf/src/.github/actions/build-selftests/vmlinux.h vmlinux/vmlinux.h +$(VMLINUX): build_bpf + profile: build_bpf oncpu.bpf.o offcpu.bpf.o user_slow.bpf.o ping_slow.bpf.o nginx.bpf.o oncpu.bpf.o: oncpu.bpf.c profile.bpf.h $(VMLINUX)