From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 9142 invoked from network); 19 Aug 1999 08:50:42 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 19 Aug 1999 08:50:42 -0000 Received: from saturn.aladdin.de (saturn.aladdin.de [194.123.19.3]) by mail.redhat.com (8.8.7/8.8.7) with SMTP id EAA10935 for ; Thu, 19 Aug 1999 04:50:42 -0400 Received: by saturn.aladdin.de(Lotus SMTP MTA v4.6.2 (693.3 8-11-1998)) id 412567D2.00372945 ; Thu, 19 Aug 1999 11:02:30 +0100 X-Lotus-FromDomain: AKS From: "Christian Groessler" To: axp-list@redhat.com cc: "Sean Hunter" Message-ID: <412567D2.0037281A.00@saturn.aladdin.de> Date: Thu, 19 Aug 1999 10:52:55 +0100 Subject: Re: Unaligned traps et al Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Content-Disposition: inline Hi, On 8/18/99 10:23:49 PM Sean Hunter wrote: > >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. The following program creates a subshell and all programs started from therein will SIGBUS on unaligned accesses. ---------------------- /* 28-May-98, chris */ #ifndef __linux__ #include #else #include #include static int setsysinfo(unsigned long op, void *buffer, unsigned long size, int *start, void *arg, unsigned long flag) { syscall(__NR_osf_setsysinfo, op, buffer, size, start, arg, flag); } #endif void trap_unaligned(void) { unsigned int buf[2]; buf[0] = SSIN_UACPROC; buf[1] = UAC_SIGBUS | UAC_NOPRINT; setsysinfo(SSI_NVPAIRS, buf, 1, 0, 0, 0); } int main(int ac) { trap_unaligned(); printf("creating subshell with SIGBUS setting!\n"); execl("/bin/bash","/bin/bash",(char *)0); return(0); /* not reached */ } ---------------------- regards, chris