Skip to content

Conversation

mayank-microsoft
Copy link

Description

We encountered some errors where on attaching a ReadOnly disk led to write failures. We RCA'd the failure to the Volume protocol not being set to be write protected. We are proposing this change to update the blockIo protocol's media property to set Write protections based on performing a MODE SENSE operation.

For details on how to complete these options and their meaning refer to CONTRIBUTING.md.

  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • Includes tests?
  • Includes documentation?

How This Was Tested

We tested the change while booting a VM with VHD attached as read only mode and then without read-only mode. We don't encounter any errors which we were hitting earlier.

Integration Instructions

NA

@mayank-microsoft mayank-microsoft force-pushed the user/mayankkumar/scsi-mode-sense branch from ff10435 to 67cde81 Compare October 9, 2025 12:36
@codecov-commenter
Copy link

codecov-commenter commented Oct 9, 2025

Codecov Report

❌ Patch coverage is 0% with 78 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release/202502@0e56f3d). Learn more about missing BASE report.

Files with missing lines Patch % Lines
MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c 0.00% 78 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##             release/202502    #1524   +/-   ##
=================================================
  Coverage                  ?    2.22%           
=================================================
  Files                     ?     1461           
  Lines                     ?   380847           
  Branches                  ?     4583           
=================================================
  Hits                      ?     8477           
  Misses                    ?   372297           
  Partials                  ?       73           
Flag Coverage Δ
MdeModulePkg 1.56% <0.00%> (?)
MdePkg 5.46% <ø> (?)
NetworkPkg 0.55% <ø> (?)
PolicyServicePkg 30.42% <ø> (?)
UefiCpuPkg 4.85% <ø> (?)
UnitTestFrameworkPkg 11.40% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@os-d os-d requested review from apop5, kuqin12 and makubacki October 9, 2025 14:22
@os-d
Copy link
Contributor

os-d commented Oct 9, 2025

edk2 PR opened in parallel: tianocore/edk2#11603

@mayank-microsoft mayank-microsoft force-pushed the user/mayankkumar/scsi-mode-sense branch from 67cde81 to 3588692 Compare October 10, 2025 06:14
@mayank-microsoft mayank-microsoft force-pushed the user/mayankkumar/scsi-mode-sense branch from 3588692 to c7c3faa Compare October 10, 2025 06:39
@mayank-microsoft mayank-microsoft requested a review from os-d October 13, 2025 13:43

// Mode Sense 6 Byte Command returns the Write Protection status in the 3rd byte
// Bit 7 of the 3rd byte indicates the Write Protection status
*WriteProtectionEnabled = (DataBuffer[2] & 0x80) != 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where do you find this definition? I did a quick search and couldn't find it defined

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spbrogan the SCSI stuff is not easily searchable, but copilot does a good job finding the write docs :). https://www.t10.org/ftp/t10/document.05/05-344r0.pdf see section 6.3.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants