Punch2027: Jigawa ADC gov candidate urges Nigerians to resist election riggingThe Jerusalem PostOnly 30% of Americans see Israel as a US ally, Huckabee blames ‘propaganda’Inquirer Entertainment29th French Film Festival in Manila spotlights book-to-film worksInquirerMarcos to Congress: Work through Christmas to finish 2027 budget on timeCNN TürkJP Morgan’dan altın için yeni tahmin! 2027'de ne olacak?Rai NewsBallando con le Stelle, la vittoria di Bocchi-Pernice e lo sfogo di Ravagnani: "Dopo cosa farò?"Би-би-сиЗемлетрясение в Лос-Анджелесе: никто не пострадал, но разбилось вино на десятки тысяч долларов, в аэропорту не смог сесть самолетynetהרצוג ליועמ"שית ולנתניהו: בואו להידברות תחת בית הנשיאVanguardPolice to prosecute woman over attempted suicide in AbujaInteriaRosjanie uderzyli bombami szybującymi. Są zabici i ranniObservador DesportoAs notícias das 6hسكاي نيوز عربيةمضيق هرمز.. إيران تعلن تعرض قارب صيد لضربة أميركية
The Daily Newsstand · Free, Always
Sunday, November 29, 2026

You are reading Joho no Todai on KioskNews: newspapers from many countries on one stand, each linked to its original. What other papers report

Linux SCSI Discards Can Report Success While Erasing Data in the Wrong Region

Translate

On November 28, Chris Down posted a second revision of five fixes for the Linux kernel's SCSI disk driver.

Down used scsi_debug, which emulates a SCSI device, to reproduce the failure. The discard request reported success, but the test found that data at the start of the disk had been discarded instead of the requested region.

The driver truncated information while converting a request into WRITE SAME(10). SCSI identifies positions on disk with logical block addresses (LBAs). WRITE SAME(10) writes the same contents to a specified range of blocks and can also request UNMAP, or logical block deallocation, on devices that support it. The sg3_utils manual describes the command.

WRITE SAME(10) uses a 32-bit starting address. When an address exceeds the field's range and the driver discards the high bits, the resulting address can point to a different part of the disk.

The caller sees a successful result. That response gives no indication that anything went wrong, even if the driver discarded data it was supposed to preserve.

Truncating the block count can also defeat zeroing

The command specifies a block count as well as a starting address. In WRITE SAME(10), the block count occupies a 16-bit field.

Down also reported a problem with zeroing. In the test, truncating an oversized block count left the target region unchanged.

Linux SCSI: truncation in WRITE SAME(10)

MeasureStarting addressBlock count
OperationDiscardZeroing
Field width32 bits16 bits
Test conditionsSimulated disk
Logical block sizeStandard disk configuration
Large requestlimit
RequestDiscard outside address rangeZeroing beyond block count range
After conversionWrong starting addressTruncated block count
ResultReported success
Data at start of disk discarded
Target region unchanged

An incorrect starting address can affect the wrong location. An incorrect block count can leave the requested region untouched. Both failures arise when the driver loses information while converting a request into a command.

From checking each request to checking the entire disk

In the first revision, posted November 8, Down proposed that when an address or block count did not fit in WRITE SAME(10), the driver should switch zeroing requests to WRITE SAME(16) and reject discards.

Linux SCSI: WRITE SAME(10) patch proposal v2

MeasureProposed changes in v2Concerns with v2
Affected modesDiscard: writesame_10 and writesame_zero
Zeroing: writesame_10_unmap
Mode selectionOnly when all blocks are
addressable in 32 bits
Race with capacity or limit changes
Capacity mismatch with removable media
Request limitsAdjust the zeroing limit
Reset discard-related limits
in non-discard modes
Failed update leaves old limits
Mode changesFreeze the queue firstZeroing mode setup lacks
queue freezing and locking
Capacity changesGrowth: change mode first
Shrinkage: update capacity first
Previously checked requests
and requests to existing partitions
may still refer to old ranges
DiscardHardware limit (nonzero)
Disable if below discard granularity
Also consider the user limit
Further proposalCheck address and block count when constructing the command

Following a suggestion from Christoph Hellwig, the second revision picks the mode based on disk capacity. It uses the affected WRITE SAME(10) mode only if the entire disk can be addressed in 32 bits.

The series would avoid selecting writesame_10_unmap, which zeroes blocks through deallocation, for disks too large to address in 32 bits. Plain WRITE SAME without UNMAP can use WRITE SAME(16) where needed. The proposal would disable discard on large disks that support it only through WRITE SAME(10).

The proposed changes go beyond choosing a command. They adjust request size limits for the active mode and reset discard-related limits when switching to a zeroing mode that does not deallocate blocks.

Queued requests may reflect old limits, so the proposal freezes the queue before changing modes. When capacity grows, it switches modes before publishing the new capacity. When capacity shrinks, it updates the capacity first. It also disables discard if the discard granularity exceeds a nonzero hardware request limit, since the block layer can otherwise fail to split requests.

The proposed changes add 66 lines and remove nine in drivers/scsi/sd.c. The series is marked for backporting to stable kernels.

Protecting the target range during capacity changes

On November 29, Bart Van Assche raised several concerns about the second revision.

Van Assche said the path for setting the zeroing mode lacked queue freezing and locking for updates to request limits. If disk capacity or limits change between a check and the mode update, the selected mode may no longer be valid. For removable media, the driver may also check capacity while its internal value differs from the one published to the system.

If updating the limits fails, the driver may already have changed modes, leaving the queue with old limits. Van Assche also noted that the effective discard limit is the lower of the hardware limit and the user-configured limit. Comparing discard granularity with the hardware limit alone is insufficient.

Shrinking capacity can also leave requests that passed an earlier capacity check to arrive after the queue is unfrozen. Updating disk capacity does not resize existing partitions, so requests can continue to refer to the previous range.

Van Assche proposed checking the address and block count bounds in WRITE SAME(10) command construction itself, in sd_setup_write_same10_cmnd().

The proposed patches cover configurations using writesame_10 or writesame_zero for discard, or writesame_10_unmap for zeroing. The largest disk that fits within the 32-bit address range also depends on logical block size.

However carefully the driver handles changes in capacity or settings, the final device command can express only a fixed range. Success must mean the requested region was handled correctly. A final bounds check helps preserve that guarantee.

View the original on Joho no Todai →

KioskNews shows a cleaned-up reading view extracted from the publisher’s page — the original always lives on their site, not ours.