Project

General

Profile

Actions

Bug #7633

open

sparc: ld core dump in ld64_reloc_plt

Added by Igor Kozhukhov over 5 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2016-11-30
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

after build on sparc by gcc5 we cab hit issue with rebuild and panic in ld:

igork@bld13:~/builds/igork/dg-5/usr/src/lib/libbunyan/sparcv9$ mdb core 
Loading modules: [ ld libc.so.1 ld.so.1 ]
> $C
ffffffff7fffd501 libld.so.4`ld64_reloc_plt+0x58(ffffffff7fffe030, ffffffff7e400020, 
ffffffff7e4126f8, ffffffff7de017f5, ff0000, 80808080)
ffffffff7fffd5b1 libld.so.4`ld64_process_sym_reloc+0x508(ffffffff7e400020, ffffffff7fffe030, 120, 
ffffffff7e4114b8, 0, d)
ffffffff7fffd691 libld.so.4`process_reld+0x434(ffffffff7e400020, ffffffff7e4114b8, 
ffffffff7fffe030, 19, ffffffff7de01e08, 12)
ffffffff7fffd781 libld.so.4`reloc_section+0x194(1, ffffffff7e4110f0, ffffffff7e4114b8, 
ffffffff7e406888, fffffffe6fcb8bf8, ffffffff7fffe078)
ffffffff7fffd881 libld.so.4`reloc_segments+0x140(0, ffffffff7e400020, ffffffff7e401a12, 
fffffffe6fb68de0, fff1, 40000)
ffffffff7fffd931 libld.so.4`ld64_reloc_init+0x48(ffffffff7e400020, 27, ffffffff7fffe418, 
6f72733a2000, ff0000, 1)
ffffffff7fffd9e1 libld.so.4`ld64_main+0x3dc(27, ffffffff7fffe418, 2b, 7f45, ffffffff7fffe284, 
1001054c0)
ffffffff7fffdaa1 main+0x124(27, ffffffff7fffe418, ffffffff7fffe558, 1001054d8, 100000000, 0)
ffffffff7fffdb61 _start+0x7c(0, 0, 0, 0, 0, 0)
> ffffffff7fffe030::print Rel_desc
{
    rel_isdesc = 0xffffffff7e4110f0
    rel_sym = 0xffffffff7e4126f8
    rel_aux = 0
    rel_roffset = 0x8
    rel_raddend = 0
    rel_flags = 0x100008
    rel_rtype = 0x12
}
> 0xffffffff7e4126f8::print Sym_desc
{
    sd_GOTndxs = 0
    sd_sym = 0xffffffff7de01368
    sd_osym = 0
    sd_move = 0
    sd_name = 0xffffffff7de01613 "__sparc_get_pc_thunk.l7" 
    sd_file = 0xffffffff7e410f50
    sd_isc = 0xffffffff7e4111f8
    sd_aux = 0
    sd_symndx = 0x19
    sd_shndx = 0x4
    sd_flags = 0x18
    sd_ref = 0x2
}
> 

based on info we have no checked NULL with sd_aux and easy/simple fix it by:

igork@bld13:~/builds/igork/dg-5/usr/src/cmd/sgs/libld/common$ g diff relocate.c
diff --git a/usr/src/cmd/sgs/libld/common/relocate.c b/usr/src/cmd/sgs/libld/common/relocate.c
index 8348f54..cef7b7d 100644
--- a/usr/src/cmd/sgs/libld/common/relocate.c
+++ b/usr/src/cmd/sgs/libld/common/relocate.c
@@ -965,7 +965,7 @@ ld_reloc_plt(Rel_desc *rsp, Ofl_desc *ofl)
         *      build output JMP_SLOT relocation
         * fi
         */
-       if (sdp->sd_aux->sa_PLTndx == 0) {
+       if (sdp->sd_aux != NULL &&  sdp->sd_aux->sa_PLTndx == 0) {
                Word    ortype = rsp->rel_rtype;

                (*ld_targ.t_mr.mr_assign_plt_ndx)(sdp, ofl);
@@ -1001,8 +1001,9 @@ ld_reloc_plt(Rel_desc *rsp, Ofl_desc *ofl)
                        return (S_ERROR);
                rsp->rel_rtype = ortype;
                return (1);
-       } else
+       } else {
                return (ld_add_actrel(NULL, rsp, ofl));
+       }
 }

 /*

No data to display

Actions

Also available in: Atom PDF