From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zeni Junker Subject: Re: DOSEMU fails on start with SIGSEGV... Date: Sun, 30 Jul 2023 18:22:31 +0200 (CEST) Message-ID: <371952281.269030.1690734151680@fidget.co-bxl> References: <1630427380.2807108.1690720876818@ichabod.co-bxl> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1690734152; s=20210208-e7xh; d=mailfence.com; i=zeni.junker445@mailfence.com; h=Date:From:To:Message-ID:In-Reply-To:References:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding; l=2429; bh=wGtuqFbXxJKrsgyAHMj/Fml2tGjVQp87hJjLvsQ2MQY=; b=1R7gE+p+ahuJWaDTooYK1KtHHyL6/WMRTmrU0XNPIL2TwZggIBL78S/LeBdi1Tjz XDXAI9r92YoXZjwY98lWqma3ljoXXaZNtr7p5fKaSb2oGj9us595JpHvBClIoMw9f0s WKZX24m+OQIxLc81vagLK0rrcekzytfooLKL2nET8PkKOs34fOcfjZNFQpKUVGd8ImN ah2n7jcCsun8ugTDsSUfZ0LxcyYJ3LHgp8rme6SCdJYCaL1TCKWt1xO+V+UREADspnP B+2ftgmNrAlzhXv9wQD4MRPp1fOa886NNla2DMwvyv1b7FBg/bUBudvpB4BGAc+zdKK r76YPmSj8Q== In-Reply-To: <1630427380.2807108.1690720876818@ichabod.co-bxl> List-ID: Content-Type: text/plain; charset="us-ascii" To: linux-msdos@vger.kernel.org Nevermind. It looks like gcc-12+ has problems with static const declarations for lowmem_base and mem_base, especcially as they get defined later, so I've erased "const" in both definitions ( and extern declarations) and now it works, or at least so it seems. > ---------------------------------------- > From: Zeni Junker > Date: Jul 30, 2023, 12:41:16 PM > To: > Subject: DOSEMU fails on start with SIGSEGV... > > > I'm running Gentoo ( if that matters) > I've tried with version 1.4.0 and latest from git repo and the result is the same. > Also, it fails the same way whether I start it as a root or ordinary user ( I've added lines for both in dosemu.usrs file: "username/root c_all" ). > > So I've compiled it with "debug" option tried to debug it with gdb. > > Well, this has lead me through the initialization. > > Thing is in main() (in emu.c - line 394) low_mem_init getc called and it fails. > > Peeking within it shows that low_mem_init ( init.c) calls alloc_mapping ( line 261), which fails. > > Peek into alloc_mapping ( file mapping.c) fails in line 419,, when it tries to copy pointer to allocated area to lowmem_base, which is 0 at that point: > line 419: " *(char **)(&lowmem_base) = addr; " > > Since low memory has never been allocated at that point, this causes SIGSEGV. > > At some point I thought this might be due to some kernel protection etc. Setting in/proc/sys/vm/mmap_min_addr was 65536, so I've reset it to 0 and retried, with the same result. > > Then I've noticed that lowmem_base gets declared as "char * const lowmem_base" in mapping.c and nothing ever sets it, so it is always 0. > Just to doublecheck, I've inspected /proc/proc_id/maps of debugged process and indeed there was nothing mapped at address 0 - all I've seen are high address map areas that one usually gets from mmap > in the range 0x7Fxxxxxxxx for various libs etc and 4 mappings of dosemu.bin, also at high adresses. > But nothing low, so naturally any acess outside of mapped areas SIGSEGVs. > > So, my question is, am I missing something ? > > Shouldn't lowmem_base be set somewhere ? > If not, shouldn't the low area be mapped in somewhere before that ? > > TIA, > > Zeni > > > -- > Sent with https://mailfence.com > Secure and private email -- Sent with https://mailfence.com Secure and private email