On Thu, Sep 08, 2022 at 03:01:14PM +0200, Moritz Buhl wrote:
> On Wed, Aug 31, 2022 at 05:44:31PM -0900, Philip Guenther wrote:
> > kdump.c will need at least a SYS_recvmmsg line in the big table, and if you
> > do a ktrmmsghdr() bit in the kernel a matching decoder will be needed in
> > kdump.
>
> Here is a new diff for kdump.
> OK?
OK bluhm@
> Index: usr.bin/kdump/kdump.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/kdump/kdump.c,v
> retrieving revision 1.149
> diff -u -p -r1.149 kdump.c
> --- usr.bin/kdump/kdump.c 20 Jul 2022 05:56:36 -0000 1.149
> +++ usr.bin/kdump/kdump.c 7 Sep 2022 11:14:19 -0000
> @@ -720,6 +720,8 @@ static const formatter scargs[][8] = {
> [SYS_ptrace] = { Ptracedecode, Ppid_t, Pptr, Pdecint },
> [SYS_recvmsg] = { Pfd, Pptr, Sendrecvflagsname },
> [SYS_sendmsg] = { Pfd, Pptr, Sendrecvflagsname },
> + [SYS_recvmmsg] = { Pfd, Pptr, Pucount, Sendrecvflagsname, Pptr },
> + [SYS_sendmmsg] = { Pfd, Pptr, Pucount, Sendrecvflagsname },
> [SYS_recvfrom] = { Pfd, Pptr, Pbigsize, Sendrecvflagsname },
> [SYS_accept] = { Pfd, Pptr, Pptr },
> [SYS_getpeername] = { Pfd, Pptr, Pptr },
> Index: usr.bin/kdump/ktrstruct.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/kdump/ktrstruct.c,v
> retrieving revision 1.29
> diff -u -p -r1.29 ktrstruct.c
> --- usr.bin/kdump/ktrstruct.c 21 Dec 2020 07:47:37 -0000 1.29
> +++ usr.bin/kdump/ktrstruct.c 7 Sep 2022 10:00:23 -0000
> @@ -398,6 +398,18 @@ ktrquota(const struct dqblk *quota)
> }
>
> static void
> +ktrmmsghdr(const struct mmsghdr *mmsg)
> +{
> + printf("struct mmsghdr { msg_hdr = { name=%p, namelen=%u, "
> + "iov=%p, iovlen=%u, control=%p, controllen=%u, flags=",
> + mmsg->msg_hdr.msg_name, mmsg->msg_hdr.msg_namelen,
> + mmsg->msg_hdr.msg_iov, mmsg->msg_hdr.msg_iovlen,
> + mmsg->msg_hdr.msg_control, mmsg->msg_hdr.msg_controllen);
> + sendrecvflagsname(mmsg->msg_hdr.msg_flags);
> + printf(" }, msg_len = %u }\n", mmsg->msg_len);
> +}
> +
> +static void
> ktrmsghdr(const struct msghdr *msg)
> {
> printf("struct msghdr { name=%p, namelen=%u, iov=%p, iovlen=%u,"
> @@ -649,6 +661,13 @@ ktrstruct(char *buf, size_t buflen)
> goto invalid;
> memcpy(&msg, data, datalen);
> ktrmsghdr(&msg);
> + } else if (strcmp(name, "mmsghdr") == 0) {
> + struct mmsghdr mmsg;
> +
> + if (datalen != sizeof(mmsg))
> + goto invalid;
> + memcpy(&mmsg, data, datalen);
> + ktrmmsghdr(&mmsg);
> } else if (strcmp(name, "iovec") == 0) {
> if (datalen % sizeof(struct iovec))
> goto invalid;