<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/block/partitions/efi.c, branch linux-6.14.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.14.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.14.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2025-03-05T14:40:24Z</updated>
<entry>
<title>block: fix conversion of GPT partition name to 7-bit</title>
<updated>2025-03-05T14:40:24Z</updated>
<author>
<name>Olivier Gayot</name>
</author>
<published>2025-03-05T02:21:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e06472bab2a5393430cc2fbc3211cd3602422c1e'/>
<id>urn:sha1:e06472bab2a5393430cc2fbc3211cd3602422c1e</id>
<content type='text'>
The utf16_le_to_7bit function claims to, naively, convert a UTF-16
string to a 7-bit ASCII string. By naively, we mean that it:
 * drops the first byte of every character in the original UTF-16 string
 * checks if all characters are printable, and otherwise replaces them
   by exclamation mark "!".

This means that theoretically, all characters outside the 7-bit ASCII
range should be replaced by another character. Examples:

 * lower-case alpha (ɒ) 0x0252 becomes 0x52 (R)
 * ligature OE (œ) 0x0153 becomes 0x53 (S)
 * hangul letter pieup (ㅂ) 0x3142 becomes 0x42 (B)
 * upper-case gamma (Ɣ) 0x0194 becomes 0x94 (not printable) so gets
   replaced by "!"

The result of this conversion for the GPT partition name is passed to
user-space as PARTNAME via udev, which is confusing and feels questionable.

However, there is a flaw in the conversion function itself. By dropping
one byte of each character and using isprint() to check if the remaining
byte corresponds to a printable character, we do not actually guarantee
that the resulting character is 7-bit ASCII.

This happens because we pass 8-bit characters to isprint(), which
in the kernel returns 1 for many values &gt; 0x7f - as defined in ctype.c.

This results in many values which should be replaced by "!" to be kept
as-is, despite not being valid 7-bit ASCII. Examples:

 * e with acute accent (é) 0x00E9 becomes 0xE9 - kept as-is because
   isprint(0xE9) returns 1.
 * euro sign (€) 0x20AC becomes 0xAC - kept as-is because isprint(0xAC)
   returns 1.

This way has broken pyudev utility[1], fixes it by using a mask of 7 bits
instead of 8 bits before calling isprint.

Link: https://github.com/pyudev/pyudev/issues/490#issuecomment-2685794648 [1]
Link: https://lore.kernel.org/linux-block/4cac90c2-e414-4ebb-ae62-2a4589d9dc6e@canonical.com/
Cc: Mulhern &lt;amulhern@redhat.com&gt;
Cc: Davidlohr Bueso &lt;dave@stgolabs.net&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Olivier Gayot &lt;olivier.gayot@canonical.com&gt;
Signed-off-by: Ming Lei &lt;ming.lei@redhat.com&gt;
Link: https://lore.kernel.org/r/20250305022154.3903128-1-ming.lei@redhat.com
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>partitions/efi: use bdev_nr_bytes instead of open coding it</title>
<updated>2021-10-19T12:16:50Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2021-10-19T06:20:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f9831b885709978ed9d16833ceeb3a2ec174a2d2'/>
<id>urn:sha1:f9831b885709978ed9d16833ceeb3a2ec174a2d2</id>
<content type='text'>
Use the proper helper to read the block device size.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Link: https://lore.kernel.org/r/20211019062024.2171074-3-hch@lst.de
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>partitions/efi: Support non-standard GPT location</title>
<updated>2021-08-24T16:09:06Z</updated>
<author>
<name>Dmitry Osipenko</name>
</author>
<published>2021-08-20T00:45:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=466d9c4904deb25e2e8dcd29d3a998f4e3fa7c17'/>
<id>urn:sha1:466d9c4904deb25e2e8dcd29d3a998f4e3fa7c17</id>
<content type='text'>
Support looking up GPT at a non-standard location specified by a block
device driver.

Acked-by: Davidlohr Bueso &lt;dbueso@suse.de&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Dmitry Osipenko &lt;digetx@gmail.com&gt;
Reviewed-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Link: https://lore.kernel.org/r/20210820004536.15791-3-digetx@gmail.com
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: store a gendisk in struct parsed_partitions</title>
<updated>2021-08-12T16:31:35Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2021-08-10T15:45:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a08aa9bccdc282b5e8d133bf8c239473f057b464'/>
<id>urn:sha1:a08aa9bccdc282b5e8d133bf8c239473f057b464</id>
<content type='text'>
Partition scanning only happens on the whole device, so pass a
struct gendisk instead of the whole device block_device to the scanners.
This allows to simplify printing the device name in various places as the
disk name is available in disk-&gt;name.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Stefan Haberland &lt;sth@linux.ibm.com&gt;
Link: https://lore.kernel.org/r/20210810154512.1809898-2-hch@lst.de
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block/partitions/efi.c: Fix the efi_partition() kernel-doc header</title>
<updated>2021-05-14T15:00:06Z</updated>
<author>
<name>Bart Van Assche</name>
</author>
<published>2021-05-13T17:17:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4bc2082311311892742deb2ce04bc335f85ee27a'/>
<id>urn:sha1:4bc2082311311892742deb2ce04bc335f85ee27a</id>
<content type='text'>
Fix the following kernel-doc warning:

