arndt@zyx.ZYX.SE (Arndt Jonasson) (02/22/91)
Environment: DECStation (MIPS), Ultrix 4.1.
When a process accesses a word of memory on a non-aligned address, the
kernel fixes up the access, and optionally prints a message. This message
can be turned off with the 'uac' command.
For debugging purposes, it would be much more convenient if the kernel
didn't fix up the access, and sent a signal to the process instead
(e.g., "bus error" or "segmentation violation"). Is it possible to
make this happen?
/*
When this program runs, it should get a signal on at least one of the
marked lines.
*/
main ()
{
char *kaka = "vanilj";
int *ip;
ip = (int *) kaka;
*ip = 1; /* XXX */
ip = (int *) (kaka+1);
*ip = 2; /* XXX */
}
--
Arndt Jonasson, ZYX AB, Styrmansgatan 6, 114 54 Stockholm, Sweden
email address: arndt@zyx.SE or <backbone>!mcsun!sunic!zyx!arndt
cks@hawkwind.utcs.toronto.edu (Chris Siebenmann) (02/26/91)
Unfortunately, Ultrix currently (as far as I'm aware) provides no support for making your programs always dump core when they do unaligned references that the kernel has to fix up. Personally, I think this is a gaping misfeature, and I wish DEC had fixed their kernel and uac to support this several releases ago (maybe then vendors would stop fixing third party software that fills up our error logs with "Fixing up unaligned references" messages). If you have kernel source, it appears to be a relatively simple fix to always make things dump core when this happens (or to make it dump core conditional on whether or not the message is printed); see trap.c, around line 368 in the Ultrix 4.0 sources. It might be possible to binary patch a kernel to always dump core on such fixups; you'd need to NOP out a C break statement. Of course, who knows how much Ultrix software would start dumping core if you did this; patch at your own peril. -- ported program: a program which takes constant or increasing effort to port to each new machine. portable program: a program which takes less effort to port to each new machine. cks@hawkwind.utcs.toronto.edu ...!{utgpu,utzoo,watmath}!utgpu!cks
cks@hawkwind.utcs.toronto.edu (Chris Siebenmann) (02/26/91)
I wrote: | [...] (maybe then vendors would stop fixing third party software that | fills up our error logs with "Fixing up unaligned references" | messages). This should of course be "stop shipping" instead of "stop fixing", as has been pointed out to me in email. Or perhaps "start fixing". Either would be an improvement. -- "You don't *run* programs on Ultrix." - Mark Moraes "Right, you chase them." - Rayan Zachariassen cks@hawkwind.utcs.toronto.edu ...!{utgpu,utzoo,watmath}!utgpu!cks
thomas@mipsbx.lkg.dec.com (Matt Thomas) (02/27/91)
In article <1991Feb25.221137.8462@jarvis.csri.toronto.edu> cks@hawkwind.utcs.toronto.edu (Chris Siebenmann) writes: > > Unfortunately, Ultrix currently (as far as I'm aware) provides no >support for making your programs always dump core when they do >unaligned references that the kernel has to fix up. Personally, I think >this is a gaping misfeature, and I wish DEC had fixed their kernel and >uac to support this several releases ago (maybe then vendors would stop >fixing third party software that fills up our error logs with "Fixing >up unaligned references" messages). #include <sys/syscall.h> #include <sys/sysmips.h> #include <stdio.h> syscall(SYS_sysmips, MIPS_FIXADE, 0, NULL, NULL, NULL); Starting in ULTRIX V4.2, adding above line to your program will causes it core dump (via a bus error) when an unaligned access is trapped. Replacing the 0 by a 1 will reenable fixups. -- Matt Thomas Internet: thomas@wrl.dec.com DECnet-ULTRIX Development UUCP: ...!decwrl!thomas Digital Equipment Corporation Disclaimer: This message reflects my own Littleton, MA warped views, etc.