Date: Sun, 31 Dec 2000 23:19:22 +1100 (EST) From: Bruce Evans <bde@zeta.org.au> To: Peter Wemm <peter@netplex.com.au> Cc: Matt Jacob <mjacob@FreeBSD.org>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/isp isp.c Message-ID: <Pine.BSF.4.21.0012312222280.7999-100000@besplex.bde.org> In-Reply-To: <200012302027.eBUKRPm09381@mobile.wemm.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 30 Dec 2000, Peter Wemm wrote: > cc puts the strings in the text segment. On userland, this is always > enforced. gcc actually puts them in the .rodata section (what's a segment? :-). > In the kernel, text is write protected for the static kernel. But we do > something funky with the PSE 4MB pages and double map the text/data > segments or something, I dont recall. I think it might be possible for writes > to the text segment to slip through the data area, but I am far from sure > about this. I would have thought we'd have discovered this by now if so. > (Or bde would have found it :-). I noticed it soon after the PSE changes :-). Normally the text, data and bss fit in one 4MB page. That page has to be writable for data, so there is no way that the text can be write protected. The .rodata section is between the text and the data, so it is not write protected either. Switching to ELF broke this further. locore.s doesn't understand ELF sections. It still maps everything up to etext read-only, but it should map everything up to the end of .rodata read-only. Also, for ELF the sections are not normally padded to a page boundary, so when locore.s rounds up etext to a page boundary, it normally goes too far and risks mapping the start of the data read-only. This presumably works in the non-PSE case only because .rodata provides sufficient padding. (AFAIK, he mappings locore set up by locore.s are not changed later, except they get subverted by switching to 4MB pages if 4MB pages are possible and not disabled. Also, the double mapping hack is not used in the kernel.) Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0012312222280.7999-100000>