@@ -2734,6 +2734,17 @@ Bool ML_(read_elf_object) ( struct _DebugInfo* di )
27342734 BAD (".plt" );
27352735 }
27362736 }
2737+ /* Accept .plt.sec where mapped as rx (code) - hardened PLT section */
2738+ if (0 == VG_ (strcmp )(name , ".plt.sec" )) {
2739+ if (inrx && !di -> pltsec_present ) {
2740+ di -> pltsec_present = True ;
2741+ di -> pltsec_avma = svma + inrx -> bias ;
2742+ di -> pltsec_size = size ;
2743+ TRACE_SYMTAB ("acquiring .plt.sec avma = %#lx\n" , di -> pltsec_avma );
2744+ } else {
2745+ BAD (".plt.sec" );
2746+ }
2747+ }
27372748# elif defined(VGP_ppc32_linux )
27382749 /* Accept .plt where mapped as rw (data) */
27392750 if (0 == VG_ (strcmp )(name , ".plt" )) {
@@ -2746,6 +2757,17 @@ Bool ML_(read_elf_object) ( struct _DebugInfo* di )
27462757 BAD (".plt" );
27472758 }
27482759 }
2760+ /* Accept .plt.sec where mapped as rw (data) - hardened PLT section */
2761+ if (0 == VG_ (strcmp )(name , ".plt.sec" )) {
2762+ if (inrw1 && !di -> pltsec_present ) {
2763+ di -> pltsec_present = True ;
2764+ di -> pltsec_avma = svma + inrw1 -> bias ;
2765+ di -> pltsec_size = size ;
2766+ TRACE_SYMTAB ("acquiring .plt.sec avma = %#lx\n" , di -> pltsec_avma );
2767+ } else {
2768+ BAD (".plt.sec" );
2769+ }
2770+ }
27492771# elif defined(VGP_ppc64be_linux ) || defined(VGP_ppc64le_linux )
27502772 /* Accept .plt where mapped as rw (data), or unmapped */
27512773 if (0 == VG_ (strcmp )(name , ".plt" )) {
@@ -2766,6 +2788,25 @@ Bool ML_(read_elf_object) ( struct _DebugInfo* di )
27662788 BAD (".plt" );
27672789 }
27682790 }
2791+ /* Accept .plt.sec where mapped as rw (data), or unmapped - hardened PLT section */
2792+ if (0 == VG_ (strcmp )(name , ".plt.sec" )) {
2793+ if (inrw1 && !di -> pltsec_present ) {
2794+ di -> pltsec_present = True ;
2795+ di -> pltsec_avma = svma + inrw1 -> bias ;
2796+ di -> pltsec_size = size ;
2797+ TRACE_SYMTAB ("acquiring .plt.sec avma = %#lx\n" , di -> pltsec_avma );
2798+ } else
2799+ if ((!inrw1 ) && (!inrx ) && size > 0 && !di -> pltsec_present ) {
2800+ /* File contains a .plt.sec, but it didn't get mapped.
2801+ Presumably it is not required on this platform. At
2802+ least don't reject the situation as invalid. */
2803+ di -> pltsec_present = True ;
2804+ di -> pltsec_avma = 0 ;
2805+ di -> pltsec_size = 0 ;
2806+ } else {
2807+ BAD (".plt.sec" );
2808+ }
2809+ }
27692810# else
27702811# error "Unsupported platform"
27712812# endif
0 commit comments