Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8229675ybi; Tue, 9 Jul 2019 11:33:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqxOGZGP2dLrTEFLjxpYdLUu8HMHnbZ7H1ESgAVA1IN3oZpzpCA5RFtFqIg5THsAof6azcFP X-Received: by 2002:a17:902:9a04:: with SMTP id v4mr32931406plp.95.1562697228247; Tue, 09 Jul 2019 11:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562697228; cv=none; d=google.com; s=arc-20160816; b=QnJY00pNvufQhFBYHauxFbu9Zt4Min/0gg0x2YCuGYFnYSjIsW2Ug2XqP0i8OddE1x jFKdHK3dznHLfYSMf+cI1t0WyroKN/05dw8aKgLB08pa6oCq+M7dV6EUzm0qMNKpQesZ jxWZwc0oUR+ekK4hw1irVJKJF4PWtfHrPlXzlTUKXUdbCpCJI1FhdEL5h9oc+Tp1Y6Yu s1QjWKwLd+MbNlMqyXtgthIxGuJ1wn6zpxI3F8M8oXEmc4du4D8UxaOCPFoH/dT340Hq JF9Js7fmsuiw1YxMiKR5T3W0h2mY/1Jzo82NZaHK9Yw+dDvUplKqr9kgw5arSxO5HsxC OEOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:mime-version:user-agent:date:message-id :subject:from:cc:to:dkim-signature; bh=Ys1tExUXnGuHx8mMvauSevz/cEht+mA14Kwl4w2Pkgw=; b=dOBG1UkPD7DwOLt8JjKgeDfLnBds/bFJN6biI2Sc5CPPoFrdETjwnk5tXzWMG1NMBB YdFnyX9WAMlTL3YxG9P4saUYO9knon2jE2v2kT1pCdScaqUHthCcr6my2eNiS2/EybCZ DR0hOyeAIMe3d1FZ4nSEjnrEFQrq7MNka7jlaFy//5hMyMZvXi3qIFwosmUF+0575/sU 6qSTWmGf50QwSjkMBQconzNmgvOBRYpk/4XyeMl1rVe9p91Bjcn/MtF8EJXzPB2fCnxW GyMg/DWL1Eud0jpUYtwa+Ra4APerBN3G9M8boF0B+c/bnxbSZVd8WZH0nvgcTQ1ATYPt BFew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@digidescorp.com header.s=google header.b=n7M07cSM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u21si23769753pgn.290.2019.07.09.11.33.32; Tue, 09 Jul 2019 11:33:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@digidescorp.com header.s=google header.b=n7M07cSM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727731AbfGIS2B (ORCPT + 99 others); Tue, 9 Jul 2019 14:28:01 -0400 Received: from mail-io1-f49.google.com ([209.85.166.49]:44829 "EHLO mail-io1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726867AbfGIS2B (ORCPT ); Tue, 9 Jul 2019 14:28:01 -0400 Received: by mail-io1-f49.google.com with SMTP id s7so45245214iob.11 for ; Tue, 09 Jul 2019 11:28:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digidescorp.com; s=google; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=Ys1tExUXnGuHx8mMvauSevz/cEht+mA14Kwl4w2Pkgw=; b=n7M07cSM57J43wmXSptJW0h23FDbdLBNfgOY3GXy8apjXAgyQVk7XoQt5ZaH5j4b2q SR07R21oEchFeZca5/Px2wFoHHW+k4iS8kF/r5RH6I28MZeRu6PwR51nbMWIaSSKW3pS iV5w0eIla2AZrTsdzBcVNfQninRssaQqBg9pg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=Ys1tExUXnGuHx8mMvauSevz/cEht+mA14Kwl4w2Pkgw=; b=l382BoTW/dpps1F93l7roSBwAjmrwAvn26n5IGRERHQNzGBl4Q5RIFeda7Gtn/GzQ8 aRhPfBVqjTqwAiVr5DEyoJXNwd0obuJAm1jb5TBBPAJXO0e9/cXwBgXJYe2Txszao+G8 fsculm+20A2FB6NUAwn3qFEFqPtXkbLVribcGNvcBrYIDFI10fGE0C4x3N0YkGJVxxNm O7htsuBk5fdt94hDmMyOc4IeyG6VoRdXjQACLHjQix1JNEcSvRmHSVcj9hojrZGObZFt cQ4i+5IEH2ETgl4xbeNv4Xte1NXXUZRI0OvSSIwJAq09A8Zq3FU6KmxbfBUpIyV2yiDK inCA== X-Gm-Message-State: APjAAAUH5v+OOvgqYLrG41+ksjlrhMqTsNbpmduhVzxITXtHawZTCQq6 2UnjOWp0nPnyIY0LFU5PnuJmV0Mh1iU= X-Received: by 2002:a5d:8c87:: with SMTP id g7mr27016585ion.85.1562696880133; Tue, 09 Jul 2019 11:28:00 -0700 (PDT) Received: from [10.10.3.1] (104-51-28-62.lightspeed.cicril.sbcglobal.net. [104.51.28.62]) by smtp.googlemail.com with ESMTPSA id j1sm18257487iop.14.2019.07.09.11.27.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jul 2019 11:27:59 -0700 (PDT) To: Jan Kara , =?UTF-8?Q?Pali_Roh=c3=a1r?= Cc: linux-fsdevel@vger.kernel.org, "linux-kernel@vger.kernel.org" From: Steve Magnani Subject: [RFC] udf: 2.01 interoperability issues with Windows 10 Message-ID: <96e1ea00-ac12-015d-5c54-80a83f08b898@digidescorp.com> Date: Tue, 9 Jul 2019 13:27:58 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Recently I have been exploring Advanced Format (4K sector size) and high capacity aspects of UDF 2.01 support in Linux and Windows 10. I thought it might be helpful to summarize my findings. The good news is that I did not see any bugs in the Linux ecosystem (kernel driver + mkudffs). The not-so-good news is that Windows has some issues that affect interoperability. One of my goals in posting this is to open a discussion on whether changes should be made in the Linux UDF ecosystem to accommodate these quirks. My test setup includes the following software components: * mkudffs 1.3 and 2.0 * kernel 4.15.0-43 and 4.15.0-52 * Windows 10 1803 17134.829 * chkdsk 10.0.17134.1 * udfs.sys 10.0.17134.648 ISSUE 1: Inability of the Linux UDF driver to mount 4K-sector media formatted by Windows. This is because the Windows ecosystem mishandles the ECMA-167 corner case that requires Volume Recognition Sequence components to be placed at 4K intervals on 4K-sector media, instead of the 2K intervals required with smaller sectors. The Linux UDF driver emits the following when presented with Windows-formatted media: UDF-fs: warning (device sdc1): udf_load_vrs: No VRS found UDF-fs: Scanning with blocksize 4096 failed A hex dump of the VRS written by the Windows 10 'format' utility yields this: 0000: 00 42 45 41 30 31 01 00 00 00 00 00 00 00 00 00 .BEA01.......... 0800: 00 4e 53 52 30 33 01 00 00 00 00 00 00 00 00 00 .NSR03.......... 1000: 00 54 45 41 30 31 01 00 00 00 00 00 00 00 00 00 .TEA01.......... We may want to consider tweaking the kernel UDF driver to tolerate this quirk; if so a question is whether that should be done automatically, only in response to a mount option or module parameter, or only with some subsequent confirmation that the medium was formatted by Windows. ISSUE 2: Inability of Windows chkdsk to analyze 4K-sector media formatted by mkudffs. This is another aspect of Windows' VRS corner case bug. Formatting by mkudffs places the VRS components at the proper 4K intervals. But the chkdsk utility looks for components at 2K intervals. Not finding a component at byte offset 2048, chkdsk decides that the media is RAW and cannot be checked. Note that this bug affects chkdsk only; udfs.sys *does* recognize mkudffs- formatted 4K-sector media and is able to mount it. It would be possible to work around this by tweaking mkudffs to insert dummy BOOT2 components in between the BEA/NSR/TEA: 0000: 00 42 45 41 30 31 01 00 00 00 00 00 00 00 00 00 .BEA01.......... 0800: 00 42 4f 4f 54 32 01 00 00 00 00 00 00 00 00 00 .BOOT2.......... 1000: 00 4e 53 52 30 33 01 00 00 00 00 00 00 00 00 00 .NSR03.......... 1800: 00 42 4f 4f 54 32 01 00 00 00 00 00 00 00 00 00 .BOOT2.......... 2000: 00 54 45 41 30 31 01 00 00 00 00 00 00 00 00 00 .TEA01.......... That would introduce a slight ECMA-167 nonconformity, but Linux does not object and Windows actually performs better. I would have to tweak udffsck though since I believe this could confuse its automatic detection of medium block size. ISSUE 3: Inability of the Windows UDF driver to mount media read-write when a maximally-sized space bitmap descriptor is present I suspect this is an off-by-one error in udfs.sys relating to the maximum number of blocks a space bitmap descriptor can occupy. The bug causes UDF partitions that are close to 2 TiB (512-sector media) or 16 TiB (4K-sector media) to be mounted read-only, with no user-visible indication as to why. It would be possible for mkudffs to print a warning when formatting results in a space bitmap that occupies the maximum number of blocks. ISSUE 4: chkdsk reports spurious errors when space bitmap descriptor exceeds 32 MiB Some permutations of this: * "Correcting errors in Space Bitmap Descriptor at block 0" (with no prior mention of any errors) * "Space Bitmap Descriptor at block 32 is corrupt or unreadable" This is actually one of the more crippling issues if one values Windows' ability to check and repair UDF errors. A limit of 32 MiB on the space bitmap implies a UDF partition size of at most 137 GB (not GiB) with 512-sector media or at most 1099 GB with 4K-sector media. Again, the most I think we could do is code mkudffs to warn of this possibility. But a message that clearly conveys the issue and what should be done to avoid it could be a little tricky to construct. Obviously the best solution would be for the Windows bugs to get fixed. If anyone reading this can convey these details into the Microsoft silo, that would be great. Regards, ------------------------------------------------------------------------ Steven J. Magnani "I claim this network for MARS! www.digidescorp.com Earthling, return my space modulator!" #include