Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS#2768 - make_ext4fs: Name-Based UUID leads to collision #7571

Open
openwrt-bot opened this issue Jan 24, 2020 · 3 comments
Open

FS#2768 - make_ext4fs: Name-Based UUID leads to collision #7571

openwrt-bot opened this issue Jan 24, 2020 · 3 comments
Labels
flyspray toolchain pull request/issue with toolchain related changes

Comments

@openwrt-bot
Copy link

mgaube:

make_ext4fs uses name-based uuid generation (see https://tools.ietf.org/html/rfc4122#section-4.3).

Therefore, as the uuid generation does only depend on the Filesystem Label and an hardcoded namespace, the UUID is exactly identical for multiple different filesystems with the same label (see https://git.openwrt.org/?p=project/make_ext4fs.git;a=blob;f=ext4_utils.c;h=1a886d7e86262d35e30d894f821ca91d32384e96;hb=HEAD#l224).

This can lead to problems like the inability to mount an filesystem by UUID.
In my constellation, I have an MMC Storage and an external SD-Card, both flashed with filesystems generated by make_ext4fs. They both have the same UUID, therefore it's impossible to distinguish/mount them by UUID.

My suggestion would be to replace "info.label" as parameter for "generate_uuid" trough another, better suited value, e.g. an hash of the make_ext4fs directory content. Maybe it should be considered to switch to an Random Number-based UUID (https://tools.ietf.org/html/rfc4122#section-4.4)?

Affected Devices/Targets: All toolchains that use make_ext4fs
Revision: make-ext4fs-2020-01-05-5c201be7

@openwrt-bot
Copy link
Author

jow-:

In the interest of reproducible builds we don't actually want random filesystem UUIDs in produced artifacts. I think if you really want to be sure to have random IDs on your filesystem images, you need to first write them to the storage, then use tools like tune2fs to change them accordingly.

@openwrt-bot
Copy link
Author

mgaube:

To archive repoducible builds, it would be probably better to replace the info.label in
generate_uuid("extandroid/make_ext4fs", info.label, sb->s_uuid); trough an hashed Version of the filesystem contents?

I don't actually think it's a good practice to have the same, "default" uuid for different filesystem contents.

In other words: Wouldn't it be better if the UUID depends on the Filesystem content, and not only on the filesystem label?

@openwrt-bot
Copy link
Author

jow-:

Yes, hashing the contents is good idea. Would you be able to send a patch for it?

@aparcar aparcar added the toolchain pull request/issue with toolchain related changes label Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray toolchain pull request/issue with toolchain related changes
Projects
None yet
Development

No branches or pull requests

2 participants