[PATCH 1/4] livepatch-build: allow patch file name sizes up to 127 characters

Roger Pau Monne posted 4 patches 12 months ago
[PATCH 1/4] livepatch-build: allow patch file name sizes up to 127 characters
Posted by Roger Pau Monne 12 months ago
XenServer uses quite long Xen version names, and encode such in the livepatch
filename, and it's currently running out of space in the file name.

Bump max filename size to 127, so it also matches the patch name length in the
hypervisor interface.  Note the size of the buffer is 128 characters, and the
last one is reserved for the null terminator.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Changes since v1:
 - Take into account the null terminator.
---
 livepatch-build | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/livepatch-build b/livepatch-build
index 948b2acfc2f6..f3ca9399d149 100755
--- a/livepatch-build
+++ b/livepatch-build
@@ -72,8 +72,9 @@ function make_patch_name()
     fi
 
     # Only allow alphanumerics and '_' and '-' in the patch name.  Everything
-    # else is replaced with '-'.  Truncate to 48 chars.
-    echo ${PATCHNAME//[^a-zA-Z0-9_-]/-} |cut -c 1-48
+    # else is replaced with '-'.  Truncate to 127 chars
+    # (XEN_LIVEPATCH_NAME_SIZE - 1).
+    echo ${PATCHNAME//[^a-zA-Z0-9_-]/-} |cut -c -127
 }
 
 # Do a full normal build
-- 
2.46.0


Re: [PATCH 1/4] livepatch-build: allow patch file name sizes up to 127 characters
Posted by Ross Lagerwall 9 months, 2 weeks ago
On Thu, Nov 7, 2024 at 3:15 PM Roger Pau Monne <roger.pau@citrix.com> wrote:
>
> XenServer uses quite long Xen version names, and encode such in the livepatch
> filename, and it's currently running out of space in the file name.
>
> Bump max filename size to 127, so it also matches the patch name length in the
> hypervisor interface.  Note the size of the buffer is 128 characters, and the
> last one is reserved for the null terminator.
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
> Changes since v1:
>  - Take into account the null terminator.
> ---
>  livepatch-build | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/livepatch-build b/livepatch-build
> index 948b2acfc2f6..f3ca9399d149 100755
> --- a/livepatch-build
> +++ b/livepatch-build
> @@ -72,8 +72,9 @@ function make_patch_name()
>      fi
>
>      # Only allow alphanumerics and '_' and '-' in the patch name.  Everything
> -    # else is replaced with '-'.  Truncate to 48 chars.
> -    echo ${PATCHNAME//[^a-zA-Z0-9_-]/-} |cut -c 1-48
> +    # else is replaced with '-'.  Truncate to 127 chars
> +    # (XEN_LIVEPATCH_NAME_SIZE - 1).
> +    echo ${PATCHNAME//[^a-zA-Z0-9_-]/-} |cut -c -127
>  }

I think this 48 char limit erroneously came from kpatch / Linux's module
name length limit and is therefore not relevant.

Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>

Thanks