Giter Site home page Giter Site logo

Something seems wrong with ktrr about aprr HOT 2 OPEN

siguza avatar siguza commented on July 24, 2024
Something seems wrong with ktrr

from aprr.

Comments (2)

Siguza avatar Siguza commented on July 24, 2024

I think what you don't see is that, for ttbr1_el1, when you change T1SZ, you also change the base address for translation.

Imagine if you had only 16-bit addresses - 14 bits for the page, and 2 bits for the page table index. That would give you a single L3 table with four entries, and under ttbr0_el1 it would be mapped like this:

- Index 0 -> 0x0000
- Index 1 -> 0x4000
- Index 2 -> 0x8000
- Index 3 -> 0xc000

And under ttbr1_el1 it would look like this:

- Index 0 -> 0xffffffffffff0000
- Index 1 -> 0xffffffffffff4000
- Index 2 -> 0xffffffffffff8000
- Index 3 -> 0xffffffffffffc000

So now when you reduce the address size to 15 bits (by adding one to T0SZ/T1SZ), with ttbr0 you just cut off the upper half of the address space:

- Index 0 -> 0x0000
- Index 1 -> 0x4000
- Index 2 -> not mapped anymore
- Index 3 -> not mapped anymore

But with ttbr1, you cut off the upper half and move the lower half to higher addresses:

- Index 0 -> 0xffffffffffff8000
- Index 1 -> 0xffffffffffffc000
- Index 2 -> not mapped anymore
- Index 3 -> not mapped anymore

So with the Spectre mitigation, in EL0 you have an address space that only has the vbar page mapped, at 0xffffffc000000000. But when you switch to EL1, that moves down to 0xffffff8000000000, because that's simply what happens when the base address of ttbr1 changes.

Hope that answers your question.

from aprr.

onlinefchen avatar onlinefchen commented on July 24, 2024

But in your post:

They split the kernel’s address space into two ranges. The first conatining only the bare minimum >to switch between EL0 and EL1, the second containing the entire rest of the kernel.
At boot, T1SZ is set to 25, thus mapping the first range at 0xffffff8000000000 and the second >one at 0xffffffc000000000 (for comparison, the unslid kernel base is 0xfffffff007004000).

I mean here is the vbar should be the second not the first. Do we agree?

from aprr.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.