From nobody Tue Mar 05 05:44:16 2024 X-Original-To: dev-commits-src-all@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 4Tpkyn27MWz5Brxx; Tue, 5 Mar 2024 05:44:17 +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 4Tpkym5KGvz3xfl; Tue, 5 Mar 2024 05:44:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709617456; 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=BltF+ZdLhUe8jbAveRpskgbnVmYwsBLg60Y7ijg5/IQ=; b=QoPh/gUGxI8S7KcMQTtIeTs+tfo2kKniJmBpJ8StsvkIXniqKfXfbRwPT8EU/+lGUoso09 8vcGpWrMn1HLVrAU4yL/cK9qzAy2Qw+zSs4uE+ZcEeGc3qPYCq4uyOZkwz4zdoo8BtRFg6 6bcIwitBngToVYLqXhKY1/LbsZVY4N0Wdc30IVCPBfvT+PoIU1dbeCxsyps/1bGaS3nFNT jgcthn29pmL6BqeTsR7nxCCqG4BbGt4Y9wgiDxIZfTjsTDkZpQMetD90a9bLW44AZSDIOb Uuk+hWEUMWp56BHgVtYCuVNElpvguLSYXQl+yS1GguOtMsz0NEGeZ53lPaf9gA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1709617456; a=rsa-sha256; cv=none; b=dI4DlRfrVyQq+cw4I3P/5eRKZ8LGba2nqtmIrfyvbUNspJjWUGEoh4muYcGVwXW5ZNUomb IM8pUIYSeGpPzU93WNFg24/4b8sngSFMSV/CNURM3VBgQftbxQM6UUKZTNhuLnqOsm9WDB W4VgGayXK7K9PL0fghU1iR6HibHZudTaHr3p0W/DIz1F7wdy7WaycDRC0pPilTXMbb6bLH sSNnGMw5mcqfMEZQk2iKVvKlqeUOfBsiBdGn9ouRxDaAsmG94R8EAdPgB5LRrItJXRbd5X 6QbI1+Sbdg0Ny/36D31HpTbxMB3sdUppSuoWXe21iZazD+hhrEGC793APKT31g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709617456; 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=BltF+ZdLhUe8jbAveRpskgbnVmYwsBLg60Y7ijg5/IQ=; b=nd8bs2t88v8IV6T2x6c7GpXCRJirpQSrRo71coSLR0roLdRv/Rpq2ad7EwYDPAjX4+0aJf EIomapNfJ7AuT2sVdBA79v12rMXA3bcR0SrMNHZSdEIqHteUVbJ0DAMxl/eHf4bvInXZ2Z d7ABXxLWKE2AJvJrHto+rWx2EDnIK/IulQCgtqvk4NeBFsxMndGP0HMvxP1kjKJztsoliY nZLMglnQKIB/vEfPtzGa+s9ddGqh7Be13Y2eS4f6Id38p0/OaHfs8S5ZE7EYZcl0bKxDpo 2JBv2OiQE8B42yBXB9cZoLcDvFotKOPT8t4Rq0yYYACRWVkZhHMwTtWC/TLKmA== 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 4Tpkym4SgqztV6; Tue, 5 Mar 2024 05:44:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4255iGK2011463; Tue, 5 Mar 2024 05:44:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4255iGcN011460; Tue, 5 Mar 2024 05:44:16 GMT (envelope-from git) Date: Tue, 5 Mar 2024 05:44:16 GMT Message-Id: <202403050544.4255iGcN011460@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 02c57f7b4877 - main - kdump: decode pollfd struct arrays coming from poll(2) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 02c57f7b48772c5ec4e3a0a3405273b387b9bb08 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=02c57f7b48772c5ec4e3a0a3405273b387b9bb08 commit 02c57f7b48772c5ec4e3a0a3405273b387b9bb08 Author: Kyle Evans AuthorDate: 2024-03-05 04:14:06 +0000 Commit: Kyle Evans CommitDate: 2024-03-05 05:44:09 +0000 kdump: decode pollfd struct arrays coming from poll(2) We'll handle these just as we do kevents, one per line with subsequent lines indented sufficiently to distinguish them from the upcoming return value. Sample, with indentation stripped and revents changed to '...' in the first one to keep the line length down: CALL poll(0x820610560,0x3,0) STRU struct pollfd[] = { { fd=0, events=0x1, revents=0x11<...> { fd=1, events=0x4, revents=0x4} { fd=-1, events=0x4, revents=0} } RET poll 2 Reviewed by: bapt, jhb Differential Revision: https://reviews.freebsd.org/D44160 --- usr.bin/kdump/kdump.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c index 0253fdc9e87b..f5bb4dcfea42 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -110,6 +111,7 @@ void ktrcapfail(struct ktr_cap_fail *); void ktrfault(struct ktr_fault *); void ktrfaultend(struct ktr_faultend *); void ktrkevent(struct kevent *); +void ktrpollfd(struct pollfd *); void ktrstructarray(struct ktr_struct_array *, size_t); void ktrbitset(char *, struct bitset *, size_t); void ktrsyscall_freebsd(struct ktr_syscall *ktr, register_t **resip, @@ -2209,10 +2211,23 @@ ktrkevent(struct kevent *kev) printf(", data=%#jx, udata=%p }", (uintmax_t)kev->data, kev->udata); } +void +ktrpollfd(struct pollfd *pfd) +{ + + printf("{ fd=%d", pfd->fd); + printf(", events="); + print_mask_arg0(sysdecode_pollfd_events, pfd->events); + printf(", revents="); + print_mask_arg0(sysdecode_pollfd_events, pfd->revents); + printf("}"); +} + void ktrstructarray(struct ktr_struct_array *ksa, size_t buflen) { struct kevent kev; + struct pollfd pfd; char *name, *data; size_t namelen, datalen; int i; @@ -2294,6 +2309,11 @@ ktrstructarray(struct ktr_struct_array *ksa, size_t buflen) kev.udata = (void *)(uintptr_t)kev32.udata; ktrkevent(&kev); #endif + } else if (strcmp(name, "pollfd") == 0) { + if (ksa->struct_size != sizeof(pfd)) + goto bad_size; + memcpy(&pfd, data, sizeof(pfd)); + ktrpollfd(&pfd); } else { printf(" }\n"); return;