Skip to contentSkip to conversation

virt: arm-cca-guest: fix error check for RSI_INCOMPLETE

PATCH Applied Sami Mujawar 6 participants 6 messages Apr 10 – Apr 14 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virt: arm-cca-guest: fix error check for RSI_INCOMPLETE

The RSI interface can return RSI_INCOMPLETE when a report spans multiple granules. This is an expected condition and should not be treated as a fatal error.

Currently, arm_cca_report_new() checks for info.result != RSI_SUCCESS and bails out, which incorrectly flags RSI_INCOMPLETE as a failure. Fix the check to only break out on results other than RSI_SUCCESS or RSI_INCOMPLETE.

This ensures partial reports are handled correctly and avoids spurious -ENXIO errors when generating attestation reports.

Fixes 7999edc484ca ("virt: arm-cca-guest: TSM_REPORT support for realms")
---
 drivers/virt/coco/arm-cca-guest/arm-cca-guest.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/virt/coco/arm-cca-guest/arm-cca-guest.c +2 -1
index 0c9ea24a200c..66d00b6ceb78 100644
@@ -157,7 +157,8 @@ static int arm_cca_report_new(struct tsm_report *report, void *data)
 		} while (info.result == RSI_INCOMPLETE &&
 			 info.offset < RSI_GRANULE_SIZE);
 
-		if (info.result != RSI_SUCCESS) {
+		/* Break out in case of failure */
+		if (info.result != RSI_SUCCESS && info.result != RSI_INCOMPLETE) {
 			ret = -ENXIO;
 			token_size = 0;
 			goto exit_free_granule_page;
Signature · 1 line
SAMI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}
Reviewed-by on v1 1/1
#1 lore raw

Look good to me.

Quoted 34 lines · Sami Mujawar

The RSI interface can return RSI_INCOMPLETE when a report spans multiple granules. This is an expected condition and should not be treated as a fatal error.

Currently, arm_cca_report_new() checks for info.result != RSI_SUCCESS and bails out, which incorrectly flags RSI_INCOMPLETE as a failure. Fix the check to only break out on results other than RSI_SUCCESS or RSI_INCOMPLETE.

This ensures partial reports are handled correctly and avoids spurious -ENXIO errors when generating attestation reports.

Fixes 7999edc484ca ("virt: arm-cca-guest: TSM_REPORT support for realms")
---
 drivers/virt/coco/arm-cca-guest/arm-cca-guest.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/virt/coco/arm-cca-guest/arm-cca-guest.c +2 -2
index 0c9ea24a200c..66d00b6ceb78 100644
@@ -157,7 +157,8 @@ static int arm_cca_report_new(struct tsm_report *report, void *data)
 		} while (info.result == RSI_INCOMPLETE &&
 			 info.offset < RSI_GRANULE_SIZE);
 
-		if (info.result != RSI_SUCCESS) {
+		/* Break out in case of failure */
+		if (info.result != RSI_SUCCESS && info.result != RSI_INCOMPLETE) {
 			ret = -ENXIO;
 			token_size = 0;
 			goto exit_free_granule_page;
--
Quoted 2 lines

SAMI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}

--
Sincerely,
Yeoreum Yun

Reviewed-by on v1 1/1
#2 lore raw
In reply to Sami Mujawar
Quoted 9 lines · Sami Mujawar

The RSI interface can return RSI_INCOMPLETE when a report spans multiple granules. This is an expected condition and should not be treated as a fatal error.

Currently, arm_cca_report_new() checks for info.result != RSI_SUCCESS and bails out, which incorrectly flags RSI_INCOMPLETE as a failure. Fix the check to only break out on results other than RSI_SUCCESS or RSI_INCOMPLETE.

Quoted 6 lines

This ensures partial reports are handled correctly and avoids spurious -ENXIO errors when generating attestation reports.

Fixes 7999edc484ca ("virt: arm-cca-guest: TSM_REPORT support for realms")
Quoted 18 lines
---
  drivers/virt/coco/arm-cca-guest/arm-cca-guest.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/virt/coco/arm-cca-guest/arm-cca-guest.c +2 -1
index 0c9ea24a200c..66d00b6ceb78 100644
@@ -157,7 +157,8 @@ static int arm_cca_report_new(struct tsm_report *report, void *data)
  		} while (info.result == RSI_INCOMPLETE &&
  			 info.offset < RSI_GRANULE_SIZE);
 
-		if (info.result != RSI_SUCCESS) {
+		/* Break out in case of failure */
+		if (info.result != RSI_SUCCESS && info.result != RSI_INCOMPLETE) {
  			ret = -ENXIO;
  			token_size = 0;
  			goto exit_free_granule_page;
Reviewed-by on v1 1/1
#3 lore raw
In reply to Sami Mujawar
Quoted 12 lines · Sami Mujawar

The RSI interface can return RSI_INCOMPLETE when a report spans multiple granules. This is an expected condition and should not be treated as a fatal error.

Currently, arm_cca_report_new() checks for info.result != RSI_SUCCESS and bails out, which incorrectly flags RSI_INCOMPLETE as a failure. Fix the check to only break out on results other than RSI_SUCCESS or RSI_INCOMPLETE.

This ensures partial reports are handled correctly and avoids spurious -ENXIO errors when generating attestation reports.

Quoted 7 lines
Fixes 7999edc484ca ("virt: arm-cca-guest: TSM_REPORT support for realms")
---
  drivers/virt/coco/arm-cca-guest/arm-cca-guest.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
Reviewed-by on v1 1/1
#4 lore raw
In reply to Sami Mujawar
Quoted 9 lines · Sami Mujawar

The RSI interface can return RSI_INCOMPLETE when a report spans multiple granules. This is an expected condition and should not be treated as a fatal error.

Currently, arm_cca_report_new() checks for info.result != RSI_SUCCESS and bails out, which incorrectly flags RSI_INCOMPLETE as a failure. Fix the check to only break out on results other than RSI_SUCCESS or RSI_INCOMPLETE.

Quoted 6 lines

This ensures partial reports are handled correctly and avoids spurious -ENXIO errors when generating attestation reports.

Fixes 7999edc484ca ("virt: arm-cca-guest: TSM_REPORT support for realms")
Quoted 18 lines
---
 drivers/virt/coco/arm-cca-guest/arm-cca-guest.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/virt/coco/arm-cca-guest/arm-cca-guest.c +2 -1
index 0c9ea24a200c..66d00b6ceb78 100644
@@ -157,7 +157,8 @@ static int arm_cca_report_new(struct tsm_report *report, void *data)
 		} while (info.result == RSI_INCOMPLETE &&
 			 info.offset < RSI_GRANULE_SIZE);
 
-		if (info.result != RSI_SUCCESS) {
+		/* Break out in case of failure */
+		if (info.result != RSI_SUCCESS && info.result != RSI_INCOMPLETE) {
 			ret = -ENXIO;
 			token_size = 0;
 			goto exit_free_granule_page;
maintainer Applied
#5 lore raw
In reply to Sami Mujawar
Quoted 10 lines · Sami Mujawar

The RSI interface can return RSI_INCOMPLETE when a report spans multiple granules. This is an expected condition and should not be treated as a fatal error.

Currently, arm_cca_report_new() checks for info.result != RSI_SUCCESS and bails out, which incorrectly flags RSI_INCOMPLETE as a failure. Fix the check to only break out on results other than RSI_SUCCESS or RSI_INCOMPLETE.

[...]

Applied to arm64 (for-next/misc), thanks!

[1/1] virt: arm-cca-guest: fix error check for RSI_INCOMPLETE

      https://git.kernel.org/arm64/c/e534e9d13d0b