Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1pZacr-0003ZM-Tk for mharc-grub-devel@gnu.org; Tue, 07 Mar 2023 11:57:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZacp-0003Xf-5A for grub-devel@gnu.org; Tue, 07 Mar 2023 11:57:19 -0500 Received: from mout.gmx.net ([212.227.17.22]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZacj-0001nL-9A for grub-devel@gnu.org; Tue, 07 Mar 2023 11:57:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1678208226; i=scdbackup@gmx.net; bh=zXYIp5Giwbof6xWG3xoBzraQj13xu/ocPHPSjQU3DPE=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=n7Pudcqp8x6skkKu8luPn0mv0lRuOe7AF4FtgUI6S6Rndkn3MO8YAae25uj8jbxRC cXJa6/yHV52VKqcyfGRB2jv2WVUu3T5bAmlAWtPqEeHFDbHebnvvMy0olNgsXp/wWN bXZPtP5SVyTbA2lIRhxvpIt8UDinRjekjUGevRebkX7fXAdxJveRMiWXtHj/RZIkZm vqeVtrbg6Ja3xhFwo/qxiGHgW3rwzx4mcjhPJ3lx3c0NgoEs9iY+3S4mFU7VdiZsDv g6J5xCOOoWo71ZfBbKbe7eHdGg/Nit9TXrWYj729rcFCBx+Sl9e8iW3BjZpt2+meQD A2q9WbuZ//ppg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from ts7.local ([84.179.243.254]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N1wpt-1qb8Wp363l-012Iki; Tue, 07 Mar 2023 17:57:06 +0100 From: Thomas Schmitt To: grub-devel@gnu.org, development@efficientek.com, lidong.chen@oracle.com Cc: Thomas Schmitt Subject: [PATCH 0/2] fs/iso9660: Delay CE hop until end of current SUSP area Date: Tue, 7 Mar 2023 17:56:49 +0100 Message-Id: <20230307165651.733429-1-scdbackup@gmx.net> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:tDa9tp/aDJR0k+lcOb5c4iXFj4X9tX6fRkhKwU+BVuGP/TE9ac/ KiMFll2eKBwWBRTVTaIM2Ou/jr8XdPfx1PT7nK/IXeq5CSEqbT7a+8cVXTp3gCNOsRJLyrF N34X5sLsbDWclnT29qQOVt6IXySTym94gfj7PyMfAgtHtbTVocn/ZZdHipqTd4ujrJey7Il NpUZ6pvyfL/P2PY0OCVBA== UI-OutboundReport: notjunk:1;M01:P0:CHIGVk3kb04=;9kNLPTwq/rnjYeYUq+E9OsbdxZr FkJxj+cl23x4btc0VOzAbkJlnHQgkBkQoPwIh5WFHy6n7tiTeqznpMxd48pm590fjG+tTGE1u N2RoGEFIo5QywB17cmlk/y5R5SaWm3DulwTPozVMCbqd1I9CSyOJ3PFs1O3IS9Rvu7QWs90YR 9IPu+2e9FyMhS4OFUnl+9L5k9U8SVTNX3cYrHey2omT5OBKagp2aVPpOYrOn7AugeYnv+RtV/ W2A6bBYNrmHoBAg15POK38zo9R25sLHyAjPUGlKngwVH7Dr7DH4rj00agpUx1OpORlZTlwfbi QnjcKZYDg5CdLTjUj2YrGZqtBJ6pOSmLfCtMjG7+P0iJEXYpz9PmrZjtjzRY+KGRfPCZBnwn2 7h0WKsckbnsqzfGm0bwKfFHhWHp1/suh9TaEFM6ibbJDAXomV1LWhfybAY3OmQWJgviA+Unzy GX2OhKowUDtVFanOI67yoHKUl+D+3flTq8rdE6r0M1LZj5jXKMc9UB0natriyuNGIsc6z26UW H52XwAPiNujSWJLFopNcCSl/VTtLR0UOcP6vSZ0VUng6lG/gMsRKzF4OtwSqU6Q7AOi8P5Dt7 k5kEzJ1SewfIHZIli+t5e47TBRyq+t9aFowlgJuXiWe8gHV/PtRLakQRG0tHtWpHQhA9E4O/c prSW5/OWD6PuJ3OHgh5P0Jw1NV6lYiKYuHE1Ih/TKuqd22PUnrn6V451hRHuSaClUnXNsAYqd E7aGS4C1TDpxGov+AM1UapcmmlIWvnaDbbIJDlE0xz6ga++SWHlL9C1Dpn0j0BmM4VXsWZg3r OwAjob5jaW2DqA4n9J5RXpg2R7fYWx3PS732CIAaReGT5tPiVAQ5LnUAI81Q+ybUM0jDAiNlS Lpm7LbtaBmBnfxtob278W+6VOxZDR7JVdFLWhLJ4B2kxwrb2m1Om6IIEuEhC+DDZp6iJ1qi+8 rQHVIJ2F0dFsK377Ud40KZub0H4= Received-SPF: pass client-ip=212.227.17.22; envelope-from=scdbackup@gmx.net; helo=mout.gmx.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Mar 2023 16:57:19 -0000 Hi, SUSP 1.12 says: The "CE" System Use Entry indicates a Continuation Area that shall be processed after the current System Use field or Continuation Area is processed. But GRUB rather takes an encountered CE entry as reason to immediately switch reading to the location that is given by the CE entry. This can skip over important information. The usual ISO 9660 producers on GNU/Linux write the CE entry as last entry of System Use field or Continuation Area. So the problem does not show up with their output. Nevertheless, Linux and libisofs obey the specs whereas GRUB does not. As demonstration i crafted a small ISO, where the CE entry comes before the NM entry which tells the Rock Ridge file name "RockRidgeName:x". Linux shows the NM name, nevertheless: $ sudo mount iso9660_early_ce.iso /mnt/iso mount: /mnt/iso: WARNING: source write-protected, mounted read-only. $ ls /mnt/iso RockRidgeName:x $ GRUB does not see the NM entry and thus shows the dull ISO 9660 name (which is actually "ROCKRIDG.;1"): $ ./grub-fstest iso9660_early_ce.iso ls / rockridg $ After the code change of my patch, i get: $ ./grub-fstest iso9660_early_ce.iso ls / RockRidgeName:x $ A new code block in tests/iso9660_test.in verifies that the patched code is in effect: make check TESTS=3Diso9660_test detects the old code state and shows that the new code still has the capability to cope with endless CE loops. =2D-----------------------------------------------------------------------= - How to create an ISO 9660 filesystem where CE is not the last SUSP entry of a file's directory record: # Deliberately chosen names iso=3Diso9660_early_ce.iso # rr_path is longer than 8, mixed-case, with non-ISO-9660 character rr_path=3D/RockRidgeName:x # A dummy file as payload echo x >x # 250 fattr characters to surely exceed the size of a directory record long_string=3D012345678901234567890123456789012345678901234567890123456= 78901234567890123456789012345678901234567890123456789012345678901234567890= 12345678901234567890123456789012345678901234567890123456789012345678901234= 567890123456789012345678901234567890123456789 # Create ISO with the payload file and attached fattr named user.dummy = . # Make it small with the most restrictive ISO 9660 file name rules. test -e "$iso" && rm "$iso" xorriso -compliance no_emul_toc:iso_9660_level=3D1 \ -padding 0 \ -outdev "$iso" \ -xattr on \ -map x "$rr_path" \ -setfattr user.dummy "$long_string" "$rr_path" -- # Cut out the NM field and the CE field from the directory record # of $rr_path. The numbers were determined by looking at a hex dump. dd if=3D"$iso" bs=3D1 skip=3D37198 count=3D20 of=3Dnm_field dd if=3D"$iso" bs=3D1 skip=3D37218 count=3D28 of=3Dce_field # Put them back in reverse sequence dd conv=3Dnotrunc if=3Dce_field bs=3D1 seek=3D37198 of=3D"$iso" dd conv=3Dnotrunc if=3Dnm_field bs=3D1 seek=3D37226 of=3D"$iso" =2D-----------------------------------------------------------------------= - Have a nice day :) Thomas Thomas Schmitt (2): fs/iso9660: Delay CE hop until end of current SUSP area tests: Add test for iso9660 delayed CE hop grub-core/fs/iso9660.c | 84 ++++++++++++++++++---------------- tests/iso9660_early_ce.iso.gz | Bin 0 -> 709 bytes tests/iso9660_test.in | 24 ++++++++++ 3 files changed, 68 insertions(+), 40 deletions(-) create mode 100644 tests/iso9660_early_ce.iso.gz =2D- 2.30.2