[PATCH] ntdll: set user_shared_data to 0x7fffffff0000 and virtual_alloc_first_teb can run succeeded on android aarch64

Stefan Dösinger stefandoesinger at gmail.com
Mon Jan 10 06:07:10 CST 2022



> Am 10.01.2022 um 14:53 schrieb fanwj at mail.ustc.edu.cn:
> 
> +#if defined(__aarch64__) && defined(__ANDROID__)
> +/* Note: Android-AARCH64 only support 3-level page table:
> + * user_shared_data = page_size * pow(page_size / ptr_size, page_level) - 0x20000
> + *                  = 0x1000 * pow(0x1000 / 8, 3) - 0x20000
> + *                  = 0x7ffffe0000
> + */
> +struct _KUSER_SHARED_DATA *user_shared_data = (void *)0x7ffffe0000;

You can't simply move this structure. It's location is constant on Windows, applications and other Wine modules (e.g. kernel32, kernelbase, ntoskrnl) depend on it. Where does aarch64 Windows place it?

I am not a VM expert, and I don't see what the 3 level page table has to do with the address. Is it possible that 0x7ffe0000 is not a multiple of your page size?

I remember seeing this alloc failure on Android myself, but only in one of the Wine processes, not all of them. I didn't investigate closely though. André Zwing might know more.


More information about the wine-devel mailing list