From nobody Wed Jul 6 11:04:14 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 397341D014DA; Wed, 6 Jul 2022 11:04:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LdGrZ5V0kz3NJ5; Wed, 6 Jul 2022 11:04:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657105455; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xja+Hd5j1VIPRw3WCYd1UlsoWMCxt3SjjVNEn0JwJ8o=; b=MP11zJs0d3jBT7YndL7ZwBpL0dNuMfOlE3Tt0E985+l+VCjpV4V9Mb/KBePAibgXeR3HCV kbaxDVHf+f5HMbjYJt8CrsSqwKQbUXaYwJi9F5AQ/LZcpJBW+cxHROC+poGYEgHWEw9RxP Nf443cCWvCD7Be7Mu/UGwCArJgpdNTpCMCk86WpNKolhrg/2IrtNkhHjWOZJ6DvZ7b8NLX UHBK9FV3JZBhhKpGVHDPczXvk/plLTkpjH1cVmVeP5cPnv4u+lSRAUS/lVoMUMW/TxOCac OL7JcXOMycIMb/keMlvfuPiLfCN74lSSNn43XpdLtl3nbY/pqSrWwdNXxhRF7g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 68E6618F78; Wed, 6 Jul 2022 11:04:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 266B4EW2096726; Wed, 6 Jul 2022 11:04:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 266B4E3q096725; Wed, 6 Jul 2022 11:04:14 GMT (envelope-from git) Date: Wed, 6 Jul 2022 11:04:14 GMT Message-Id: <202207061104.266B4E3q096725@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 5bdeed846dc0 - stable/13 - kdump: Decode Linux *at() syscalls List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5bdeed846dc02d1dc2e845e209bd3bcb6cb8cbf5 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657105455; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xja+Hd5j1VIPRw3WCYd1UlsoWMCxt3SjjVNEn0JwJ8o=; b=VJWJ2T2m4bZt5cfkeoASJtHr/WtbswL5e9Cya5vB/oIwAW/YIhwsodcdEqSxnblFc76phH 201lS+t9IreArZqgmwm/d6Gjc+uTT8lvk0oW/bwJRste8OCnk8Sz2CL3w1ZW9uoLuNTwmB KqS6qhpa7ge+uCMV5Q6wjXnN5iphmbxlFhCKNweIv3SZkaXdYFOkog7uT9s8hlEGRMflHR 3nObhvVrnF8UkjPBraLjQT8GgqEnuoHZG5UlwXzAiH3jJFmRXJFv25NhR8xywfqH8gSfC/ 0JvSc/P9owMV2J5TemxJOVmgD05nVKqiq3NhoxPNPGvUPsBgoreajyFOD7BYrA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1657105455; a=rsa-sha256; cv=none; b=VspR8jZOI1PtotV3mV6vp9y2y25ePxpeSc0x2RLnxnv4XAR6cdtdyey8zJKoVUQ7WecLaH o+Md2VxqjlAFXjie8a9vcoLRCotwIic9dfJOZvmas0PE/AytZgXxGZrxDAP50IQn28dj2X bs6lBAOkhXQrRaRlCkpmuh4/odGT9zfJNC+Ega38VHp3V49hn2YOPIajRWvHP4ZzcxY0gU uus8MB4Uz9CAl9X1seDvy9wBh5Hm9OVIlL8aTsSOl/Ed1oHbAU/gWpPkxufQvBCzGm3hks okfp/ao2m80GoKo9WBp17tVe1E6bwib+5x2x6TMoODH4AaU0wVCAf2SmrNwzkg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=5bdeed846dc02d1dc2e845e209bd3bcb6cb8cbf5 commit 5bdeed846dc02d1dc2e845e209bd3bcb6cb8cbf5 Author: Dmitry Chagin AuthorDate: 2022-06-22 11:29:38 +0000 Commit: Dmitry Chagin CommitDate: 2022-07-06 11:02:15 +0000 kdump: Decode Linux *at() syscalls MFC after: 2 weeks (cherry picked from commit 4d496ab44a09a3a20dbec8968d1b4ef837ab10bb) --- usr.bin/kdump/linux.c | 235 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 232 insertions(+), 3 deletions(-) diff --git a/usr.bin/kdump/linux.c b/usr.bin/kdump/linux.c index 1d9768fc302d..109f7b84e622 100644 --- a/usr.bin/kdump/linux.c +++ b/usr.bin/kdump/linux.c @@ -41,15 +41,16 @@ __FBSDID("$FreeBSD$"); #include "kdump.h" #ifdef __amd64__ -#include +#include #include #elif __aarch64__ -#include +#include #elif __i386__ -#include +#include #endif #include +#include static void print_linux_signal(int signo) @@ -77,6 +78,99 @@ ktrsyscall_linux(struct ktr_syscall *ktr, register_t **resip, quad_align = 0; quad_slots = 1; switch (ktr->ktr_code) { + case LINUX_SYS_linux_faccessat: + case LINUX_SYS_linux_fchmodat: + case LINUX_SYS_linux_fchownat: +#ifdef LINUX_SYS_linux_newfstatat + case LINUX_SYS_linux_newfstatat: +#endif +#ifdef LINUX_SYS_linux_fstatat64 + case LINUX_SYS_linux_fstatat64: +#endif +#ifdef LINUX_SYS_linux_futimesat + case LINUX_SYS_linux_futimesat: +#endif + case LINUX_SYS_linux_linkat: + case LINUX_SYS_linux_mkdirat: + case LINUX_SYS_linux_mknodat: + case LINUX_SYS_linux_openat: + case LINUX_SYS_linux_readlinkat: + case LINUX_SYS_linux_renameat: + case LINUX_SYS_linux_unlinkat: + case LINUX_SYS_linux_utimensat: + putchar('('); + print_integer_arg_valid(sysdecode_atfd, *ip); + c = ','; + ip++; + narg--; + break; + } + switch (ktr->ktr_code) { +#ifdef LINUX_SYS_linux_access + case LINUX_SYS_linux_access: +#endif + case LINUX_SYS_linux_faccessat: + print_number(ip, narg, c); + putchar(','); + print_mask_arg(sysdecode_access_mode, *ip); + ip++; + narg--; + break; +#ifdef LINUX_SYS_linux_chmod + case LINUX_SYS_linux_chmod: +#endif + case LINUX_SYS_linux_fchmodat: + print_number(ip, narg, c); + putchar(','); + decode_filemode(*ip); + ip++; + narg--; + break; + case LINUX_SYS_linux_mknodat: + print_number(ip, narg, c); + putchar(','); + decode_filemode(*ip); + ip++; + narg--; + break; +#ifdef LINUX_SYS_linux_mkdir + case LINUX_SYS_linux_mkdir: +#endif + case LINUX_SYS_linux_mkdirat: + print_number(ip, narg, c); + putchar(','); + decode_filemode(*ip); + ip++; + narg--; + break; + case LINUX_SYS_linux_linkat: + case LINUX_SYS_linux_renameat: + case LINUX_SYS_linux_symlinkat: + print_number(ip, narg, c); + putchar(','); + print_integer_arg_valid(sysdecode_atfd, *ip); + ip++; + narg--; + print_number(ip, narg, c); + break; + case LINUX_SYS_linux_fchownat: + print_number(ip, narg, c); + print_number(ip, narg, c); + print_number(ip, narg, c); + break; +#ifdef LINUX_SYS_linux_newfstatat + case LINUX_SYS_linux_newfstatat: +#endif +#ifdef LINUX_SYS_linux_fstatat64 + case LINUX_SYS_linux_fstatat64: +#endif + case LINUX_SYS_linux_utimensat: + print_number(ip, narg, c); + print_number(ip, narg, c); + break; + case LINUX_SYS_linux_unlinkat: + print_number(ip, narg, c); + break; case LINUX_SYS_linux_clock_gettime: case LINUX_SYS_linux_clock_settime: case LINUX_SYS_linux_clock_getres: @@ -116,6 +210,20 @@ ktrsyscall_linux(struct ktr_syscall *ktr, register_t **resip, ip++; narg--; break; +#ifdef LINUX_SYS_linux_open + case LINUX_SYS_linux_open: +#endif + case LINUX_SYS_linux_openat: + print_number(ip, narg, c); + putchar(','); + print_mask_arg(sysdecode_linux_open_flags, ip[0]); + if ((ip[0] & LINUX_O_CREAT) == LINUX_O_CREAT) { + putchar(','); + decode_filemode(ip[1]); + } + ip += 2; + narg -= 2; + break; case LINUX_SYS_linux_rt_sigaction: putchar('('); print_linux_signal(*ip); @@ -147,6 +255,25 @@ ktrsyscall_linux(struct ktr_syscall *ktr, register_t **resip, c = ','; break; } + switch (ktr->ktr_code) { + case LINUX_SYS_linux_fchownat: + case LINUX_SYS_linux_faccessat: + case LINUX_SYS_linux_fchmodat: +#ifdef LINUX_SYS_linux_newfstatat + case LINUX_SYS_linux_newfstatat: +#endif +#ifdef LINUX_SYS_linux_fstatat64 + case LINUX_SYS_linux_fstatat64: +#endif + case LINUX_SYS_linux_linkat: + case LINUX_SYS_linux_unlinkat: + case LINUX_SYS_linux_utimensat: + putchar(','); + print_mask_arg0(sysdecode_linux_atflags, *ip); + ip++; + narg--; + break; + } *resc = c; *resip = ip; *resnarg = narg; @@ -167,6 +294,82 @@ ktrsyscall_linux32(struct ktr_syscall *ktr, register_t **resip, quad_align = 0; quad_slots = 2; switch (ktr->ktr_code) { + case LINUX32_SYS_linux_faccessat: + case LINUX32_SYS_linux_fchmodat: + case LINUX32_SYS_linux_fchownat: + case LINUX32_SYS_linux_fstatat64: + case LINUX32_SYS_linux_futimesat: + case LINUX32_SYS_linux_linkat: + case LINUX32_SYS_linux_mkdirat: + case LINUX32_SYS_linux_mknodat: + case LINUX32_SYS_linux_openat: + case LINUX32_SYS_linux_readlinkat: + case LINUX32_SYS_linux_renameat: + case LINUX32_SYS_linux_unlinkat: + case LINUX32_SYS_linux_utimensat: + putchar('('); + print_integer_arg_valid(sysdecode_atfd, *ip); + c = ','; + ip++; + narg--; + break; + } + switch (ktr->ktr_code) { + case LINUX32_SYS_linux_access: + case LINUX32_SYS_linux_faccessat: + print_number(ip, narg, c); + putchar(','); + print_mask_arg(sysdecode_access_mode, *ip); + ip++; + narg--; + break; + case LINUX32_SYS_linux_chmod: + case LINUX32_SYS_fchmod: + case LINUX32_SYS_linux_fchmodat: + print_number(ip, narg, c); + putchar(','); + decode_filemode(*ip); + ip++; + narg--; + break; + case LINUX32_SYS_linux_mknodat: + print_number(ip, narg, c); + putchar(','); + decode_filemode(*ip); + ip++; + narg--; + break; + case LINUX32_SYS_linux_mkdir: + case LINUX32_SYS_linux_mkdirat: + print_number(ip, narg, c); + putchar(','); + decode_filemode(*ip); + ip++; + narg--; + break; + case LINUX32_SYS_linux_linkat: + case LINUX32_SYS_linux_renameat: + case LINUX32_SYS_linux_symlinkat: + print_number(ip, narg, c); + putchar(','); + print_integer_arg_valid(sysdecode_atfd, *ip); + ip++; + narg--; + print_number(ip, narg, c); + break; + case LINUX32_SYS_linux_fchownat: + print_number(ip, narg, c); + print_number(ip, narg, c); + print_number(ip, narg, c); + break; + case LINUX32_SYS_linux_fstatat64: + case LINUX32_SYS_linux_utimensat: + print_number(ip, narg, c); + print_number(ip, narg, c); + break; + case LINUX32_SYS_linux_unlinkat: + print_number(ip, narg, c); + break; case LINUX32_SYS_linux_clock_gettime: case LINUX32_SYS_linux_clock_settime: case LINUX32_SYS_linux_clock_getres: @@ -209,6 +412,18 @@ ktrsyscall_linux32(struct ktr_syscall *ktr, register_t **resip, ip++; narg--; break; + case LINUX32_SYS_linux_open: + case LINUX32_SYS_linux_openat: + print_number(ip, narg, c); + putchar(','); + print_mask_arg(sysdecode_linux_open_flags, ip[0]); + if ((ip[0] & LINUX_O_CREAT) == LINUX_O_CREAT) { + putchar(','); + decode_filemode(ip[1]); + } + ip += 2; + narg -= 2; + break; case LINUX32_SYS_linux_signal: case LINUX32_SYS_linux_sigaction: case LINUX32_SYS_linux_rt_sigaction: @@ -240,6 +455,20 @@ ktrsyscall_linux32(struct ktr_syscall *ktr, register_t **resip, c = ','; break; } + switch (ktr->ktr_code) { + case LINUX32_SYS_linux_fchownat: + case LINUX32_SYS_linux_faccessat: + case LINUX32_SYS_linux_fchmodat: + case LINUX32_SYS_linux_fstatat64: + case LINUX32_SYS_linux_linkat: + case LINUX32_SYS_linux_unlinkat: + case LINUX32_SYS_linux_utimensat: + putchar(','); + print_mask_arg0(sysdecode_linux_atflags, *ip); + ip++; + narg--; + break; + } *resc = c; *resip = ip; *resnarg = narg;