This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[BZ 16372] fixing tst-longjmp_chk2 on ia64


i was going through the outstanding ia64 test failures when i came across tst-
longjmp_chk2.  that test is designed to make sure the longjmp fortify logic 
handles signal stacks correctly which the current ia64 code does not.  to 
implement this, you have to call sigaltstack from asm code, and my ia64 skills 
are bad :).

here's what i've got so far:
#define CHECK_RSP(reg) \
        /* First see if target stack is within current one.  */ \
        cmp.ltu p0, p8 = reg, r12;                              \
(p8)    br.cond.dpnt .Lok;;                                     \
                                                                \
        /* Maybe it's an alternative signal stack.  */          \
        adds r34 = -sizeSS, r12;                                \
        mov r33 = r0;                                           \
        ;;                                                      \
        mov r12 = r9;                                           \
        DO_CALL_VIA_BREAK (SYS_ify (sigaltstack));              \
        ;;                                                      \
        /* If the syscall failed, then assume it's OK.  */      \
        cmp.eq p8, p0 = -1, r10;                                \
(p8)    br.cond.spnt.few .Lok;;                                 \
        /* Move stack_t into regs and cleanup current stack.  */\
        adds r14 = 8, r12;      /* ss_flags */                  \
        adds r15 = 16, r12;     /* ss_size */                   \
        ld4 r16 = [r12];        /* ss_sp */                     \
        ;;                                                      \
        mov r12 = r9;                                           \
        ld4 r17 = [r14];        /* ss_flags */                  \
        ld4 r18 = [r15];        /* ss_size */                   \
        ;;                                                      \
        /* See if we're currently on the altstack.  */          \
        tbit.z p0, p8 = r17, 0; /* SS_ONSTACK */                \
(p8)    br.cond.dpnt .Lfail;                                    \
        ;;                                                      \
        /* Verify target is within alternative stack.  */       \
        cmp.ltu p0, p8 = reg, r16;                              \
(p8)    br.cond.dpnt .Lok;                                      \
        ;;                                                      \
                                                                \
        /* Still here?  Abort!  */                              \
.Lfail:                                                         \
        addl r28 = @ltoffx(longjmp_msg#), r1;;                  \
        ld8.mov r28 = [r28], longjmp_msg#;;                     \
        ld8 out0 = [r28];                                       \
        br.call.sptk.many b0 = HIDDEN_JUMPTARGET(__fortify_fail)#;; \
.Lok:

my attempt to pass args to the syscall don't seem to be working.  could you 
take a look and post some suggestions ?

then again, does this code really need to be implemented in assembler ?  maybe 
i should just delete this and use the generic C variant ...

i filed this to track:
https://sourceware.org/bugzilla/show_bug.cgi?id=16372
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]