]> git.ipfire.org Git - thirdparty/mdadm.git/commit
mdadm: Follow POSIX Portable Character Set
authorMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Thu, 1 Jun 2023 07:27:50 +0000 (09:27 +0200)
committerJes Sorensen <jes@trained-monkey.org>
Thu, 26 Oct 2023 21:28:23 +0000 (17:28 -0400)
commite2eb503bd797908f515b58428b274f1ba6a05349
tree88ef87abb98fe35d6e111b332536423aab7592d2
parentae5f13a971bc309e0e25087421119b86daf2e510
mdadm: Follow POSIX Portable Character Set

When the user creates a device with a name that contains whitespace,
mdadm timeouts and throws an error. This issue is caused by udev, which
truncates /dev/md link until the first whitespace.

This patch introduces prohibition of characters other than A-Za-z0-9.-_
in the device name. Also, it prohibits using leading "-" in device name,
so name won't be confused with cli parameter.
Set of allowed characters is taken from POSIX 3.280 Portable Character
Set. Also, device name length now is limited to NAME_MAX.

In some places, there are other requirements for string length (e.g. size
up to MD_NAME_MAX for device name). This routine is made to follow POSIX
and other, more strict limitations should be checked separately.
We are aware of the risk of regression in exceptional cases (as
escape_devname function is removed) that should be fixed by updating
the array name.

The POSIX validation is added for:
- 'name' parameter in every mode.
- first devlist entry, for Build, Create, Assemble, Manage, Grow.
- config entries, both devname and "name=".

Additionally, some manual cleanups are made.

Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
Detail.c
config.c
lib.c
mdadm.8.in
mdadm.conf.5.in
mdadm.h
super-intel.c
tests/00confnames