Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModeSelect6 fails with DEC Alpha system #1402

Closed
kkaempf opened this issue Dec 20, 2023 · 6 comments · Fixed by #1405
Closed

ModeSelect6 fails with DEC Alpha system #1402

kkaempf opened this issue Dec 20, 2023 · 6 comments · Fixed by #1405

Comments

@kkaempf
Copy link
Contributor

kkaempf commented Dec 20, 2023

Info

  • Which version of Pi are you using: 3
  • Which github revision of software: HEAD (tag 23.11.01)
  • Which board version: 2.3B
  • Which computer is the PiSCSI connected to: DEC Personal Workstation 433au, running OpenVMS/Alpha 7.3
  • Which OS you are using (output of 'lsb_release -a'): Debian 11 (bullseye)

Describe the issue

Booting from piscsi fails in the SRM console (aka 'BIOS') with failed to open
Running with debug reveals

[2023-12-20 16:40:20.184] [debug] (ID:LUN 0:0) - Device is executing TestUnitReady ($00)
[2023-12-20 16:40:20.194] [debug] (ID:LUN 0:0) - Device is executing ModeSelect6 ($15)
[2023-12-20 16:40:20.194] [debug] (ID 0) - Error status: Sense Key $05, ASC $26
@kkaempf
Copy link
Contributor Author

kkaempf commented Dec 20, 2023

Digging through the code (and adding more log messages) reveals that ModeSelect6 is called with a page code of 0 (== "supported diagnostic pages") but the code in cpp/devices/scsi_command_util.cpp only recognizes page 3.

@rdmark
Copy link
Member

rdmark commented Dec 21, 2023

Thanks for reporting, and tracking down the code that’s responsible.

The next step here would be to track down what the SCSI specification says about ModeSelect6 page code 0.

We don’t have an active core developer in this project right now, so if you’re up for it we would very much welcome your contribution.

@rdmark
Copy link
Member

rdmark commented Dec 21, 2023

Additionally, it would be helpful if you could test with the previous stable release version, April 2023. There was a good amount of refactoring that happened, which also touched the ModeSelect code.

https://github.com/PiSCSI/piscsi/releases/tag/v23.04.01

@kkaempf
Copy link
Contributor Author

kkaempf commented Dec 21, 2023

v23.04.01 shows the same behaviour.

Digging deeper now and trying to come up with a PR 🤞🏻

@kkaempf
Copy link
Contributor Author

kkaempf commented Dec 25, 2023

So turns out it was actually three bugs, one generic, two specific to DEC Alpha, in ModeSelect6 😆

@rdmark
Copy link
Member

rdmark commented Jan 9, 2024

Merged. Thanks for the patches!

@rdmark rdmark closed this as completed Jan 9, 2024
kkaempf added a commit to kkaempf/piscsi that referenced this issue Apr 1, 2024
Follow-up on PiSCSI#1402, PiSCSI#1405, PiSCSI#1427

This is the first (yet incomplete) test to cover this behavior.

Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
kkaempf added a commit to kkaempf/piscsi that referenced this issue Apr 1, 2024
Follow up on PiSCSI#1402, PiSCSI#1405 which had a full test case missing.

Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
kkaempf added a commit to kkaempf/piscsi that referenced this issue Apr 1, 2024
OpenVMS Alpha sends a strange ModeSelect payload, apparently one byte
too large. This was 'fixed' by a (wrong) length calculation in PiSCSI#1405, breaking PiSCSI#1427.

This PR
- fixes the wrong length calculation
- improves the loop test in scsi_command_util::ModeSelect to prevent a
  buffer overflow. (Remaining length was checked for > 0, but buffer
  access is at offset and offset + 1, effectively requiring 2 bytes.)
- the loop test fix makes PiSCSI#1402 pass
- adds a testcase for PiSCSI#1402
- adds a testcase for PiSCSI#1427

Fixes issue PiSCSI#1427

Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
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 a pull request may close this issue.

2 participants