Skip to contentSkip to conversation

cxl: Deny Features commands on the RAW mailbox path

PATCH Applied Dave Jiang 2 participants 3 messages Jul 15 – Jul 24 CXL

lore
Share & tools
lore

Dave Jiang

author maintainer
#0 lore raw

PATCH 1/1 cxl: Deny Features commands on the RAW mailbox path

The RAW mailbox command path allows user to issue arbitrary opcodes to the device. The FWCTL interface was introduced to support the CXL Features commands where access control is provided depends on what the CEL indicates.

Add the Features commands to cxl_disabled_raw_commands[] to ensure that all Features commands are only accessible through the FWCTL interface.

The cxl_raw_allow_all debugfs override knob bypasses the disabled list if the user is aware of the risks and wants to use the RAW path for Features commands.

---
 drivers/cxl/core/mbox.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/cxl/core/mbox.c +7 -0
index 7c6c5b7450a5..6dea70a1ff95 100644
@@ -91,6 +91,10 @@ static struct cxl_mem_command cxl_mem_commands[CXL_MEM_COMMAND_ID_MAX] = {
  *
  * CXL_MBOX_OP_[GET_,INJECT_,CLEAR_]POISON: These commands require kernel
  * driver orchestration for safety.
+ *
+ * CXL_MBOX_OP_[GET_SUPPORTED_FEATURES,GET_FEATURE,SET_FEATURE]: Features are
+ * accessed through the fwctl ABI, which applies scope-based access control.
+ * The RAW path would bypass those checks, so it is not permitted here.
  */
 static u16 cxl_disabled_raw_commands[] = {
 	CXL_MBOX_OP_ACTIVATE_FW,
@@ -102,6 +106,9 @@ static u16 cxl_disabled_raw_commands[] = {
 	CXL_MBOX_OP_GET_POISON,
 	CXL_MBOX_OP_INJECT_POISON,
 	CXL_MBOX_OP_CLEAR_POISON,
+	CXL_MBOX_OP_GET_SUPPORTED_FEATURES,
+	CXL_MBOX_OP_GET_FEATURE,
+	CXL_MBOX_OP_SET_FEATURE,
 };
 
 /*

base-commit: a13c140cc289c0b7b3770bce5b3ad42ab35074aa

Signature · 1 line
2.55.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Dave Jiang

The RAW mailbox command path allows user to issue arbitrary opcodes to the device. The FWCTL interface was introduced to support the CXL Features commands where access control is provided depends on what the CEL indicates.

Quoted 7 lines

Add the Features commands to cxl_disabled_raw_commands[] to ensure that all Features commands are only accessible through the FWCTL interface.

The cxl_raw_allow_all debugfs override knob bypasses the disabled list if the user is aware of the risks and wants to use the RAW path for Features commands.

Quoted 36 lines
---
 drivers/cxl/core/mbox.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/cxl/core/mbox.c +7 -0
index 7c6c5b7450a5..6dea70a1ff95 100644
@@ -91,6 +91,10 @@ static struct cxl_mem_command cxl_mem_commands[CXL_MEM_COMMAND_ID_MAX] = {
  *
  * CXL_MBOX_OP_[GET_,INJECT_,CLEAR_]POISON: These commands require kernel
  * driver orchestration for safety.
+ *
+ * CXL_MBOX_OP_[GET_SUPPORTED_FEATURES,GET_FEATURE,SET_FEATURE]: Features are
+ * accessed through the fwctl ABI, which applies scope-based access control.
+ * The RAW path would bypass those checks, so it is not permitted here.
  */
 static u16 cxl_disabled_raw_commands[] = {
 	CXL_MBOX_OP_ACTIVATE_FW,
@@ -102,6 +106,9 @@ static u16 cxl_disabled_raw_commands[] = {
 	CXL_MBOX_OP_GET_POISON,
 	CXL_MBOX_OP_INJECT_POISON,
 	CXL_MBOX_OP_CLEAR_POISON,
+	CXL_MBOX_OP_GET_SUPPORTED_FEATURES,
+	CXL_MBOX_OP_GET_FEATURE,
+	CXL_MBOX_OP_SET_FEATURE,
 };
 
 /*

base-commit: a13c140cc289c0b7b3770bce5b3ad42ab35074aa

Signature · 1 line
2.55.0
author maintainer Applied
#2 lore raw
In reply to Dave Jiang
Quoted 9 lines · Dave Jiang

The RAW mailbox command path allows user to issue arbitrary opcodes to the device. The FWCTL interface was introduced to support the CXL Features commands where access control is provided depends on what the CEL indicates.

Add the Features commands to cxl_disabled_raw_commands[] to ensure that all Features commands are only accessible through the FWCTL interface.

Quoted 5 lines

The cxl_raw_allow_all debugfs override knob bypasses the disabled list if the user is aware of the risks and wants to use the RAW path for Features commands.

Applied to cxl/next
fac9275820a3

Quoted 31 lines
---
 drivers/cxl/core/mbox.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/cxl/core/mbox.c +7 -0
index 7c6c5b7450a5..6dea70a1ff95 100644
@@ -91,6 +91,10 @@ static struct cxl_mem_command cxl_mem_commands[CXL_MEM_COMMAND_ID_MAX] = {
  *
  * CXL_MBOX_OP_[GET_,INJECT_,CLEAR_]POISON: These commands require kernel
  * driver orchestration for safety.
+ *
+ * CXL_MBOX_OP_[GET_SUPPORTED_FEATURES,GET_FEATURE,SET_FEATURE]: Features are
+ * accessed through the fwctl ABI, which applies scope-based access control.
+ * The RAW path would bypass those checks, so it is not permitted here.
  */
 static u16 cxl_disabled_raw_commands[] = {
 	CXL_MBOX_OP_ACTIVATE_FW,
@@ -102,6 +106,9 @@ static u16 cxl_disabled_raw_commands[] = {
 	CXL_MBOX_OP_GET_POISON,
 	CXL_MBOX_OP_INJECT_POISON,
 	CXL_MBOX_OP_CLEAR_POISON,
+	CXL_MBOX_OP_GET_SUPPORTED_FEATURES,
+	CXL_MBOX_OP_GET_FEATURE,
+	CXL_MBOX_OP_SET_FEATURE,
 };
 
 /*

base-commit: a13c140cc289c0b7b3770bce5b3ad42ab35074aa