block/partitions/efi.c:685: warning: wrong kernel-doc identifier on line:
 * efi_partition(struct parsed_partitions *state)

Cc: Alexander Viro &lt;viro@math.psu.edu&gt;
Signed-off-by: Bart Van Assche &lt;bvanassche@acm.org&gt;
Link: https://lore.kernel.org/r/20210513171708.8391-1-bvanassche@acm.org
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>partitions/efi: Fix partition name parsing in GUID partition entry</title>
<updated>2020-03-08T09:00:09Z</updated>
<author>
<name>Nikolai Merinov</name>
</author>
<published>2020-03-08T08:08:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d5528d5e91041e68e8eab9792ce627705a0ed273'/>
<id>urn:sha1:d5528d5e91041e68e8eab9792ce627705a0ed273</id>
<content type='text'>
GUID partition entry defined to have a partition name as 36 UTF-16LE
code units. This means that on big-endian platforms ASCII symbols
would be read with 0xXX00 efi_char16_t character code. In order to
correctly extract ASCII characters from a partition name field we
should be converted from 16LE to CPU architecture.

The problem exists on all big endian platforms.

[ mingo: Minor edits. ]

Fixes: eec7ecfede74 ("genhd, efi: add efi partition metadata to hd_structs")
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Nikolai Merinov &lt;n.merinov@inango-systems.com&gt;
Signed-off-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Link: https://lore.kernel.org/r/20200308080859.21568-29-ardb@kernel.org
Link: https://lore.kernel.org/r/797777312.1324734.1582544319435.JavaMail.zimbra@inango-systems.com/
</content>
</entry>
<entry>
<title>block: switch all files cleared marked as GPLv2 or later to SPDX tags</title>
<updated>2019-04-30T22:11:59Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2019-04-30T18:42:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a497ee34a45d58e9b978d0fa5c4b25d4813eb350'/>
<id>urn:sha1:a497ee34a45d58e9b978d0fa5c4b25d4813eb350</id>
<content type='text'>
All these files have some form of the usual GPLv2 or later boilerplate.
Switch them to use SPDX tags instead.

Reviewed-by: Chaitanya Kulkarni &lt;chaitanya.kulkarni@wdc.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>partitions/efi: Fix integer overflow in GPT size calculation</title>
<updated>2017-01-17T16:02:31Z</updated>
<author>
<name>Alden Tondettar</name>
</author>
<published>2017-01-15T22:31:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c5082b70adfe8e1ea1cf4a8eff92c9f260e364d2'/>
<id>urn:sha1:c5082b70adfe8e1ea1cf4a8eff92c9f260e364d2</id>
<content type='text'>
If a GUID Partition Table claims to have more than 2**25 entries, the
calculation of the partition table size in alloc_read_gpt_entries() will
overflow a 32-bit integer and not enough space will be allocated for the
table.

Nothing seems to get written out of bounds, but later efi_partition() will
read up to 32768 bytes from a 128 byte buffer, possibly OOPSing or exposing
information to /proc/partitions and uevents.

The problem exists on both 64-bit and 32-bit platforms.

Fix the overflow and also print a meaningful debug message if the table
size is too large.

Signed-off-by: Alden Tondettar &lt;alden.tondettar@gmail.com&gt;
Acked-by: Ard Biesheuvel &lt;ard.biesheuvel@linaro.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
</content>
</entry>
<entry>
<title>treewide: Fix typos in printk</title>
<updated>2016-04-18T09:23:24Z</updated>
<author>
<name>Masanari Iida</name>
</author>
<published>2016-02-08T11:53:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c19ca6cb4c0891049009d48a0da79d9e8c475462'/>
<id>urn:sha1:c19ca6cb4c0891049009d48a0da79d9e8c475462</id>
<content type='text'>
This patch fix spelling typos found in printk
within various part of the kernel sources.

Signed-off-by: Masanari Iida &lt;standby24x7@gmail.com&gt;
Acked-by: Randy Dunlap &lt;rdunlap@infradead.org&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
</entry>
<entry>
<title>efi: Rename efi_guid_unparse to efi_guid_to_str</title>
<updated>2015-01-08T03:07:44Z</updated>
<author>
<name>Borislav Petkov</name>
</author>
<published>2014-12-18T15:02:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=26e022727f5e88c6e5054e14d954425deacbe56a'/>
<id>urn:sha1:26e022727f5e88c6e5054e14d954425deacbe56a</id>
<content type='text'>
Call it what it does - "unparse" is plain-misleading.

Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Signed-off-by: Ricardo Neri &lt;ricardo.neri-calderon@linux.intel.com&gt;
</content>
</entry>
</feed>
