Skip to content

asm: add .WithMetadata() for conveniently replacing individual Instructions#832

Merged
ti-mo merged 1 commit intocilium:masterfrom
ti-mo:tb/instruction-with-metadata
Nov 2, 2022
Merged

asm: add .WithMetadata() for conveniently replacing individual Instructions#832
ti-mo merged 1 commit intocilium:masterfrom
ti-mo:tb/instruction-with-metadata

Conversation

@ti-mo
Copy link
Contributor

@ti-mo ti-mo commented Oct 31, 2022

When replacing an Instruction in an Instructions parsed from an ELF, preserving Metadata is important, so this patch adds a convenient method for in-line assignment of Metadata from other instructions.

With func_info and line_info marshaling being driven by Metadata, accidentally stripping a func_info from the first Instruction will result in the following verifier error:

invalid argument: missing bpf_line_info for func#0

The verifier rejects line_infos for subprogs that don't start with a func_info.

cc @rgo3

…ctions

When replacing an Instruction in an Instructions parsed from an ELF, preserving
Metadata is important, so this patch adds a convenient method for in-line
assignment of Metadata from other instructions.

With func_info and line_info marshaling being driven by Metadata, accidentally
stripping a func_info from the first Instruction will result in the following
verifier error:

`invalid argument: missing bpf_line_info for func#0`

The verifier rejects line_infos for subprogs that don't start with a func_info.

Signed-off-by: Timo Beckers <timo@isovalent.com>
@ti-mo ti-mo requested a review from lmb October 31, 2022 10:54
@ti-mo ti-mo force-pushed the tb/instruction-with-metadata branch from ac04dc8 to d0349fe Compare October 31, 2022 20:35
Copy link
Contributor

@florianl florianl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great idea 👍 works fine here :)

@ti-mo ti-mo merged commit 740adb6 into cilium:master Nov 2, 2022
@ti-mo ti-mo deleted the tb/instruction-with-metadata branch November 2, 2022 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants