From nobody Tue May 30 23:37:46 2023 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 4QW82g01D5z4YMH8; Tue, 30 May 2023 23:37:47 +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 4QW82f6cnPz3hvB; Tue, 30 May 2023 23:37:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1685489866; 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=rPHiQT/q75urKrtqDFoFiZm65tE2xbS0hnX3aQewqV4=; b=dabzWKytyugjw1tVkBMpbLMBOCAF7U7YrzpOjKivQLWvSAaBEHyaC8+JiCTcf7rMIQk3qI 9tLsacubsXOeHnjYVBJCMapoC51dcfN9EX2wgjpnrqICfVjke4KAY2tsY9eaR8+h1P95yL C1dtH5YOVkdtxLrZ6iJ6GoId7WoSApDXNALDjHefZo5lLn0WwEdzO7wu9zQLrU7n/yxyMx kKvTYB4PqcKhw7s0vkcZ8iE9Ac4kmPSOKgF5WPFCp+ljodoDGoDKbpVcajyq3XtWbYFOrX Rx5Pj0gkYs90ldN9jEl28FZ5EeRMevNmweiQ/vJ+TxqHM+vu0dcs5E7x3o8IUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1685489866; 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=rPHiQT/q75urKrtqDFoFiZm65tE2xbS0hnX3aQewqV4=; b=G4dbuQvFu11pSYryI+qsJmVsK0yR++1C9SETVV5xwUJi5chd30FbRwu12XYeZPbWVJyS5I Fc+4O69FhrvPVEpqMUuNYyU3eYV7n7zdDoQYwctyPifz3hfzskBR7IES5Qu2txDUYvbxqC FCOZeg+NNRL/jf89xQHF6+NrCF8JH7MUUtiUxtpHpQ+Ls1+52t9WBVL2hQypGmyfxAaJyB eC2WBlCLGtUnHqXnlrl2adVNul3bper/P3qnto8kTouu3drHL2BK5brwVvNqbL22fRJWtp J4Sz0q+Txn33fRSJnJ6Ejx986m1tZiDO/Dxh798qqBBPy7OV4gQ5mKCHJUH0ZA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1685489866; a=rsa-sha256; cv=none; b=JX5mvmi+RdiAUKajP/U8gemas6pWcbzdpxAToniDbiwb5kZ4iCMf8CLkPMHmkwdNXTS+Iq YItkZSHpjzAZx/O3ErMvQ1TEgz2IAGT1FOhH8AZtMlVURA3ehfg1A+pmphT3qHdf0GCGKi 8Jjgrg93Zulvhm2MT7C6KRQK0tSNwIvLf6vImmHViH20A54ztQ00McL5+DVM4Rq/kAHgg7 ZOwmjUSPwwbNw7vne2Pzha4dng1yMLd4fu3zOgBg2+nncY2iIHX1HO6+RvuZqGTb8tc2Xh Mid/uZh7j7owxDliKG0/RGEkvdlG8wtz8hjiOLNVe+Y+thXfCwQAsIWqqguMnw== 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 4QW82f5Mbfz1Bqn; Tue, 30 May 2023 23:37:46 +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 34UNbkZS056836; Tue, 30 May 2023 23:37:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 34UNbknP056835; Tue, 30 May 2023 23:37:46 GMT (envelope-from git) Date: Tue, 30 May 2023 23:37:46 GMT Message-Id: <202305302337.34UNbknP056835@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 8e63e787abbd - main - pmc: Initialise and check the pm_flags field for CONFIGURELOG 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: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8e63e787abbd69d29e55e2e0b2aa0aa624339f3b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=8e63e787abbd69d29e55e2e0b2aa0aa624339f3b commit 8e63e787abbd69d29e55e2e0b2aa0aa624339f3b Author: Jessica Clarke AuthorDate: 2023-05-30 23:15:24 +0000 Commit: Jessica Clarke CommitDate: 2023-05-30 23:15:24 +0000 pmc: Initialise and check the pm_flags field for CONFIGURELOG Whilst the former is not breaking, the latter is, and so this will be followed by a bump to the pmc major version. This will allow the flags to actually be usable in future, as otherwise we cannot distinguish uninitialised stack junk from a deliberately-initialised value. Reviewed by: jhb, mhorne Differential Revision: https://reviews.freebsd.org/D40049 --- lib/libpmc/libpmc.c | 1 + share/man/man4/hwpmc.4 | 6 ++++++ sys/dev/hwpmc/hwpmc_mod.c | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c index f43fd5d0eac9..4a8e02fafbfe 100644 --- a/lib/libpmc/libpmc.c +++ b/lib/libpmc/libpmc.c @@ -1195,6 +1195,7 @@ pmc_configure_logfile(int fd) { struct pmc_op_configurelog cla; + cla.pm_flags = 0; cla.pm_logfd = fd; if (PMC_CALL(CONFIGURELOG, &cla) < 0) return (-1); diff --git a/share/man/man4/hwpmc.4 b/share/man/man4/hwpmc.4 index 806c2ee701c5..4500e168b021 100644 --- a/share/man/man4/hwpmc.4 +++ b/share/man/man4/hwpmc.4 @@ -598,6 +598,12 @@ An invalid CPU number was passed in for a .Dv PMC_OP_GETPMCINFO operation. .It Bq Er EINVAL +The +.Ar pm_flags +argument to a +.Dv PMC_OP_CONFIGURELOG +request contained unknown flags. +.It Bq Er EINVAL A .Dv PMC_OP_CONFIGURELOG request to de-configure a log file was issued without a log file diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c index c6ec33f88e3c..29518152760f 100644 --- a/sys/dev/hwpmc/hwpmc_mod.c +++ b/sys/dev/hwpmc/hwpmc_mod.c @@ -3438,6 +3438,12 @@ pmc_syscall_handler(struct thread *td, void *syscall_args) break; } + /* No flags currently implemented */ + if (cl.pm_flags != 0) { + error = EINVAL; + break; + } + /* mark this process as owning a log file */ p = td->td_proc; if ((po = pmc_find_owner_descriptor(p)) == NULL)