From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 11852 invoked from network); 18 Aug 1999 21:31:30 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 18 Aug 1999 21:31:30 -0000 Received: from henry.uncarved.co.uk (ndu-1-60.inweb.co.uk [212.38.69.159]) by mail.redhat.com (8.8.7/8.8.7) with SMTP id RAA07488 for ; Wed, 18 Aug 1999 17:31:29 -0400 Received: (qmail 3288 invoked by uid 500); 18 Aug 1999 21:23:49 -0000 From: "Sean Hunter" Date: Wed, 18 Aug 1999 22:23:49 +0100 To: Michal Jaegermann Cc: axp-list@redhat.com Subject: Re: Unaligned traps et al Message-ID: <19990818222349.W28508@henry.uncarved.co.uk> Mail-Followup-To: Michal Jaegermann , axp-list@redhat.com References: <19990818144755.T28508@henry.uncarved.co.uk> <199908181556.JAA28448@ellpspace.math.ualberta.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.1i In-Reply-To: <199908181556.JAA28448@ellpspace.math.ualberta.ca>; from Michal Jaegermann on Wed, Aug 18, 1999 at 09:56:48AM -0600 X-Operating-System: Linux henry.uncarved.co.uk 2.2.10 X-Organisation: Uncarved Systems Ltd. X-Public-Key-URL: http://fido.bfriars.ox.ac.uk/~sean/pubkey.asc X-MSMail-Priority: High X-Priority: 1 Thanks for your rousing call to "go buy a clue". Results follow. On Wed, Aug 18, 1999 at 09:56:48AM -0600, Michal Jaegermann wrote: > > > > 1)A lot of programs (eg rh6 ping) [stuff incl useful snippet of code re unaligned snipped] I had a feeling that this was a FAQ, but searching the FAQ didn't uncover it. Perhaps I should submit this to the FAQ... Anyway, you've got me thing about a possibly useful kernel patch. I'm going to send this to the list first to get people's opinions. I'm going to have a go at writing this iover the next couple of weeks if people think it would be a good idea. (I have done a few similar things in the past). For those who don't know, its possible (as Michal told me, and rth's code snippet demonstrated) to exercise a small degree of control over what the kernel does when an app encounters an unaligned access. In particular, you can turn off the message, tell the kernel not to fix the access (this sounds like a bad idea), or (more usefully) get the kernel to send the app a SIGBUS, causing it to dump core. You can then plug the coredump into your favourite debugger and fix the access. The trouble is, you need to use setsysinfo to get your program to do this, which is fine for stuff you're writing, but a pain for other programs. What I propose is to set up a sysctl so that it will automatically set this behaviour as desired. This means that normally you just leave this as is, bit if you feel like doing a spot o' debugging you can echo "some_magic" >> /proc/sys/kernel/uac_control, and all newly-started process will automatically have the correct behaviour set in the tss, and will SIGBUS and coredump on encountering the unaligned trap. Similarly, if you attempting to show a prototype port to your boss, and don't what to be embarrassed by the unaligned traps you haven't fixed yet, you echo some magic to the same place to turn the messages off. Thoughts? Sean