emaculation / macemu

Basilisk II and SheepShaver Macintosh emulators, maintained
74 stars 14 forks source link

Document kernel settings to run SheepShaver in Linux somewhere obvious #135

Open rakslice opened 4 years ago

rakslice commented 4 years ago

To run SheepShaver in Linux, one that was made with the default configure addressing setting, requires changing the kernel setting vm.mmap_min_addr to 0.

Otherwise you get an error like: $ SheepShaver Cannot map Low Memory Globals: Operation not permitted.

It would be nice if this was documented somewhere obvious like the readme.

You can set the setting by echoing 0 to /proc/sys/vm/mmap_min_addr as root, or doing

sudo sysctl -w vm.mmap_min_addr=0

and you can make it happen automatically at startup by putting

vm.mmap_min_addr = 0

into /etc/sysctl.d/whatever.conf

Edit: The kernel null deref protection afforded by mmap minimum address enforcement has defense in depth value. If we can make some working build other than a real addressing build be the default configure option, great.

This issue is just a practical matter: while real addressing is still the default configure option, without instructions, users encounter the error message and show up in the issue tracker for support.

ianfixes commented 4 years ago

Thanks for contributing this. Is this something that works in CI but fails locally? To say it another way, does the CI config need to be updated in some way to expose this issue?

rakslice commented 4 years ago

This is a setting that has to be set on the local machine where the the software is used, it has nothing to do with building.

rakslice commented 4 years ago

I've edited the issue a bit to try to clarify that.

ianfixes commented 4 years ago

If I'm understanding this correctly, you're talking about the proper way to run SheepShaver after it is already built

rakslice commented 4 years ago

Yes, that's correct.

SegHaxx commented 4 years ago

I highly recommend not messing with vm.mmap_min_addr or encouraging others to do so. It is the way it is for good reason. Compile with --enable-addressing=direct instead.

Linux, FreeBSD and probably every other unix OS are moving towards making real addressing impossible going forwards, as it is a security risk.

We should really change the default SheepShaver build to use direct addressing.

rakslice commented 4 years ago

Note that if you change the default addressing mode, for arches and compiler versions where the default is to build the JIT using pregenerated stuff, you'll want to reroll the pregenerated stuff to match the new addressing mode (which to some degree is an archaeology project for the taking AFAICT - see https://github.com/cebix/macemu/issues/222) or at least make JIT not the default in the meantime.

SegHaxx commented 4 years ago

It'd be better to comment on my PR if you want me to change it. :)

rakslice commented 4 years ago

Oh, there was no PR on the issue when I opened the page. :D I'm surprised you got that far without running into a problem?

SegHaxx commented 4 years ago

I'm able to boot my System 7.6.1 CD in SheepShaver and get the "Welcome to Mac OS" screen, but then it segfaults. I haven't used SheepShaver in ages so I don't know if this ever worked though. I'm going to go find a Mac OS 8.6 CD and see if that works.

rakslice commented 4 years ago

idk what kind of shape this fork is in, but SheepShaver has historically worked with 7.6.1.

SegHaxx commented 4 years ago

That's the question then. Has SheepShaver ever worked for anyone in this branch? :)

rakslice commented 4 years ago

Testing real addressing JIT builds of 28f61bf0d69bb44c28d84595640373c2b2ed80e9 on Linux VMs I have handy with Mac OS 7.6.1 installs: i686 jit true -> boots to desktop ok i686 jit false -> boots to desktop ok x86_64 jit true -> boots to desktop ok x86_64 jit false -> segfault on the boot screen before the first extension icon appears, no PPC stack trace

Did you maybe land on the non-working combination by sheer chance?

rakslice commented 4 years ago

For more background, that's with the 7200/7500/8500/9500 v1 ROM, the one with Apple checksum 96CD923D

rakslice commented 4 years ago

Moving the discussion to the PR since I see you also commented there