diff --git a/btf/Readme.md b/btf/Readme.md index 358a2392c65b488566d95ff8423bf48f98d5c1d6..1d2744801a639d5c2b9beba3cb901d6b00380c50 100644 --- a/btf/Readme.md +++ b/btf/Readme.md @@ -1,6 +1,6 @@ 如何生成对应的vmlinux.h 0. pahole: git://git.kernel.org/pub/scm/devel/pahole/pahole.git - bptftool: linux 最新: toosl/bpf/bpftool + bptftool: linux 最新: tools/bpf/bpftool 1. 安装对应内核 kernel-debuginfo RPM,获得包含 DWARF 的 vmlinux 2. DWARF 生成 BTF section:pahole -J vmlinux 3. 导出 BTF 字段并生成 headers: bpftool btf dump file vmlinux format c > vmlinux.h diff --git a/btf/btfhive/infoParse.py b/btf/btfhive/infoParse.py index b6cb146e167bcc8e629d722c3b0019d6b3825a07..4e9b84475e04256ed6d5534e97dc6059458497fb 100644 --- a/btf/btfhive/infoParse.py +++ b/btf/btfhive/infoParse.py @@ -48,12 +48,12 @@ class CinfoParse(object): cur.close() return lR - def _chekcFunfilter(self, func): + def _checkFunfilter(self, func): if "%" not in func: raise ValueError(f"bad arg {func}, args should contains %.") def getFuncs(self, func, limit=20): - self._chekcFunfilter(func) + self._checkFunfilter(func) cur = self._db.cursor() sql = f"SELECT func, args, ret, line, fid FROM funs WHERE func LIKE '{func}' LIMIT {limit}" res = cur.execute(sql).fetchall() @@ -65,7 +65,7 @@ class CinfoParse(object): cur = self._db.cursor() sql = f"SELECT func, args, ret, line, fid FROM funs WHERE (ret = '{ret}' OR ret = 'static {ret}')" if func != "": - self._chekcFunfilter(func) + self._checkFunfilter(func) sql += f" AND func LIKE '{func}'" sql += f" LIMIT {limit}" res = cur.execute(sql) @@ -77,7 +77,7 @@ class CinfoParse(object): cur = self._db.cursor() sql = f"SELECT func, args, ret, line, fid FROM funs, json_each(funs.args) WHERE json_each.value = '{arg}'" if func != "": - self._chekcFunfilter(func) + self._checkFunfilter(func) sql += f" AND func LIKE '{func}'" sql += f" LIMIT {limit}" res = cur.execute(sql) diff --git a/btf/btfhive/psSentry.py b/btf/btfhive/psSentry.py index a7ffa7cf7a46c4083a350d8f84d808e366a273c4..28f72a7dbf81d0844c3e5e04e3517f6a91872e75 100644 --- a/btf/btfhive/psSentry.py +++ b/btf/btfhive/psSentry.py @@ -36,7 +36,7 @@ class CpsSentry(object): if task.pid in self._gdbd.keys(): self._gdbd[task.pid] += 1 if self._gdbd[task.pid] > 8: - print(f"need too kill {task.pid}, {comm}, {self._gdbd[task.pid]}") + print(f"need to kill {task.pid}, {comm}, {self._gdbd[task.pid]}") try: task.kill() except (psutil.NoSuchProcess, FileNotFoundError):