tools/xenstore: rework path length check
authorJuergen Gross <jgross@suse.com>
Tue, 15 Dec 2020 15:04:11 +0000 (16:04 +0100)
committerWei Liu <wl@xen.org>
Tue, 15 Dec 2020 15:55:38 +0000 (15:55 +0000)
commit924bf8c793cb1fee303c83f50632c68426cf8f12
tree9149e33b6aab677b09f0540d2586a0e22ffa5861
parentc6dc730e52abfba9cea4ccbfead1c494707bca57
tools/xenstore: rework path length check

The different fixed limits for absolute and relative path lengths of
Xenstore nodes make it possible to create per-domain nodes via
absolute paths which are not accessible using relative paths, as the
two limits differ by 1024 characters.

Instead of this weird limits use only one limit, which applies to the
relative path length of per-domain nodes and to the absolute path
length of all other nodes. This means, the path length check is
applied to the path after removing a possible start of
"/local/domain/<n>/" with <n> being a domain id.

There has been the request to be able to limit the path lengths even
more, so an additional quota is added which can be applied to path
lengths. It is XENSTORE_REL_PATH_MAX (2048) per default, but can be
set to lower values. This is done via the new "-M" or "--path-max"
option when invoking xenstored.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Paul Durrant <paul@xen.org>
Acked-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wl@xen.org>
tools/xenstore/xenstored_core.c