[PATCH 2/4] create-diff-object: update default alt_instr size

Roger Pau Monne posted 4 patches 12 months ago
[PATCH 2/4] create-diff-object: update default alt_instr size
Posted by Roger Pau Monne 12 months ago
The size of the alt_instr structure in Xen is 14 instead of 12 bytes, adjust
it.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 create-diff-object.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/create-diff-object.c b/create-diff-object.c
index fed360a9aa68..d8a2afbf2774 100644
--- a/create-diff-object.c
+++ b/create-diff-object.c
@@ -1000,7 +1000,7 @@ static int altinstructions_group_size(struct kpatch_elf *kelf, int offset)
 	char *str;
 	if (!size) {
 		str = getenv("ALT_STRUCT_SIZE");
-		size = str ? atoi(str) : 12;
+		size = str ? atoi(str) : 14;
 	}
 
 	log_debug("altinstr_size=%d\n", size);
-- 
2.46.0


Re: [PATCH 2/4] create-diff-object: update default alt_instr size
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:
>
> The size of the alt_instr structure in Xen is 14 instead of 12 bytes, adjust
> it.
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
>  create-diff-object.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/create-diff-object.c b/create-diff-object.c
> index fed360a9aa68..d8a2afbf2774 100644
> --- a/create-diff-object.c
> +++ b/create-diff-object.c
> @@ -1000,7 +1000,7 @@ static int altinstructions_group_size(struct kpatch_elf *kelf, int offset)
>         char *str;
>         if (!size) {
>                 str = getenv("ALT_STRUCT_SIZE");
> -               size = str ? atoi(str) : 12;
> +               size = str ? atoi(str) : 14;
>         }
>
>         log_debug("altinstr_size=%d\n", size);
> --
> 2.46.0
>

Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Re: [PATCH 2/4] create-diff-object: update default alt_instr size
Posted by Jan Beulich 12 months ago
On 07.11.2024 16:15, Roger Pau Monne wrote:
> The size of the alt_instr structure in Xen is 14 instead of 12 bytes, adjust
> it.

Nowadays yes. Isn't the tool supposed to be usable with all livepatch-capable
Xen versions, though? As a random data point, 4.7 still had the size at 12.

Jan
Re: [PATCH 2/4] create-diff-object: update default alt_instr size
Posted by Roger Pau Monné 12 months ago
On Thu, Nov 07, 2024 at 04:20:35PM +0100, Jan Beulich wrote:
> On 07.11.2024 16:15, Roger Pau Monne wrote:
> > The size of the alt_instr structure in Xen is 14 instead of 12 bytes, adjust
> > it.
> 
> Nowadays yes. Isn't the tool supposed to be usable with all livepatch-capable
> Xen versions, though? As a random data point, 4.7 still had the size at 12.

Yes, livepatch-build-tools will fetch the alt_intsrt size from the
DWARF info.

However when using create-diff-object without the env variable being
set a default value is used, and that's currently 12.  I think it
would be best to update that default to the value used by the current
Xen version.

Thanks, Roger.
Re: [PATCH 2/4] create-diff-object: update default alt_instr size
Posted by Jan Beulich 12 months ago
On 07.11.2024 16:55, Roger Pau Monné wrote:
> On Thu, Nov 07, 2024 at 04:20:35PM +0100, Jan Beulich wrote:
>> On 07.11.2024 16:15, Roger Pau Monne wrote:
>>> The size of the alt_instr structure in Xen is 14 instead of 12 bytes, adjust
>>> it.
>>
>> Nowadays yes. Isn't the tool supposed to be usable with all livepatch-capable
>> Xen versions, though? As a random data point, 4.7 still had the size at 12.
> 
> Yes, livepatch-build-tools will fetch the alt_intsrt size from the
> DWARF info.
> 
> However when using create-diff-object without the env variable being
> set a default value is used, and that's currently 12.  I think it
> would be best to update that default to the value used by the current
> Xen version.

Oh, I see. Makes sense of course.

Jan