#
…

2021-07-22

00:37quarkyalice_ has quit [Ping timeout: 480 seconds]
00:37quarkyalice has joined #asahi
01:09cth451_desktop has quit [Remote host closed the connection]
01:10quarkyalice has quit [Ping timeout: 480 seconds]
01:20jabashque has quit [Quit: Connection closed for inactivity]
01:22riker77_ has joined #asahi
01:27riker77 has quit [Ping timeout: 480 seconds]
01:27riker77_ is now known as riker77
02:18quarkyalice has joined #asahi
02:23PhilippvK has joined #asahi
02:26phiologe has quit [Ping timeout: 480 seconds]
02:27yuyichao has joined #asahi
03:26quarkyalice has quit [Ping timeout: 480 seconds]
04:03Emantor has quit [Quit: ZNC - http://znc.in]
04:04Emantor has joined #asahi
05:02roxfan2 has joined #asahi
05:03roxfan has quit [Ping timeout: 480 seconds]
05:41chadmed has quit [Remote host closed the connection]
05:42chadmed has joined #asahi
05:50chadmed has quit [Remote host closed the connection]
05:50chadmed has joined #asahi
06:04cth451_desktop has joined #asahi
11:05svendart/dev is not enough for nvme fwiw
11:06svenyou should be able to put the root fs onto some mass storage thing though
11:49chadmed has quit [Quit: Konversation terminated!]
12:57Scott[m]1 has joined #asahi
13:41jbowen has quit [Quit: leaving]
13:51yuyichao has quit [Ping timeout: 480 seconds]
14:23bps has quit [Ping timeout: 480 seconds]
14:25jbowen has joined #asahi
14:57bps has joined #asahi
15:16jbowen has quit [Quit: leaving]
15:42jbowen has joined #asahi
16:09cth451_desktopsven: thanks for the heads-up. I did not reserve space for root on the SSD as I have already alloc'd a iSCSI LUN for it.
16:40cth451_desktopAre there any gotchas for the initramfs loaded via m1n1? I'm sideloading a valid initrd that worked on other arm64 machines but on M1 it's reporting ENOENT for /bin/init.
16:52marcancth451_desktop: define sideloading? there was code recently added to add the SEPFW to the initrd, maybe that is broken or maybe the initrd you used doesn't work and that's all there is :)
16:52marcanI actually haven't tried a linux boot since that patch, I should
16:52marcan(cc sven)
16:54marcanI remember some cpio shenanigans from when I did ps4-kexec, related to the trailer
16:54marcanare we doing that?
16:54marcanI think we aren't, that might explain why a concatenated initrd wouldn't work
16:55marcancth451_desktop: quick test, load your initrd uncompressed
16:55marcanif that works then I'm pretty sure this is it
16:55marcanI remember poring over the linux initrd uncompress code until I made sense of this for ps4-kexec
16:57cth451_desktopmarcan: Uncompressed initrd triggers a memory allocation failure in m1n1
16:57marcanhow big is it?
16:57marcanthis is with linux.py?
16:57cth451_desktop170MiB (an entire recoery environment with iSCSI initator and such), and yes loaded via linux.py
17:00marcanhm, what failure?
17:00cth451_desktopOne second, sideloading one now as I don't remember the details
17:01marcanthough yeah, m1n1 heap is 128MB and the cpio code started allocating the entire initramfs there again I think
17:02marcanbut... I actually kind of would expect it to silently overflow
17:02marcanI don't think we check for that
17:05cth451_desktopTTY> dlmalloc: out of memory
17:05cth451_desktopthen the system reboots
17:05marcaninteresting
17:06sveni've been booting linux with that patch fwiw
17:06svenbut uhh.. my initrd is rather small
17:06marcansven: and probably not compressed
17:06svenmine is compressed i think
17:07marcanI seem to recall not having the CPIO trailer in would cause issues
17:07marcanwith concatenated compression
17:07cth451_desktopa dirty hack for sure, but is there a way to just make the heap slightly larger?
17:07marcanwell... as I said this is interesting because we don't actually have a heap top
17:07svenhrm, so i read the linux code and i thought it just eats whatever you feed it
17:07marcanunless it's already overflowing and corrupting
17:08svenand yeah, mine is compressed
17:08marcanChainsaw: look for self.heap_base += 128 * 1024 * 1024 # We leave 128MB for m1n1 heap
17:08marcanin proxyutils.py
17:08marcanchange that to 512 or something
17:08bps has quit [Ping timeout: 480 seconds]
17:09marcananyway the way the cpio code does the re-malloc of the initrd kind of defeats the purpose of all the careful memory management in payload.c, so I want to redo that
17:10marcanfor payloads we should pre-alloc some space and just memmove; for linux.py, it should just deal with it in python and basically do the same thing
17:10marcanlet me see what I can do
17:11svensounds good :)
17:12svenbtw. i just realized that apple locks the dcp and the dcpext DARTs in iBoot :/
17:13marcanas in the registers?
17:13marcanheh, so that is why they reference the pagetables in the ADT
17:13marcanannoying
17:13svenyeah :-(
17:13marcanbut we can still modify them, right?
17:13svenlet me check, but i think so
17:13svenwe just can't point them anywhere else
17:13marcanmaybe only some streams
17:13marcanwhich is probably so the DCP firmware is safe I guess
17:14svenuh.. the lock bit is global
17:14svenit just locks all streams
17:14marcanyeah but I bet some L2 pagetables are in writable RAM
17:14marcanand some are locked behind something else
17:14svenoh, possibly
17:14svenlet me check
17:14svenerm.. wtf
17:14sveni think i can even overwrite the first level tables
17:15svenlike.... why even bother locking it then?!
17:15marcanall of them?
17:15svenlet me double check
17:15svenbut i think so
17:15marcanI would expect the first level for one stream or subset to be locked
17:15svendcpext only has a single stream i thinbk
17:15marcanalternatively, wasn't there one stream set to bypass (15?)
17:16svenah, yes
17:16svenyeah, stream 15 is set to bypass
17:16marcannow I wonder what that one does... and what it's a backdoor for
17:16marcanwould be nice to know e.g. if it's for firmware access, and constrained some other way
17:17svenbypass usually means that streams gets access to everything
17:17marcanyeah, but there might be some other constraint in that access path
17:17marcanbasically what I want to know is does DCP firmware have a backdoor to system RAM or not
17:17svenyeah, i'm checking if there's this DAPF address filter thing behind it
17:17marcanApple aren't stupid enough to leave that in
17:17marcan... I hope
17:18marcanbut I could see this mechanism being part of keeping DCP safe from the AP, with something else constraining it to only its firmware area
17:20svenhrm, so i don't think there's a DAPF behind it
17:20svenor maybe it's just at another MMIO location
17:21quarkyalice has joined #asahi
17:22svenhrm, actually, i think there is
17:24svensoo.. i don't really know how this DAPF thing works but i believe it's an additional filter behind the DART
17:25svenand it looks like maybe it contains some whitelisted MMIO regions
17:25svenbut dunno :/
17:42cth451_desktopI'm not entirely sure whether bumping the heap to 512M changed anything.
17:43cth451_desktopThe kernel still can't find init
17:45marcancth451_desktop: I just pushed some completely untested code to the kboot-fw branch
17:46marcandon't even have m1n1 installed and I need to go to sleep :)
17:46marcanbut give that a shot
17:46cth451_desktopmarcan: thanks
17:46marcan(I was upgrading macos)
17:46marcanalso another thing to check is that the kernel is built for the compression method you are using
17:47marcanyou can also test the payload codepath by doing `cat m1n1.macho devtree.dtb initramfs.cpio.gz kernel > m1n1.payload.macho` and doing a chainload.py to that; that should also work
17:47marcanwell, except the payload are is probably too small for your initramfs :p
17:47marcan_max_payload_size = 64*1024*1024;
17:48marcan64MB max right now but you can increase it in m1n1.ld
17:49kettenis has joined #asahi
17:50cth451_desktopThe kernel is in fact a general purpose distro kernel
17:50cth451_desktop(plus patches)
17:50marcanah, distro config you mean
17:50marcanshould work
17:50cth451_desktop(where we use on SBSA servers)
17:51cth451_desktopdefaults to gzipped initrds, but also configured to work with zstd and xz as well
17:51kettenisInstead of putting the SEPFW in the initrd, can't we just pass its address and size along in the device tree somehow?
17:51marcanwe could use a reserved memory region thing
17:51kettenisthe initrd approach isn't going to work on non-linux OSes...
17:52marcanbut linux already has a firmware mechanism...
17:52marcanit might make sense to do it in the DT though, as you say
17:52kettenisto load firmware into memory...
17:52kettenisbut it already is in memory
17:53marcanI'd poke robher
17:54kettenisI suspect that modifying initrd isn't going to play nice with distros that sign the initrd
17:55marcanheh, how does that work?
17:55robheralready in memory, then reserved-memory...
17:55marcanbut yeah, good point
17:56robherah, what marcan already said...
17:59robherIs SEPFW something that could be extracted and put into linux-firmware? I'd assume distros put at least some of linux-firmware into their initrds.
18:00kettenisdoubt Apple will give permission to distribute it
18:01marcanrobher: no, we do not have a license to it and I'm pretty sure it's paired with things, plus encrypted
18:01svenpeter[m]Sepfw itself is encrypted and I believe paired with the machine
18:01marcanwe can't distribute any of the firmwares. so far everything is preloaded by iBoot except SEPFW (which is passed in RAM), things in auxiliary Flash memories (which we don't touch), and the stupid broadcom wifi thing
18:02svenpeter[m]It also needs two more blobs that are essentially hashes of iBoot,etc. which are definitely paired to the machine
18:02marcanfor the latter, we'll have to make our installer pull it out of macos and stuff it in /boot or something, where the OS can then copy it out or directly use it
18:03robherok, then I'd go the /reserved-memory route.
18:04marcanthe licensing situation is basically that every machine owner has a license to macos by definition, but we don't have a license to redistribute anything
18:04marcanso our installer will take care of downloading the bits we need from Apple's CDN and doing whatever it needs to do
18:04marcanwe won't distribute anything ourselves, and I highly doubt Apple will object to this usage (it's equivalent to installing macOS normally and then erasing most of it)
18:06cth451_desktopkettenis: distros don't usually sign initrds. the initrd images are usually generated on the fly when new kernels or other modification request so.
18:07kettenisdoesn't redhat do full secure boot, at least on x86?
18:07AlessandroFerrari[m]i think fedora does too right?
18:08cth451_desktopI believe they only sign the kernel and associated modules? I could be wrong though.
18:09kettenisi thought some of the u-boot approaches for secure boot did sign the initrd
18:09kettenisbut maybe i'm mistaken
18:09kettenisthat stuff doesn't really interest me as it makes tinkering impossible
18:09cth451_desktopAlso makes life harder for sysadmins
18:11cth451_desktopThe point here is, initrds are per-machine specific and it kind of defeats the purpose to sign initrd locally (since whoever got access to the hardware would presumably have access to private keys on the system)
18:12cth451_desktopSince RH/fedora distributes their kernel and users use the modules and images verbatim, the signatures are actually tamper proof seals since end-users don't have the siging keys
18:13cth451_desktopEmbedded devices are another story though. Vendors who distributes pre-compiled kernel images and initrds may choose to sign them if they are not supposed to be user-modifiable
18:13cth451_desktop(for example most android devices)
18:17kettenisso the node in /reserved-memory basically just needs am appropriate compatible string and a reg property
18:35quarkyalice has quit [Ping timeout: 480 seconds]
18:51quarkyalice has joined #asahi
19:16quarkyalice has quit [Ping timeout: 480 seconds]
19:25quarkyalice has joined #asahi
20:08quarkyalice has quit [Quit: Leaving]
21:22reillyeon4 has joined #asahi
21:22reillyeon has quit [Quit: Ping timeout (120 seconds)]
21:22reillyeon4 is now known as reillyeon
22:07arekm has quit [Remote host closed the connection]
22:07arekm has joined #asahi
…