Linux PARISC architecture development
 help / color / mirror / Atom feed
From: Randolph Chung <randolph@tausq.org>
To: parisc-linux@lists.parisc-linux.org
Subject: [parisc-linux] interesting linker behaviour :)
Date: Tue, 21 Sep 2004 10:22:45 -0700	[thread overview]
Message-ID: <20040921172245.GS22642@tausq.org> (raw)

willy found a problem this morning with the exception code which was
traced down to the following:

the following code comes from lusercopy.S (with macros expanded):

lstrncpy_from_user:
        .proc
        .callinfo NO_CALLS
        .entry
        comib,=     0,%r24,$lsfu_done
        copy        %r24,%r23
        get_sr
1:      ldbs,ma     1(%sr1,%r25),%r1
$lsfu_loop:
        stbs,ma     %r1,1(%r26)
        comib,=,n   0,%r1,$lsfu_done
        addib,<>,n  -1,%r24,$lsfu_loop
2:      ldbs,ma     1(%sr1,%r25),%r1
$lsfu_done:
        sub         %r23,%r24,%r28
$lsfu_exit:
        bv          %r0(%r2)
        nop
        .exit

        .section .fixup,"ax"
3:      b $lsfu_exit
        ldi         -EFAULT,%r28
        .previous

        .section __ex_table,"aw"
        .word       1b,3b
        .word       2b,3b
        .previous

        .procend

what is supposed to happen is that when a fault happens at "1:", we
would branch to "3:". The code in "3:" sets the return value to -EFAULT
and branches back to the exit path.

what we observed was that when a fault happens, we get an endless loop
of faults.

when i disassembled the code at 3:, i see:

1038ce68:       e8 05 00 7d     b,l 10357eac <tcpdiag_dump+0x5ac>,r0
1038ce6c:       34 1c 3f e5     ldi -e,ret0

the target of the branch is a long branch stub:

10357eac:       20 20 02 02     ldil 10100000,r1
10357eb0:       e0 20 22 b2     be,n 158(sr4,r1)

but 10100158 is lstrncpy_from_user, not $lsfu_exit:
10100158 <lstrncpy_from_user>
10100190 <$lsfu_exit>

i wonder if the sections are somehow confusing things.... this is with
fairly recent gcc/binutils toolchains, for 32-bit.

randolph
-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

             reply	other threads:[~2004-09-21 17:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-21 17:22 Randolph Chung [this message]
2004-09-21 17:43 ` [parisc-linux] interesting linker behaviour :) Carlos O'Donell
2004-09-21 17:46   ` Carlos O'Donell
2004-09-21 18:51   ` John David Anglin
2004-09-21 19:49     ` Randolph Chung
2004-09-21 20:06       ` John David Anglin
2004-09-21 20:20       ` John David Anglin
2004-09-21 20:36         ` Randolph Chung
2004-09-21 22:04     ` Carlos O'Donell
2004-09-21 22:19       ` Carlos O'Donell
2004-09-21 22:21       ` John David Anglin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040921172245.GS22642@tausq.org \
    --to=randolph@tausq.org \
    --cc=parisc-linux@lists.parisc-linux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox