lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <7E1751DB-16D7-430C-BDAC-CFE3D39EC126@kolumbus.fi>
Date: Fri, 6 Sep 2024 09:19:35 +0300
From: "Kai Mäkisara (Kolumbus)" <kai.makisara@...umbus.fi>
To: Rafael Rocha <vidurri@...il.com>
Cc: "James.Bottomley@...senpartnership.com" <James.Bottomley@...senPartnership.com>,
 "Martin K. Petersen" <martin.petersen@...cle.com>,
 linux-scsi@...r.kernel.org,
 LKML <linux-kernel@...r.kernel.org>,
 rrochavi@...l.gov
Subject: Re: [PATCH] scsi: st: Fix input/output error on empty drive reset



> On 5. Sep 2024, at 20.39, Rafael Rocha <vidurri@...il.com> wrote:
> 
> A previous change was introduced to prevent data loss during a power-on reset
> when a tape is present inside the drive. This change set the "pos_unknown" flag
> to true to avoid operations that could compromise data by performing actions
> from an untracked position. The relevant commit is:
> 
> Commit: 9604eea5bd3ae1fa3c098294f4fc29ad687141ea
> Subject: scsi: st: Add third-party power-on reset handling
> 
The pos_unknown flag was introduced to prevent writing and reading from an
unknown position (usually when the drive rewinds the tape when the device
is reset). This commit added code to catch a case which the midlevel did
not catch.

> As a consequence of this change, a new issue has surfaced: the driver now
> returns an "Input/output error" even for empty drives when the drive, host, or
> bus is reset. This issue stems from the "flush_buffer" function, which first
> checks whether the "pos_unknown" flag is set. If the flag is set, the user will
> encounter an "Input/output error" until the tape position is known again. This
> behavior differs from the previous implementation, where empty drives were not
> affected at system start up time, allowing tape software to send commands to
> the driver to retrieve the drive's status and other information.
> 
> The current behavior prioritizes the "pos_unknown" flag over the "ST_NO_TAPE"
> status, leading to issues for software that detects drives during system
> startup. This software will receive an "Input/output error" until a tape is
> loaded and its position is known.
> 
> To resolve this, the "ST_NO_TAPE" status should take priority when the drive is
> empty, allowing communication with the drive following a power-on reset. At the
> same time, the change should continue to protect data by maintaining the
> "pos_unknown" flag when the drive contains a tape and its position is unknown.

> Signed-off-by: Rafael Rocha <rrochavi@...l.gov>
> 
The patch changes the semantics of flush_buffer() slightly. Obviously, nothing should
be flushed if position is unknown, but the return code changes when the drive is not
ready. This changes the path the code takes after reset if the drive is not ready.
I looked at the code and this should not cause problems. So:

Acked-by: Kai Mäkisara <kai.makisara@...umbus.fi <mailto:kai.makisara@...umbus.fi>>

As an sdded note: when looking at the code, another possibility might be to not
set pos_unknown if (STp->ready != ST_READY), But if your simple change is
enough, it is wise not to make more complex changes.

Thanks,
Kai


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