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

As of Linux 6.5.2-arch1-1 real addressing seems broken #271

Open
VorpalBlade opened this issue Sep 11, 2023 · 13 comments
Open

As of Linux 6.5.2-arch1-1 real addressing seems broken #271

VorpalBlade opened this issue Sep 11, 2023 · 13 comments

Comments

@VorpalBlade
Copy link

For some reason, it seems sysctl vm.mmap_min_addr=0 is no longer enough to make SheepShaver work on kernel 6.5.2-arch1-1 (from Arch Linux).

I now keep getting ERROR: Cannot map Low Memory Globals: Cannot allocate memory. though this worked fine yesterday.

In addition it segfaults if I try to build with direct addressing mode instead (I will investigate that and possibly open a separate bug about it).

@VorpalBlade
Copy link
Author

Looking further into this it seems to happen because of this code:

#if REAL_ADDRESSING && HAVE_LINKER_SCRIPT
	if (vm_mac_acquire_fixed(0, RAMSize) == 0) {
		D(bug("Could allocate RAM from 0x0000\n"));
		RAMBase = 0;
		RAMBaseHost = Mac2HostAddr(RAMBase);
		memory_mapped_from_zero = true;
	}
#endif
	if (!memory_mapped_from_zero) {
#ifndef PAGEZERO_HACK
		// Create Low Memory area (0x0000..0x3000)
		if (vm_mac_acquire_fixed(0, 0x3000) < 0) {
			sprintf(str, GetString(STR_LOW_MEM_MMAP_ERR), strerror(errno));
			ErrorAlert(str);
			goto quit;
		}
		lm_area_mapped = true;
#endif

It appears that on my system REAL_ADDRESSING and HAVE_LINKER_SCRIPT is true (so the first block is executed). That creates a mapping up to ram size successfully. However, the call to vm_protect in vm_alloc.cpp then fails for some odd reason. This makes the whole call fail. Which in turn causes the second branch (!memory_mapped_from_zero in main_unix.cpp) to be entered incorrectly.

@VorpalBlade
Copy link
Author

I have created a bug report in Arch Linux against the arch kernel, but I will need to figure out if this is an upstream kernel regression also.

@JoshuaPettus
Copy link

JoshuaPettus commented Jan 24, 2024

Any word on this? It's doesn't seem distro dependent as it's still a problem in fedora 39 against kernel 6.6.12

@VorpalBlade
Copy link
Author

VorpalBlade commented Jan 24, 2024

It was a kernel regression. It was fixed in 6.5.7. I haven't used sheepshaver in a while now, are you saying it is broken again? If so, you should probably show it can be reproduced on an upstream kernel and report it.

@JoshuaPettus
Copy link

JoshuaPettus commented Jan 24, 2024

Unfortunately for me it was never fixed. It has been a problem since 6.5. I've been testing it periodically since. Perhaps whatever patch was made never made it into fedora?

@VorpalBlade
Copy link
Author

I believe it was fixed upstream, and Arch Linux uses close to upstream kernels.

@thomas-covenant
Copy link

thomas-covenant commented Jan 30, 2024

current ubuntu 22.04.03 is using 6.5.0-15-generic kernel and is not fixed.
i try to use 6.5.11 and see if it is fixed. but that kernel version might not run with 22.04.3

edit: the later kernels 6.5.11 / 6.6 do not work and create an error when installing. so the issue remains. pity as sheepshaver is much better performing than qemu.

@mikemocha
Copy link

mikemocha commented Jan 31, 2024

This is not only an Arch Linux problem but also occurring on other distros. I have the same problem on an Ubuntu 23.10 variant. uname -a output

6.5.0-14-generic #14-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 14 14:59:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

@JoshuaPettus
Copy link

Yeah I can see that being a problem on more "stable" distros for a while.

I had found out a couple days ago that when I run Sheepshaver in terminal I no longer get the
"ERROR: Cannot map Low Memory Globals: Cannot allocate memory." So maybe I did get the patch.

The issue is when I open sheepshaver I still get a message that I can't not load extensions because there is no virtual ram. Really odd as I don't think that was ever emulated properly in sheepshaver. I'm a little disappointed because I started having that issue when this issue popped up so I was sure it was the same problem.. I didn't make any other changes but the normal updates

@MirandaStreeter
Copy link

MirandaStreeter commented Oct 14, 2024

Per the Arch issue tracker the fix should've gone in 6.5.7. And yet...

$ SheepShaver
SheepShaver V2.4 by Christian Bauer and Mar"c" Hellwig
ERROR: Cannot map Low Memory Globals: Operation not permitted.
$ uname -r
6.11.2-arch1-1

Could anyone else confirm they're seeing this? I'd rather not go on a bisection journey without a second data point.

@MirandaStreeter
Copy link

Oops, ignore me. That was me running against the root requirement. This is certainly no longer an issue. :)

@philhzss
Copy link

Oops, ignore me. That was me running against the root requirement. This is certainly no longer an issue. :)

How did you fix it? I'm still having the issue, on Steam Deck which runs arch linux, and it used to work.. it broke a few months back. I already have sysctl vm.mmap_min_addr=0, and I'm already running as root, it just broke after an OS update I guess?

image

@IoIxD
Copy link

IoIxD commented Nov 27, 2024

It's worth adding to this thread that Basilisk II works just fine; obviously there are things SheepShaver can do that Basilisk can't, but if you're able to get by running 68k Mac OS 8, it is a functional option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants