X Tutup
The Wayback Machine - https://web.archive.org/web/20201225224544/https://github.com/u-root/u-root/issues/1845
Skip to content
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

kexec segments: align + dedup of strange segments blows up #1845

Open
hugelgupf opened this issue Sep 30, 2020 · 0 comments · May be fixed by #1847
Open

kexec segments: align + dedup of strange segments blows up #1845

hugelgupf opened this issue Sep 30, 2020 · 0 comments · May be fixed by #1847

Comments

@hugelgupf
Copy link
Member

@hugelgupf hugelgupf commented Sep 30, 2020

2020/09/30 07:47:53 virt: 0x7f91c24e9000 + 0x2a0 | phys: 0x1000000 + 0x1000                                                                                                                                             
2020/09/30 07:47:53 virt: 0x7f91c24e92a0 + 0x1b480 | phys: 0x1001000 + 0x1b46f (.text)                                                                                                                                  
2020/09/30 07:47:53 virt: 0x7f91c2504720 + 0x94a0 | phys: 0x101c480 + 0x94a0 (.rodata)                                                                                                                                  
2020/09/30 07:47:53 virt: 0x7f91c250dbc0 + 0x1300 | phys: 0x1025920 + 0x1300 (.data)                                                                                                                                    
2020/09/30 07:47:53 virt: 0x7f91c24e9000 + 0x0 | phys: 0x1026c20 + 0x171bc (.bss)                                                                                                                                       
2020/09/30 07:47:53 virt: 0x7f91c250eec0 + 0x2a0 | phys: 0x103dde0 + 0x298 (.reloc)                                                                                                                                                                                                                                                                                                          
2020/09/30 07:47:53 aligned                                                                                                                                                                                             
2020/09/30 07:47:53 virt: 0x7f91c24e9000 + 0x2a0 | phys: 0x1000000 + 0x1000                                                                                                                                             
2020/09/30 07:47:53 virt: 0x7f91c24e92a0 + 0x1b480 | phys: 0x1001000 + 0x1c000                                                                                                                                          
2020/09/30 07:47:53 virt: 0x7f91c25042a0 + 0x9920 | phys: 0x101c000 + 0xa000                                                                                                                                            
2020/09/30 07:47:53 virt: 0x7f91c250d2a0 + 0x1c20 | phys: 0x1025000 + 0x2000                                                                                                                                            
2020/09/30 07:47:53 virt: 0x7f91c24e83e0 + 0x0 | phys: 0x1026000 + 0x18000                                                                                                                                              
2020/09/30 07:47:53 virt: 0x7f91c250e0e0 + 0x1080 | phys: 0x103d000 + 0x2000                                                                                                                                            
2020/09/30 07:47:53 dedup                                                                                                                                                                                               
2020/09/30 07:47:53 virt: 0x7f91c24e9000 + 0x2a0 | phys: 0x1000000 + 0x1000                                                                                                                                             
2020/09/30 07:47:53 virt: 0xc00025c000 + 0x27a40 | phys: 0x1001000 + 0x3e000

the dedup'd set of segments makes no sense.

hugelgupf added a commit to hugelgupf/u-root that referenced this issue Oct 5, 2020
Previously, it was assumed that all adjacent segments would have
directly adjoining buffers in the virtual space.

Fixes u-root#1845 and aids in EFI kexec.

Signed-off-by: Chris Koch <chrisko@google.com>
hugelgupf added a commit to hugelgupf/u-root that referenced this issue Oct 5, 2020
Previously, it was assumed that all adjacent segments would have
directly adjoining buffers in the virtual space.

Fixes u-root#1845 and aids in EFI kexec.

Signed-off-by: Chris Koch <chrisko@google.com>
@hugelgupf hugelgupf linked a pull request that will close this issue Oct 5, 2020
hugelgupf added a commit to hugelgupf/u-root that referenced this issue Oct 5, 2020
Previously, it was assumed that all adjacent segments would have
directly adjoining buffers in the virtual space.

Fixes u-root#1845 and aids in EFI kexec.

Signed-off-by: Chris Koch <chrisko@google.com>
hugelgupf added a commit to hugelgupf/u-root that referenced this issue Oct 6, 2020
Previously, it was assumed that all adjacent segments would have
directly adjoining buffers in the virtual space.

Merging only worked on segments that were directly adjoining, but not
aligned to page size, and where the image address was in lockstep with
the physical addresses, e.g.

    virt: [0xff1000, 0xff1234] phys: [0x1000, 0x1234]
    virt: [0xff1234, 0xff2000] phys: [0x1234, 0x2000]

However, non-aligned addresses with holes and non-linear continuation
are also valid, e.g. in the case where an image wants to padding with
zeros:

    virt: [0xff1000, 0xff1234] phys: [0x1000, 0x1234]
    virt: [0xff1234, 0xff2234] phys: [0x2000, 0x2234]

Also, holes in the image that are not linear with the physical address
space are valid:

    virt: [0xff1000, 0xff1234] phys: [0x1000, 0x1234]
    virt: [0xff1e00, 0xff2000] phys: [0x1aaa, 0x1caa]

Aligning would make all these physical ranges overlap, and it was
assumed that `append(section1Buf, section2Buf)` would be an accurate
merging of these segments. This only worked in some small set of cases,
which ESXi's `b.b00` and our test multibooot kernel happened to fit.

Fixes u-root#1845 and aids in EFI kexec.

Signed-off-by: Chris Koch <chrisko@google.com>
hugelgupf added a commit to hugelgupf/u-root that referenced this issue Oct 6, 2020
Previously, it was assumed that all adjacent segments would have
directly adjoining buffers in the virtual space.

Merging only worked on segments that were directly adjoining, but not
aligned to page size, and where the image address was in lockstep with
the physical addresses, e.g.

    userspace: [0xff1000, 0xff1234] phys: [0x1000, 0x1234]
    userspace: [0xff1234, 0xff2000] phys: [0x1234, 0x2000]

However, non-aligned addresses with holes and non-linear continuation
are also valid, e.g. in the case where an image wants to padding with
zeros:

    userspace: [0xff1000, 0xff1234] phys: [0x1000, 0x1234]
    userspace: [0xff1234, 0xff2234] phys: [0x2000, 0x2234]

Also, holes in the image that are not linear with the physical address
space are valid:

    userspace: [0xff1000, 0xff1234] phys: [0x1000, 0x1234]
    userspace: [0xff1e00, 0xff2000] phys: [0x1aaa, 0x1caa]

Aligning would make all these physical ranges overlap, and it was
assumed that `append(section1Buf, section2Buf)` would be an accurate
merging of these segments. This only worked in some small set of cases,
which ESXi's `b.b00` and our test multibooot kernel happened to fit.

Fixes u-root#1845 and aids in EFI kexec.

Signed-off-by: Chris Koch <chrisko@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

1 participant
You can’t perform that action at this time.
X Tutup