All of lore.kernel.org
 help / color / mirror / Atom feed
From: alison.schofield@intel.com
To: Dan Williams <dan.j.williams@intel.com>,
	Ira Weiny <ira.weiny@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Ben Widawsky <bwidawsk@kernel.org>,
	Dave Jiang <dave.jiang@intel.com>
Cc: Alison Schofield <alison.schofield@intel.com>, linux-cxl@vger.kernel.org
Subject: [PATCH v4 8/8] cxl/mbox: Block inject and clear poison opcodes in raw mode
Date: Fri, 10 Mar 2023 10:49:09 -0800	[thread overview]
Message-ID: <6952da15b164e18e7f26fb26631839837d9797b3.1678471465.git.alison.schofield@intel.com> (raw)
In-Reply-To: <cover.1678471465.git.alison.schofield@intel.com>

From: Alison Schofield <alison.schofield@intel.com>

Inject and clear poison are commands intended for debug environments,
and can cause data corruption if issued without validation. They are
kernel exclusive commands not available to userspace through ioctls,
but could be submitted via the raw mode ioctl.

Add inject and clear poison to the cxl_disabled_raw_commands[] list.
Attempts by userspace to issue either command via the RAW ioctl fail
with -EPERM.

Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---
 drivers/cxl/core/mbox.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
index 77fc811bdfed..4b5e65edbc71 100644
--- a/drivers/cxl/core/mbox.c
+++ b/drivers/cxl/core/mbox.c
@@ -89,6 +89,10 @@ static struct cxl_mem_command cxl_mem_commands[CXL_MEM_COMMAND_ID_MAX] = {
  *
  * CXL_MBOX_OP_[GET_]SCAN_MEDIA: The kernel provides a native error list that
  * is kept up to date with patrol notifications and error management.
+ *
+ * CXL_MBOX_OP_[INJECT|CLEAR]_POISON: The kernel provides a sysfs interface
+ * to these commands that ensures data protection of mapped resources.
+ * See: Documentation/ABI/testing/sysfs-bus-cxl
  */
 static u16 cxl_disabled_raw_commands[] = {
 	CXL_MBOX_OP_ACTIVATE_FW,
@@ -97,6 +101,8 @@ static u16 cxl_disabled_raw_commands[] = {
 	CXL_MBOX_OP_SET_SHUTDOWN_STATE,
 	CXL_MBOX_OP_SCAN_MEDIA,
 	CXL_MBOX_OP_GET_SCAN_MEDIA,
+	CXL_MBOX_OP_INJECT_POISON,
+	CXL_MBOX_OP_CLEAR_POISON,
 };
 
 /*
-- 
2.37.3


  parent reply	other threads:[~2023-03-10 18:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-10 18:49 [PATCH v4 0/8] cxl: CXL Inject & Clear Poison alison.schofield
2023-03-10 18:49 ` [PATCH v4 1/8] cxl/memdev: Add support for the Inject Poison mailbox command alison.schofield
2023-03-10 18:49 ` [PATCH v4 2/8] cxl/memdev: Add support for the Clear " alison.schofield
2023-03-10 18:49 ` [PATCH v4 3/8] tools/testing/cxl: Mock the Inject " alison.schofield
2023-03-10 18:49 ` [PATCH v4 4/8] tools/testing/cxl: Mock the Clear " alison.schofield
2023-03-10 18:49 ` [PATCH v4 5/8] tools/testing/cxl: Use injected poison for get poison list alison.schofield
2023-03-10 18:49 ` [PATCH v4 6/8] tools/testing/cxl: Add a sysfs attr to test poison injection limits alison.schofield
2023-03-10 18:49 ` [PATCH v4 7/8] cxl/memdev: Make inject and clear poison cmds kernel exclusive alison.schofield
2023-03-15 16:59   ` Jonathan Cameron
2023-03-10 18:49 ` alison.schofield [this message]
2023-03-15 17:00   ` [PATCH v4 8/8] cxl/mbox: Block inject and clear poison opcodes in raw mode Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6952da15b164e18e7f26fb26631839837d9797b3.1678471465.git.alison.schofield@intel.com \
    --to=alison.schofield@intel.com \
    --cc=bwidawsk@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.