From nobody Wed Jun 22 11:41:03 2022 X-Original-To: dev-commits-src-main@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 5B0CD8719AA; Wed, 22 Jun 2022 11:41:05 +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 4LShKW3wdhz4scC; Wed, 22 Jun 2022 11:41:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655898063; 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=JZWyW8xhe9XTNZNnBk1JLxnkLDqgRj/mNgwa75MXLqM=; b=SaiQw6ubtRFs2r+ryPipayIlUEyyoIOlJR6FRmrKRhaKwi4yWEFK+c4Pud16EQREa6oV4I T1uskVaA5qdNtc26VBKP8kUu0jgup1Bovuh6dXRkYRKHigvBOZTsN59AV24xVTZ6YUeKrr WXiINORFa/MdtCd1I2EKUslhuM0mItEPgJcxOmFbxSD7EaJZoJmCTFc787F2uYrY/14S+L q7J4/bZoThB4uiLwy6nAe0V5UPVWUGZNelT1PQwIFLXUOgzvL7OS07101Z2Dn/ZKy9rayJ Q7/EGa9dPi0zvyjle5jQ2NRnY/xVtJnxavmoIG6eTmI7+Mp9/Zb2O+X6b4cxMQ== 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 3B56025656; Wed, 22 Jun 2022 11:41:03 +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 25MBf3ss023736; Wed, 22 Jun 2022 11:41:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25MBf3xH023735; Wed, 22 Jun 2022 11:41:03 GMT (envelope-from git) Date: Wed, 22 Jun 2022 11:41:03 GMT Message-Id: <202206221141.25MBf3xH023735@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 3606a213bfa4 - main - kdump: Decode Linux l_sigset_t. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 3606a213bfa42e1970197ba9b3494c88d5827259 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655898063; 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=JZWyW8xhe9XTNZNnBk1JLxnkLDqgRj/mNgwa75MXLqM=; b=YOCLeshuc6a0cHMyjRGihbTuvxAehIbEcDRDq24rIPlfhdg33dEmC2Po9BgvsmDz6tCm4U eajdnqdDH0ko9oEEoJc0/tPb9fYh4i29/u+wZJKSSPcP/w9O6Eksemiy9E28XvbsYonTEv LUFD+OYcrsihcLobDhmlaGZyW2ydGu3Ub21NZs9rvx4K2U3phGfBIIT+rYNXPEF9Iv84va uGLgf3NrTvrH19c8LrrkNsKOsyPVuNJj/H/+jA9FZBAPnFTB+ABNMGRZ2oZKv9zVeUU5fi YHdNUeHF6jB6dDvjTxZOQAGxjMEv2Zhvq6JbVqvVw70R4w54ZwgXvhewqXUpqA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655898063; a=rsa-sha256; cv=none; b=c3TnxCuGwWBwodC6uB01gGJzDtN82n6DZ23w16bQCzI0H6heNTR1DG+D2MYUfexVrLlkxr CC+HtsFJTWcDnxYPg/XgR9lVrXoxJZSR/SW7QgIdMTvx/7Hmr47aq+RDCJfJ1XEwcVpPSp 25A1czci3q+tRx+Ev3Eoz/1qufggM1cLveeHKzK3NNMqbAYA1ekmIQCcdncCHdLVgRl0Se J/Ccv1j6v85MmI/8+rhUxY4Bs5rwQngO75uIpChJHIwj0oXyS2Q1R3itvdQEPXQp18RJpt R62MFj3SWopq6MTi0bAy5qAvVqYY7PGml+orXN1KMGYBU+YmE1I5wqYBGPbIAw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=3606a213bfa42e1970197ba9b3494c88d5827259 commit 3606a213bfa42e1970197ba9b3494c88d5827259 Author: Dmitry Chagin AuthorDate: 2022-06-22 11:15:20 +0000 Commit: Dmitry Chagin CommitDate: 2022-06-22 11:15:20 +0000 kdump: Decode Linux l_sigset_t. Reviewed by: markj Differential revision: https://reviews.freebsd.org/D35153 MFC after: 2 weeks --- usr.bin/kdump/kdump.c | 5 ++++- usr.bin/kdump/kdump.h | 1 + usr.bin/kdump/linux.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c index 79a5007bd1ec..5c05a82b53ba 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -2056,7 +2056,10 @@ ktrstruct(char *buf, size_t buflen) ktrbitset(name, set, datalen); free(set); } else { - printf("unknown structure\n"); +#ifdef SYSDECODE_HAVE_LINUX + if (ktrstruct_linux(name, data, datalen) == false) +#endif + printf("unknown structure\n"); } return; invalid: diff --git a/usr.bin/kdump/kdump.h b/usr.bin/kdump/kdump.h index dc0515397f48..29bdb1dfbbaf 100644 --- a/usr.bin/kdump/kdump.h +++ b/usr.bin/kdump/kdump.h @@ -77,6 +77,7 @@ bool print_mask_arg_part(bool (*decoder)(FILE *, int, int *), int value, int *rem); #ifdef SYSDECODE_HAVE_LINUX +bool ktrstruct_linux(const char *name, const char *data, size_t datalen); void ktrsyscall_linux(struct ktr_syscall *ktr, register_t **resip, int *resnarg, char *resc); #ifdef __amd64__ diff --git a/usr.bin/kdump/linux.c b/usr.bin/kdump/linux.c index e584b54db36c..ed057a6b8ef6 100644 --- a/usr.bin/kdump/linux.c +++ b/usr.bin/kdump/linux.c @@ -31,7 +31,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include +#include +#include #include #include "kdump.h" @@ -45,6 +49,8 @@ __FBSDID("$FreeBSD$"); #include #endif +#include + static void print_linux_signal(int signo) { @@ -183,3 +189,41 @@ ktrsyscall_linux32(struct ktr_syscall *ktr, register_t **resip, *resnarg = narg; } #endif /* __amd64__ */ + +static void +ktrsigset(const char *name, const l_sigset_t *mask, size_t sz) +{ + unsigned long i, c; + + printf("%s [ ", name); + c = 0; + for (i = 1; i <= sz * CHAR_BIT; i++) { + if (!LINUX_SIGISMEMBER(*mask, i)) + continue; + if (c != 0) + printf(", "); + printf("%s", sysdecode_linux_signal(i)); + c++; + } + if (c == 0) + printf("empty ]\n"); + else + printf(" ]\n"); +} + +bool +ktrstruct_linux(const char *name, const char *data, size_t datalen) +{ + l_sigset_t mask; + + if (strcmp(name, "l_sigset_t") == 0) { + /* Old Linux sigset_t is one word size. */ + if (datalen < sizeof(int) || datalen > sizeof(l_sigset_t)) + return (false); + memcpy(&mask, data, datalen); + ktrsigset(name, &mask, datalen); + } else + return (false); + + return (true); +}