From nobody Mon Mar 18 15:53:20 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 4TyzsY2KlZz5Dyk8; Mon, 18 Mar 2024 15:53:21 +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 4TyzsY1GPVz4cNk; Mon, 18 Mar 2024 15:53:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710777201; 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=RFEo53vlkebyx6uFISo6mMrZTYalj4Ghx5Vs5KGAzzs=; b=LpziFKDUJDgYhrNJKXj9KRIluME2rH2TGE7Q6vu+Rf7guImNKsKViNO0QWkCzj3EbL/sct PmHKXvmKmgtdTkqyA8jBuNmFZVMhMbEUH6vPJp1F7nRn/4BburaMbdKXtruLCnT//qhmjF QWNlbe0EhA8PEXRTaMffSkFXNftutknhhnpQCPU+XlkaHdP990U1jAxZsD+9wcJEiCGAo+ IrQmip11OzNIHp86omdAaqGLGOq85g0CIW972vCDTaokBy9ufhP5XkZlv1gXXvNn0L82Kg lDDwrC/FFTQf7hUwny0ZvDrNkt4q8gSLMvjZ9RkuDTF+Y4FJChqkMxlhofOKug== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1710777201; a=rsa-sha256; cv=none; b=eq/hSrn3LQioFTHcRxY1P5aWV6k3vISuiQrsWwqdtg2PlxvwZ16xdZGVIkuc8xq2Q48mFD bAADQDtWwnr93g7LR4lNs8Oz0w5TN/WDzgUS1RS2gYq/9dqSFR9fjw9ODGFha6LhvCKpwq Fov2LGIh9cQCWNHcv/hl6eIGgcWcfLtzYL8I9NMojtbr+2aqrcwKtAfGDvYv8XnVlgFgVY cZSm3PKJkqw7QXlJXJWpW1g5ZRu3oD85PH6t0egZMTgQOa0QR19LrKndIfmpCRJqCkbLdm 4OZswCvasmw7EOKqzwU7u4UtKyegDJtp20w1W5RzK4Q4C2jRyh2es9gBjtEWaQ== 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=1710777201; 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=RFEo53vlkebyx6uFISo6mMrZTYalj4Ghx5Vs5KGAzzs=; b=e38yMKC8r7QL3ANb1OgivrB6vrUtv873+xKgaXA4rQpxnOqEIFqWC6oDaaa88ue8CuPgKN Wjw7fAQ8JJgA/+56zGbNpLo43Dj3WAHksU5iNF6Nl3Y8ZwKNgLyTbCCsdwno8Qfj9pWXOM kEBwYQkLB7EoxtaPACl/L/1oDCuwomP8Anf08CWDxlPRnwOD4ugJBoQ5wbbeZlMzHmHlsQ tjgpt6BYVwQasITZyeb2QzsyRD/bLvUVYBjLq0FJD1EldXGzB2gmKV1SKyj9nQylgwXYHP F0/GBMwp9uxrFhvZ2zDTilSq/B4Nm8LtqrPyFK+3ks5zbnY4wHgfHHbJwYmWeg== 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 4TyzsY0bbJzTPP; Mon, 18 Mar 2024 15:53:21 +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 42IFrKb9001300; Mon, 18 Mar 2024 15:53:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42IFrKjB001297; Mon, 18 Mar 2024 15:53:20 GMT (envelope-from git) Date: Mon, 18 Mar 2024 15:53:20 GMT Message-Id: <202403181553.42IFrKjB001297@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: b983d4f63cb5 - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: b983d4f63cb5f8bd3955c092b4d166c4d0bd972d Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=b983d4f63cb5f8bd3955c092b4d166c4d0bd972d commit b983d4f63cb5f8bd3955c092b4d166c4d0bd972d Author: Kyle Evans AuthorDate: 2024-03-05 04:14:06 +0000 Commit: Kyle Evans CommitDate: 2024-03-18 15:52:58 +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 (cherry picked from commit 02c57f7b48772c5ec4e3a0a3405273b387b9bb08) --- 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 078b8a364db8..d69c019bd6be 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -58,6 +58,7 @@ static char sccsid[] = "@(#)kdump.c 8.1 (Berkeley) 6/6/93"; #include #include #include +#include #include #include #include @@ -122,6 +123,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, @@ -2221,10 +2223,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; @@ -2306,6 +2321,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;