Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!apple!motcsd!hpda!hpcupt1!stacy From: stacy@hpcupt1.HP.COM (Stacy Martelli) Newsgroups: comp.sys.hp Subject: Re: libc.a error when linking perl3.0 on HP-UX 3.10 Message-ID: <-286539975@hpcupt1.HP.COM> Date: 4 Dec 89 16:43:27 GMT References: <127@geysir.os.is> Organization: Hewlett Packard, Cupertino Lines: 47 / hpcupt1:comp.sys.hp / cary@hpclcac.HP.COM (Cary Coutant) / 4:02 pm Nov 27, 1989 / > #include > #include > #include > main() > { > syscall(SYS_mkdir, "/usr/tmp/tst", 0755); > } > > ====> Core Dump on Series 800s. > This problem is due to the fact that syscall() must shift all of its > arguments down one before transferring to the system call gateway. > Since it doesn't know how many arguments were actually supplied, > it always copies enough for the most demanding system call. > Unfortunately, in this example, the stack frame for main() is small > enough that syscall actually destroys the return address in this > process. By adding a local variable, as one poster suggested, or > by adding a few dummy parameters -- e.g., > > syscall(SYS_mkdir, "/usr/tmp/tst", 0755, 0, 0, 0); > I'm not aware that anyone has discovered this problem before; > thanks for reporting it! > > Cary Coutant Actually, I don't know if this is the problem you are seeing or not, but it is not the problem I fixed from a bug report that was filed by someone reading this notes string -- I fixed the stack copying problem some time ago. The problem I found was in some code having to do with lightweight system calls. Bits were being deposited in a scratch register without clearing it out first. It just so happens that this is the register syscall uses to do the argument shift. The symptom for this was a segmentation violation and when the core is examined it looks like we branched to and address between 0x200 and 0x300. The problem has been fixed for 8.0. The same workaround Cary describes should work however, you should specify 9 arguments after the system call number to be sure to zero out the scratch register. syscall(SYS_mkdir, "/usr/tmp/tst", 0755, 0, 0, 0, 0, 0, 0, 0); Stacy Martelli HP-UX Kernel Lab