tags 343038 patch
thanks

On Tue, Dec 13, 2005 at 08:27:55PM -0800, Steve Langasek wrote:
> On Tue, Dec 13, 2005 at 08:51:42PM -0600, Dirk Eddelbuettel wrote:

> > Here is some follow-up from our developer-accessible ia64 machine.
> > [EMAIL PROTECTED]:~$ uname -a
> > Linux merulo 2.6.12-dsa-mckinley-smp #1 SMP Thu Aug 11 15:58:43 MDT 2005 
> > ia64 GNU/Linux
> > [EMAIL PROTECTED]:~$ gcc --version
> > gcc (GCC) 4.0.3 20051111 (prerelease) (Debian 4.0.2-4)
> > Copyright (C) 2005 Free Software Foundation, Inc.
> > This is free software; see the source for copying conditions.  There is NO
> > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

> > The gcc version is different from what I had used before. 

> > * checking examples ... OK
> > * checking tests ...
> > make[1]: Entering directory `/home/edd/foreign.Rcheck/tests'
> >   Running 'S3.R'
> >   Comparing 'S3.Rout' to 'S3.Rout.save' ... OK
> >   Running 'xport.R'
> > R(5876): unaligned access to 0x60000fffffec9e6e, ip=0x200000000150c021
> > R(5876): unaligned access to 0x60000fffffec9e6e, ip=0x200000000150c021
> > R(5876): unaligned access to 0x60000fffffec9e6e, ip=0x200000000150c021
> > R(5876): unaligned access to 0x60000fffffec9e6e, ip=0x200000000150c021
> >   Comparing 'xport.Rout' to 'xport.Rout.save' ... OK
> >   Running 'octave.R'
> >   Comparing 'octave.Rout' to 'octave.Rout.save' ... OK
> >   Running 'stata.R'
> >   Comparing 'stata.Rout' to 'stata.Rout.save' ... OK
> >   Running 'minitab.R'
> >   Comparing 'minitab.Rout' to 'minitab.Rout.save' ... OK
> >   Running 'spss.R'
> >   Comparing 'spss.Rout' to 'spss.Rout.save' ... OK
> > make[1]: Leaving directory `/home/edd/foreign.Rcheck/tests'
> >  OK
> > * creating foreign-manual.tex ... OK
> > * checking foreign-manual.tex ... OK

> > This was running interactively, not from the build. So it doesn't even fail.

> <grumble>  The unaligned trap handling on ia64 is configurable with a proc
> option, and it's not on by default.  I'm pretty sure this option is set on
> the buildd; I don't know if it's set on the porter machine.  Cc:ing LaMont
> for confirmation.

Grabbed the magic juice from LaMont on IRC.

  prctl --unaligned=signal <command>

The bus error is reproducible on merulo with this command:

  prctl --unaligned=signal R CMD check --no-latex .

And here's the backtrace from
R_LIBS=/home/vorlon/foreign/..Rcheck:/usr/local/lib/R/site-library:/usr/lib/R/site-library:/usr/lib/R/library
 \
srcdir=/home/vorlon/foreign/tests LANGUAGE=C R_HOME_DIR=/usr/lib/R \
R_HOME=/usr/lib/R R_SHARE_DIR=/usr/lib/R/share \
R_INCLUDE_DIR=/usr/lib/R/include R_DOC_DIR=/usr/lib/R/doc \
LD_LIBRARY_PATH=/usr/lib/R/lib R_binary=/usr/lib/R/bin/exec/R \
args=' --vanilla' R_SESSION_TMPDIR=/tmp/Rtmpu3eE6E prctl --unaligned=signal \
gdb /usr/lib/R/bin/exec/R:

(gdb) run --vanilla < xport.R
Starting program: /usr/lib/R/bin/exec/R --vanilla < xport.R
[...]
(gdb) bt
#0  next_xport_info (fp=0x600000000095e7b0, namestr_length=140, nvars=6, 
    headpad=0x60000000003c2b40, tailpad=0x60000000003c2b70, 
    length=0x60000000003c2ba0, ntype=0x6000000000f694a0, 
    nlng=0x6000000000f69800, nvar0=0x6000000000f697b8, 
    nname=0x600000000087a340, nlabel=0x600000000087a2e8, 
    nform=0x600000000020f900, npos=0x6000000000f69770) at SASxport.c:137
#1  0x200000000150cfb0 in xport_info (xportFile=<value optimized out>)
    at SASxport.c:519
#2  0x20000000001536a0 in do_dotcall () from /usr/lib/R/lib/libR.so
#3  0x20000000001b0060 in Rf_eval () from /usr/lib/R/lib/libR.so
#4  0x20000000001b5150 in do_begin () from /usr/lib/R/lib/libR.so
#5  0x20000000001afe00 in Rf_eval () from /usr/lib/R/lib/libR.so
#6  0x20000000001b8aa0 in Rf_applyClosure () from /usr/lib/R/lib/libR.so
#7  0x20000000001afc10 in Rf_eval () from /usr/lib/R/lib/libR.so
#8  0x20000000001f78b0 in Rf_ReplIteration () from /usr/lib/R/lib/libR.so
#9  0x20000000001f7cf0 in Rf_ReplIteration () from /usr/lib/R/lib/libR.so
#10 0x20000000001f8640 in run_Rmainloop () from /usr/lib/R/lib/libR.so
#11 0x20000000001f86c0 in Rf_mainloop () from /usr/lib/R/lib/libR.so
#12 0x4000000000000b40 in main ()

hmm, looks like the build I copied from your dir doesn't have debugging on,
because line 137 isn't in next_xport_info(), it's in get_nam_header() -- but
it definitely *is* a line that could be causing a bus error:  it assumes
that char record[141] is 32-bit aligned on the stack, and strange as it is,
I've seen other bugs which show this is not a safe assumption with the
latest versions of gcc.

So, recommended fix:

static int
get_nam_header(FILE *fp, struct SAS_XPORT_namestr *namestr, int length)
{
    /*
     * point to an array of ints to ensure alignment;
     * assumes sizeof(int) == 4, because the code already assumes that anyway
     */
    int buf[36];
    char *record = (char *) buf;

    [...]

Confirmed to work.

Cheers,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
[EMAIL PROTECTED]                                   http://www.debian.org/

Attachment: signature.asc
Description: Digital signature

Reply via email to