-
Notifications
You must be signed in to change notification settings - Fork 35
Feature - Adjustments of SIMD-0189 #92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
f72af30 to
f8a44d5
Compare
src/elf.rs
Outdated
| || program_header.p_paddr != *p_vaddr | ||
| || program_header.p_filesz != p_filesz | ||
| || program_header.p_vaddr != p_vaddr | ||
| || program_header.p_paddr != p_vaddr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this relevant for us? p_addr is the physical address, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not change anything about p_addr in this PR, just removed the deref.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just wondering if we shouldn't disregard this field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless there is tooling which likes to emit this value differently I would say we pin as much as we can.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there is any problem there. Those fields are controlled by the linker script. If they are working now, they will continue working with the new layout, I believe.
| . = ALIGN(8); | ||
| } :rodata | ||
| .text 0x100000000 : { | ||
| *(.text*) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to do it here, but if you want, you can remove the .bss.stack and .bss.heap from the linker script.
tests/execution.rs
Outdated
| (), | ||
| TestContextObject::new(3), | ||
| ProgramResult::Ok(ebpf::MM_BYTECODE_START), | ||
| ProgramResult::Ok(ebpf::MM_RODATA_START), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The address of the entrypoint is MM_BYTECODE_START, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jup, see answer for the other test.
tests/execution.rs
Outdated
| TestContextObject::new(4), | ||
| ProgramResult::Ok(ebpf::MM_RODATA_START), | ||
| TestContextObject::new(3), | ||
| ProgramResult::Ok(ebpf::MM_BYTECODE_START), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these tests are returning the inverted addresses, aren't they?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is because I did not change the constants naming in this PR. And that again has to do with the AlignedMemory mapping rejecting a region at address 0. We can fix that once we enable account data direct mapping any only use the UnalignedMemory mapping in production.
If you want I can put the numeric values here to avoid confusion in the meantime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make tests comprehensive, you could just compare with the number itself and add a comment next to it explaining what section that number refers to in the v3 organization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rebased the PR ontop of the changes which allow us to now swap / rename these two constants.
f8a44d5 to
526b717
Compare
src/elf.rs
Outdated
| text_section_vaddr: if sbpf_version.enable_lower_bytecode_vaddr() { | ||
| ebpf::MM_BYTECODE_START | ||
| } else { | ||
| ro_section: Section::Borrowed(ebpf::MM_BYTECODE_START as usize, 0..text_bytes.len()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be MM_RODATA_START for v3?
src/elf.rs
Outdated
| text_section_vaddr: if sbpf_version.enable_lower_rodata_vaddr() { | ||
| ebpf::MM_RODATA_START | ||
| } else { | ||
| ebpf::MM_BYTECODE_START |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, enable_lower_rodata_vaddr returns true for a version greater than v3, but you are saying that the text section vaddr is MM_RODATA_START. Shouldn't this if be inverted?
e277dab to
a898615
Compare
a898615 to
8e313a0
Compare
| let region_name = match vm_addr & (!ebpf::MM_BYTECODE_START.saturating_sub(1)) { | ||
| ebpf::MM_BYTECODE_START => "program", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we include another match arm in here for ebpf::MM_RODATA_START?
We could treat both as "program", like we do in < SBPF v3, or we could have "bytecode" and "rodata" messages. Seems probably useful to distinguish between the two, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We didn't merge that PR yet, because we have not yet finalized the ABIv2 design.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah okay, thanks. Does it hurt to add the "rodata" arm here though?
| if program_header.p_type != PT_LOAD | ||
| || program_header.p_flags != *p_flags | ||
| || program_header.p_offset < program_header_table_range.end as u64 | ||
| || program_header.p_offset != expected_offset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This restriction is not guaranteed to work. I tested it here and LLD does not output it automatically. In one of the cases, I could only get it once I called llvm-objcopy --strip-all. I suggest reverting it to the original restriction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
llvm-objcopy --strip-all does not work with enable_symbol_and_section_labels set to true.
e_machinetoEM_BPFe_type