GithubHelp home page GithubHelp logo

Comments (17)

adalric avatar adalric commented on June 25, 2024 1

Well that solves it, that padding is the one messing the assert.

from xnu.

zhuowei avatar zhuowei commented on June 25, 2024

@aBradleyUno do we need to add some extra sectcreate arguments in the arm64 ldflags?

-Wl,-sectcreate,__PRELINK_TEXT,__text,/dev/null \

from xnu.

adalric avatar adalric commented on June 25, 2024

Done, still, there is a panic every 15 LoC.

from xnu.

zhuowei avatar zhuowei commented on June 25, 2024

@aBradleyUno It seems that that isn't the right way to add a __DATA_CONST: https://github.com/apple-opensource/ld64/blob/master/src/ld/Options.cpp#L3808 says to pass in -data_const to the linker. Also, passing in -text_exec enables __TEXT_EXEC. https://github.com/apple-opensource/ld64/blob/master/src/ld/Options.cpp#L3816

My bad. :(

It looks like kexts are automatically compiled with these enabled (https://github.com/apple-opensource/ld64/blob/master/src/ld/Options.cpp#L4601), but there's no equivalent check for the kernel.

from xnu.

adalric avatar adalric commented on June 25, 2024

There is still the problem with the hardcoded offset. The assert still fails.

assert(segDATACONSTB == segTEXTB + segSizeTEXT);

from xnu.

zhuowei avatar zhuowei commented on June 25, 2024

@aBradleyUno we could try using -segment_order to reorder the segments manually

from xnu.

adalric avatar adalric commented on June 25, 2024

@zhuowei or -sectalign, I'm going to try both

from xnu.

adalric avatar adalric commented on June 25, 2024
-Wl,-segment_order,__TEXT:__DATA_CONST:__TEXT_EXEC:__KLD:__LAST:__DATA:__PRELINK_TEXT:__PLK_TEXT_EXEC:__PLK_DATA_CONST:__PRELINK_DATA:__PLK_LLVM_COV:__PLK_LINKEDIT:__PRELINK_INFO \

Am I missing something? @zhuowei

from xnu.

zhuowei avatar zhuowei commented on June 25, 2024

@aBradleyUno that looks fine.

from xnu.

adalric avatar adalric commented on June 25, 2024

@zhuowei still panics

from xnu.

zhuowei avatar zhuowei commented on June 25, 2024

@aBradleyUno What's the message now?

from xnu.

adalric avatar adalric commented on June 25, 2024

@zhuowei is still on the assert, the only difference are the value on the variables
Also check the segments, what does `__TEXT,initcode does?
screen shot 2018-08-17 at 12 23 54 pm Left Darm64 - Right iOS 11.2.5

from xnu.

zhuowei avatar zhuowei commented on June 25, 2024

There's only two mentions of initcode in darwin-xnu: both are in kern_memorystatus.h

Edit: can I see the compiled kernel?

from xnu.

adalric avatar adalric commented on June 25, 2024

Maybe XNU_KERNEL_PRIVATE?

from xnu.

adalric avatar adalric commented on June 25, 2024

So, if I comment out the first assert the second one works like a charm

from xnu.

adalric avatar adalric commented on June 25, 2024

XNU.zip

from xnu.

zhuowei avatar zhuowei commented on June 25, 2024

@aBradleyUno The __TEXT section ends at 0xfffffff007204000, but the __DATA_CONST starts at 0xfffffff007400000 - this gap is causing the first assert to fire. It's interesting that __data_const aligned itself to the nearest 0x200000 byte; there's this in the makefile that seems relevant:

-Wl,-seg_page_size,__TEXT,0x200000 \

from xnu.

Related Issues (6)

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.