[yocto] [prelink-cross][PATCH 2/2] src/arch-aarch64.c:testsuite failure fixes in aarch64

2015-11-26 Thread Maninder Singh
This patch fixes testsuite failure in aarch64 prelink undo section.

Signed-off-by: Vaneet Narang 
Signed-off-by: Maninder Singh 
---
 src/arch-aarch64.c |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/arch-aarch64.c b/src/arch-aarch64.c
index e04dd6e..3e5ddd1 100644
--- a/src/arch-aarch64.c
+++ b/src/arch-aarch64.c
@@ -470,7 +470,9 @@ aarch64_undo_prelink_rela (DSO *dso, GElf_Rela *rela, 
GElf_Addr relaaddr)
   switch (GELF_R_TYPE (rela->r_info))
 {
 case R_AARCH64_NONE:
+   break;  
 case R_AARCH64_RELATIVE:
+   write_ne64 (dso, rela->r_offset, 0);
   break;
 case R_AARCH64_JUMP_SLOT:
   sec = addr_to_sec (dso, rela->r_offset);
@@ -487,9 +489,7 @@ aarch64_undo_prelink_rela (DSO *dso, GElf_Rela *rela, 
GElf_Addr relaaddr)
 
  assert (rela->r_offset >= dso->shdr[sec].sh_addr + 24);
  assert (((rela->r_offset - dso->shdr[sec].sh_addr) & 7) == 0);
- write_neclass (dso, rela->r_offset,
- 2 * (rela->r_offset - dso->shdr[sec].sh_addr - 24)
- + data);
+ write_neclass (dso, rela->r_offset, data);
}
   break;
 case R_AARCH64_GLOB_DAT:
@@ -501,6 +501,7 @@ aarch64_undo_prelink_rela (DSO *dso, GElf_Rela *rela, 
GElf_Addr relaaddr)
   write_ne64 (dso, rela->r_offset, 0);
   break;
 case R_AARCH64_TLS_TPREL:
+  write_ne64 (dso, rela->r_offset, 0);
   break;
 case R_AARCH64_TLSDESC:
   write_ne64 (dso, rela->r_offset, 0);
-- 
1.7.1

-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


[yocto] [prelink-cross][PATCH 1/2] testsuite: fixes in testsuite according to aarch64

2015-11-26 Thread Maninder Singh
This Patch fixes testsuite by adding support of aarch64

Signed-off-by: Vaneet Narang 
Signed-off-by: Maninder Singh 
---
 testsuite/reloc2.sh |2 +-
 testsuite/reloc8.sh |2 +-
 testsuite/reloc9.sh |2 +-
 testsuite/tls3.sh   |2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/testsuite/reloc2.sh b/testsuite/reloc2.sh
index b21d535..846182e 100755
--- a/testsuite/reloc2.sh
+++ b/testsuite/reloc2.sh
@@ -2,7 +2,7 @@
 . `dirname $0`/functions.sh
 SHFLAGS=
 case "`$RUN uname -m`" in
-  ia64|ppc*|x86_64|mips*|arm*) SHFLAGS=-fpic;; # Does not support non-pic 
shared libs
+  ia64|ppc*|x86_64|mips*|arm*|aarch64) SHFLAGS=-fpic;; # Does not support 
non-pic shared libs
   s390*) if file reloc1lib1.so | grep -q 64-bit; then SHFLAGS=-fpic; fi;;
 esac
 # Disable this test under SELinux if textrel
diff --git a/testsuite/reloc8.sh b/testsuite/reloc8.sh
index 46382af..c2644f4 100755
--- a/testsuite/reloc8.sh
+++ b/testsuite/reloc8.sh
@@ -13,7 +13,7 @@ rm -f reloc8 reloc8lib*.so reloc8.log
 rm -f prelink.cache
 NOCOPYRELOC=-Wl,-z,nocopyreloc
 case "`$RUN uname -m`" in
-  x86_64|s390*|sparc*) if file reloc1lib1.so | grep -q 64-bit; then 
NOCOPYRELOC=; fi;;
+  x86_64|s390*|sparc*|aarch64) if file reloc1lib1.so | grep -q 64-bit; then 
NOCOPYRELOC=; fi;;
 esac
 $RUN_HOST $CC -shared -O2 -Wl,-z,nocombreloc -fpic -o reloc8lib1.so 
$srcdir/reloc3lib1.c
 $RUN_HOST $CC -shared -O2 -Wl,-z,nocombreloc -fpic -o reloc8lib2.so 
$srcdir/reloc1lib2.c reloc8lib1.so
diff --git a/testsuite/reloc9.sh b/testsuite/reloc9.sh
index 4350c30..33d2845 100755
--- a/testsuite/reloc9.sh
+++ b/testsuite/reloc9.sh
@@ -13,7 +13,7 @@ rm -f reloc9 reloc9lib*.so reloc9.log
 rm -f prelink.cache
 NOCOPYRELOC=-Wl,-z,nocopyreloc
 case "`$RUN uname -m`" in
-  x86_64|s390*|sparc*) if file reloc1lib1.so | grep -q 64-bit; then 
NOCOPYRELOC=; fi;;
+  x86_64|s390*|sparc*|aarch64) if file reloc1lib1.so | grep -q 64-bit; then 
NOCOPYRELOC=; fi;;
 esac
 $RUN_HOST $CC -shared -O2 -Wl,-z,nocombreloc -fpic -o reloc9lib1.so 
$srcdir/reloc3lib1.c
 $RUN_HOST $CC -shared -O2 -Wl,-z,nocombreloc -fpic -o reloc9lib2.so 
$srcdir/reloc1lib2.c reloc9lib1.so
diff --git a/testsuite/tls3.sh b/testsuite/tls3.sh
index eb6e626..cfab235 100755
--- a/testsuite/tls3.sh
+++ b/testsuite/tls3.sh
@@ -9,7 +9,7 @@ if [ "x$CROSS" = "x" ]; then
 fi
 SHFLAGS=
 case "`$RUN uname -m`" in
-  ia64|ppc*|x86_64|alpha*|s390*|mips*|arm*) SHFLAGS=-fpic;; # Does not support 
non-pic shared libs
+  ia64|ppc*|x86_64|alpha*|s390*|mips*|arm*|aarch64) SHFLAGS=-fpic;; # Does not 
support non-pic shared libs
 esac
 # Disable this test under SELinux if textrel
 if test -z "$SHFLAGS" -a -x /usr/sbin/getenforce; then
-- 
1.7.1

-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


[yocto] [prelink-cross][PATCH 0/2] aarch64 fixes reported by testsuite failures

2015-11-26 Thread Maninder Singh
aarch64 fixes reported by testsuite failures

To work this we need to copy all required system libs
in testsuite directory, and at our set-up we copied
below libs:-
1. ld-linux-aarch64.so.1
2. libc.so.6
3. libgcc_s.so.1
4. libm.so.6
5. libstdc++.so.6

root# make check
make  check-TESTS
make[1]: Entering directory 'prelink-cross/testsuite'
make[2]: Entering directory 'prelink-cross/testsuite'
SKIP: movelibs.sh
PASS: reloc1.sh
PASS: reloc2.sh
PASS: reloc3.sh
SKIP: reloc4.sh
SKIP: reloc5.sh
PASS: reloc6.sh
PASS: reloc7.sh
PASS: reloc8.sh
PASS: reloc9.sh
PASS: reloc10.sh
PASS: reloc11.sh
PASS: shuffle1.sh
PASS: shuffle2.sh
PASS: shuffle3.sh
PASS: shuffle4.sh
PASS: shuffle5.sh
PASS: shuffle6.sh
PASS: shuffle7.sh
PASS: shuffle8.sh
PASS: shuffle9.sh
PASS: undo1.sh
PASS: layout1.sh
PASS: layout2.sh
FAIL: unprel1.sh
PASS: tls1.sh
PASS: tls2.sh
PASS: tls3.sh
PASS: tls4.sh
PASS: tls5.sh
PASS: tls6.sh
PASS: tls7.sh
PASS: cxx1.sh
PASS: cxx2.sh
PASS: cxx3.sh
FAIL: quick1.sh
FAIL: quick2.sh
FAIL: quick3.sh
PASS: cycle1.sh
PASS: cycle2.sh
FAIL: deps1.sh
FAIL: deps2.sh
SKIP: ifunc1.sh
SKIP: ifunc2.sh
SKIP: ifunc3.sh
PASS: undosyslibs.sh
FAIL: preload1.sh

Testsuite summary for

# TOTAL: 47
# PASS:  34
# SKIP:  6
# XFAIL: 0
# FAIL:  7
# XPASS: 0
# ERROR: 0

Maninder Singh (2):
  testsuite: fixes in testsuite according to aarch64
  src/arch-aarch64.c:testsuite failure fixes in aarch64

 src/arch-aarch64.c  |7 ---
 testsuite/reloc2.sh |2 +-
 testsuite/reloc8.sh |2 +-
 testsuite/reloc9.sh |2 +-
 testsuite/tls3.sh   |2 +-
 5 files changed, 8 insertions(+), 7 deletions(-)

-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


[yocto] [prelink-cross][PATCH 1/1] configure.ac: with new automake make is not working

2015-11-17 Thread Maninder Singh
with automake verisoin(GNU automake) 1.15 (checked on aarch64),
make is not working and looping at below info:-

configure.ac:8: warning: AM_INIT_AUTOMAKE: two- and three-arguments
forms are deprecated.  For more info, see:
configure.ac:8:
http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
 cd . && /bin/sh ./config.status Makefile
config.status: creating Makefile
make: Warning: File 'Makefile.am' has modification time 539 s in the
future

Thus changing configure.ac as given in above link.

Signed-off-by: Vaneet Narang 
Signed-off-by: Maninder Singh 
---
 configure.ac |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4943932..791b8bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,11 +1,12 @@
 dnl Process this file with autoconf to produce a configure script. -*-m4-*-
-AC_INIT(src/prelink.c)
+AC_INIT([prelink], [0.0])
+AC_CONFIG_SRCDIR(src/prelink.c)
 AC_CONFIG_HEADERS(config.h)
 AC_PREREQ(2.50)dnl Minimum Autoconf version required.
 AC_CANONICAL_SYSTEM
 AC_ARG_PROGRAM
 
-AM_INIT_AUTOMAKE([prelink], [0.0])
+AM_INIT_AUTOMAKE
 
 ALL_LINGUAS=
 
-- 
1.7.1

-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] [prelink-cross][PATCH 1/1] rtld.c: LD_PRELOAD bugfix

2015-11-09 Thread Maninder Singh
Hello,

>On 11/7/15 5:24 AM, Maninder Singh wrote:
>> Hi,
>> Ping
>
>I'd gotten a msg after this to hold off and wait for an update.  Is this the
>updated version of the fix?
>
>--Mark

Yes, we send message for update a fix for LD_PRELOAD implemntation in prelink:-
https://lists.yoctoproject.org/pipermail/yocto/2015-September/026431.html
 (LD_PRELOAD implemntation patch, which is merged with prelink_cross project)

and this below patch fixes  bug in LD_PRELOAD patch (yes this is updated 
version of fix).

>>> This patch do following things:-
>>> 1.  Fixes bug of adding preloaded libs in search scope of dependent 
>>> libraries which results in search scope of few symbols becomes 
>>> same for executable and library, so conflict doesn't occur for 
>>> those symbols and hence resulted in less number of conflicts.
>>> 2.  Reduce code redundancy.
>>> 3.  Buffer Overflow fix.
>>>
>>> Signed-off-by: Maninder Singh 
>>> Signed-off-by: Vaneet Narang 
>>> Reviewed-by: Doha Hwang 
>>> ---
>>> trunk/src/rtld/rtld.c |   27 ---
>>> 1 files changed, 16 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/trunk/src/rtld/rtld.c b/trunk/src/rtld/rtld.c
>>> index 50461b6..8af5052 100644
>>> --- a/trunk/src/rtld/rtld.c
>>> +++ b/trunk/src/rtld/rtld.c
>>> @@ -606,7 +606,7 @@ load_dsos (DSO *dso, int host_paths)
>>> {
>>>   struct dso_list *dso_list, *dso_list_tail, *cur_dso_ent, *new_dso_ent;
>>>   struct stat64 st;
>>> -  int total_preload = 0;
>>> +  int total_preload = 0, temp_total_preload = 0;
>>>   char * libname[MAX_PRELOADED_LIBS] = {NULL};
>>>
>>>   /* Assume it's static unless we find DT_NEEDED entries */
>>> @@ -632,19 +632,19 @@ load_dsos (DSO *dso, int host_paths)
>>>
>>>   if(dso->ehdr.e_type == ET_EXEC && ld_preload) {
>>>   char *next_lib =  ld_preload;
>>> -  libname[total_preload] = ld_preload;
>>> -  total_preload++;
>>> -  next_lib=strchr(ld_preload,':');
>>> -  while(next_lib!=NULL){
>>> - *next_lib = '\0';
>>> - next_lib++;
>>> - libname[total_preload] = next_lib;
>>> - total_preload++;
>>> - next_lib=strchr(next_lib,':');
>>> -  }
>>> +  while(*next_lib != '\0' && (total_preload < MAX_PRELOADED_LIBS)){
>>> +libname[total_preload++] = next_lib;
>>> +next_lib=strchrnul(next_lib,':');
>>> +if(*next_lib == '\0')
>>> +  break;
>>> +*next_lib = '\0';
>>> +next_lib++;
>>> + }
>>> +temp_total_preload = total_preload;
>>>   }
>>>   else {
>>>   total_preload = 0;
>>> +  temp_total_preload = 0;
>>>   }
>>>   while (cur_dso_ent != NULL)
>>> {
>>> @@ -666,6 +666,11 @@ load_dsos (DSO *dso, int host_paths)
>>> {
>>>   int ndx, maxndx;
>>>   maxndx = data->d_size / cur_dso->shdr[cur_dso->dynamic].sh_entsize;
>>> +  if(!(cur_dso->ehdr.e_type == ET_EXEC))
>>> +total_preload = 0;
>>> +  else
>>> +total_preload = temp_total_preload;
>>> +
>>>   for (ndx = 0; ndx < maxndx + total_preload; ++ndx)
>>> {
>>>
>>> -- 
>>> 1.7.1

This patch is a fix to a bug of below commit (addition of new --ld-preload 
option):-
http://git.yoctoproject.org/cgit/cgit.cgi/prelink-cross/commit/?h=cross_prelink&id=3199ee4ebfc37288391e169825b75fa80c6136a3
and applicable after this commit


Thanks,
Maninder Singh
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] [prelink-cross][PATCH 1/1] rtld.c: LD_PRELOAD bugfix

2015-11-07 Thread Maninder Singh
Hi,
Ping

>This patch do following things:-
>1. Fixes bug of adding preloaded libs in search scope of dependent 
>   libraries which results in search scope of few symbols becomes 
>   same for executable and library, so conflict doesn't occur for 
>   those symbols and hence resulted in less number of conflicts.
>2. Reduce code redundancy.
>3. Buffer Overflow fix.
>
>Signed-off-by: Maninder Singh 
>Signed-off-by: Vaneet Narang 
>Reviewed-by: Doha Hwang 
>---
> trunk/src/rtld/rtld.c |   27 ---
> 1 files changed, 16 insertions(+), 11 deletions(-)
>
>diff --git a/trunk/src/rtld/rtld.c b/trunk/src/rtld/rtld.c
>index 50461b6..8af5052 100644
>--- a/trunk/src/rtld/rtld.c
>+++ b/trunk/src/rtld/rtld.c
>@@ -606,7 +606,7 @@ load_dsos (DSO *dso, int host_paths)
> {
>   struct dso_list *dso_list, *dso_list_tail, *cur_dso_ent, *new_dso_ent;
>   struct stat64 st;
>-  int total_preload = 0;
>+  int total_preload = 0, temp_total_preload = 0;
>   char * libname[MAX_PRELOADED_LIBS] = {NULL};
> 
>   /* Assume it's static unless we find DT_NEEDED entries */
>@@ -632,19 +632,19 @@ load_dsos (DSO *dso, int host_paths)
> 
>   if(dso->ehdr.e_type == ET_EXEC && ld_preload) {
>   char *next_lib =  ld_preload;
>-  libname[total_preload] = ld_preload;
>-  total_preload++;
>-  next_lib=strchr(ld_preload,':');
>-  while(next_lib!=NULL){
>-*next_lib = '\0';
>-next_lib++;
>-libname[total_preload] = next_lib;
>-total_preload++;
>-next_lib=strchr(next_lib,':');
>-  }
>+  while(*next_lib != '\0' && (total_preload < MAX_PRELOADED_LIBS)){
>+libname[total_preload++] = next_lib;
>+next_lib=strchrnul(next_lib,':');
>+if(*next_lib == '\0')
>+  break;
>+*next_lib = '\0';
>+next_lib++;
>+ }
>+temp_total_preload = total_preload;
>   }
>   else {
>   total_preload = 0;
>+  temp_total_preload = 0;
>   }
>   while (cur_dso_ent != NULL)
> {
>@@ -666,6 +666,11 @@ load_dsos (DSO *dso, int host_paths)
>   {
> int ndx, maxndx;
> maxndx = data->d_size / cur_dso->shdr[cur_dso->dynamic].sh_entsize;
>+  if(!(cur_dso->ehdr.e_type == ET_EXEC))
>+total_preload = 0;
>+  else
>+total_preload = temp_total_preload;
>+
> for (ndx = 0; ndx < maxndx + total_preload; ++ndx)
>   {
> 
>-- 
>1.7.1
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


[yocto] [PATCH 1/1] prelink: AARCH64 support added

2015-10-30 Thread Maninder Singh
This patch adds support for prelinking in AARCH64.
To run prelink on successfully on target following changes are done
1. aarch64/dl-machine.h: Fix load-address for prelink support 
 https://sourceware.org/ml/libc-alpha/2015-10/msg00575.html
2. To handle relocation R_AARCH64_TLSDESC, Conflicts are raised for 
   R_AARCH64_TLSDESC. 
   Conflicts of relocation type R_AARCH64_TLSDESC is handled by 
   _dl_tlsdesc_undefweak which return the addend minus the thread pointer.
   Hacked _dl_tlsdesc_undefweak to return addend only. Need to Fix this hack.

Signed-off-by: Vaneet Narang 
Signed-off-by: Maninder Singh 
---
 trunk/src/Makefile.am|2 +-
 trunk/src/arch-aarch64.c |  594 ++
 trunk/src/dso.c  |1 +
 3 files changed, 596 insertions(+), 1 deletions(-)
 create mode 100644 trunk/src/arch-aarch64.c

diff --git a/trunk/src/Makefile.am b/trunk/src/Makefile.am
index 7372fc1..d6cc5cb 100644
--- a/trunk/src/Makefile.am
+++ b/trunk/src/Makefile.am
@@ -24,7 +24,7 @@ bin_PROGRAMS = execstack
 
 arch_SOURCES = arch-i386.c arch-alpha.c arch-ppc.c arch-ppc64.c \
   arch-sparc.c arch-sparc64.c arch-x86_64.c arch-mips.c \
-  arch-s390.c arch-s390x.c arch-arm.c arch-sh.c arch-ia64.c
+  arch-s390.c arch-s390x.c arch-arm.c arch-sh.c arch-ia64.c 
arch-aarch64.c
 common_SOURCES = checksum.c data.c dso.c dwarf2.c dwarf2.h fptr.c fptr.h \
 hashtab.c hashtab.h mdebug.c prelink.h stabs.c crc32.c  \
 wrap-file.c canonicalize.c reloc-info.c reloc-info.h
diff --git a/trunk/src/arch-aarch64.c b/trunk/src/arch-aarch64.c
new file mode 100644
index 000..13713b2
--- /dev/null
+++ b/trunk/src/arch-aarch64.c
@@ -0,0 +1,594 @@
+/* Copyright (C) 2001, 2002, 2003, 2004, 2006, 2009 Red Hat, Inc.
+   Written by Jakub Jelinek , 2001.
+   Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+   ARM64 support by Vaneet Narang 
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "prelink.h"
+
+/* The aarch64 ABI: 
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0056b/IHI0056B_aaelf64.pdf
+ * documents a "class" value for specific reads and writes.  All this
+ * indicates is that we should be using the ELFCLASS to determine if
+ * this should be a 32/64 bit read/write.  (See table 4.9)
+ *
+ * We emulate this behavior below...
+ */
+#define read_uneclass(DSO, ADDR) \
+( gelf_getclass(DSO->elf) == ELFCLASS32 ? read_une32(DSO, ADDR) : 
read_une64(DSO, ADDR) )
+
+#define write_neclass(DSO, ADDR, VAL) \
+( gelf_getclass(DSO->elf) == ELFCLASS32 ? write_ne32(DSO, ADDR, VAL) : 
write_ne64(DSO, ADDR, VAL) )
+
+#define buf_write_neclass(DSO, BUF, VAL) \
+( gelf_getclass(DSO->elf) == ELFCLASS32 ? buf_write_ne32(DSO, BUF, VAL) : 
buf_write_ne64(DSO, BUF, VAL) )
+
+static int
+aarch64_adjust_dyn (DSO *dso, int n, GElf_Dyn *dyn, GElf_Addr start,
+  GElf_Addr adjust)
+{
+int testec = addr_to_sec (dso, dyn->d_un.d_ptr);
+  if (dyn->d_tag == DT_PLTGOT)
+{
+  int sec = addr_to_sec (dso, dyn->d_un.d_ptr);
+  Elf64_Addr data;
+
+  if (sec == -1)
+   return 0;
+
+  data = read_une64 (dso, dyn->d_un.d_ptr);
+  /* If .got.plt[0] points to _DYNAMIC, it needs to be adjusted.  */
+  if (data == dso->shdr[n].sh_addr && data >= start)
+   write_ne64 (dso, dyn->d_un.d_ptr, data + adjust);
+
+/* AARCH64 Hack  start
+ *
+ * .got section entry is missing in .dynamic section
+ * .got section is previous to .got.plt section.
+ */
+   data = read_une64 (dso, dso->shdr[sec - 1].sh_addr);
+  if (data == dso->shdr[n].sh_addr && data >= start)
+   write_ne64 (dso, dso->shdr[sec - 1].sh_addr, data + adjust);
+/* AARCH64 Hack  end*/ 
+
+  data = read_une64 (dso, dyn->d_un.d_ptr + 8);
+  /* If .got.plt[1] points to .plt + 0x16, it needs to be adjusted.  */
+  if (data && data >= start)
+   {
+ int i;
+
+ for (i = 1; i < dso->ehdr.e_shnum; i++)
+   if (data == dso->shdr[i].sh_addr 
+   && dso->shdr[i].sh_type == SHT_PROGBITS
+

[yocto] [prelink-cross][PATCH 1/1] rtld.c: LD_PRELOAD bugfix

2015-09-21 Thread Maninder Singh
This patch do following things:-
1.  Fixes bug of adding preloaded libs in search scope of dependent 
libraries which results in search scope of few symbols becomes 
same for executable and library, so conflict doesn't occur for 
those symbols and hence resulted in less number of conflicts.
2.  Reduce code redundancy.
3.  Buffer Overflow fix.

Signed-off-by: Maninder Singh 
Signed-off-by: Vaneet Narang 
Reviewed-by: Doha Hwang 
---
 trunk/src/rtld/rtld.c |   27 ---
 1 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/trunk/src/rtld/rtld.c b/trunk/src/rtld/rtld.c
index 50461b6..8af5052 100644
--- a/trunk/src/rtld/rtld.c
+++ b/trunk/src/rtld/rtld.c
@@ -606,7 +606,7 @@ load_dsos (DSO *dso, int host_paths)
 {
   struct dso_list *dso_list, *dso_list_tail, *cur_dso_ent, *new_dso_ent;
   struct stat64 st;
-  int total_preload = 0;
+  int total_preload = 0, temp_total_preload = 0;
   char * libname[MAX_PRELOADED_LIBS] = {NULL};
 
   /* Assume it's static unless we find DT_NEEDED entries */
@@ -632,19 +632,19 @@ load_dsos (DSO *dso, int host_paths)
 
   if(dso->ehdr.e_type == ET_EXEC && ld_preload) {
   char *next_lib =  ld_preload;
-  libname[total_preload] = ld_preload;
-  total_preload++;
-  next_lib=strchr(ld_preload,':');
-  while(next_lib!=NULL){
- *next_lib = '\0';
- next_lib++;
- libname[total_preload] = next_lib;
- total_preload++;
- next_lib=strchr(next_lib,':');
-  }
+  while(*next_lib != '\0' && (total_preload < MAX_PRELOADED_LIBS)){
+libname[total_preload++] = next_lib;
+next_lib=strchrnul(next_lib,':');
+if(*next_lib == '\0')
+  break;
+*next_lib = '\0';
+next_lib++;
+ }
+temp_total_preload = total_preload;
   }
   else {
   total_preload = 0;
+  temp_total_preload = 0;
   }
   while (cur_dso_ent != NULL)
 {
@@ -666,6 +666,11 @@ load_dsos (DSO *dso, int host_paths)
{
  int ndx, maxndx;
  maxndx = data->d_size / cur_dso->shdr[cur_dso->dynamic].sh_entsize;
+  if(!(cur_dso->ehdr.e_type == ET_EXEC))
+total_preload = 0;
+  else
+total_preload = temp_total_preload;
+
  for (ndx = 0; ndx < maxndx + total_preload; ++ndx)
{
 
-- 
1.7.1

-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] [prelink-cross] LD_PRELOAD Implementation in Prelink

2015-09-11 Thread Maninder Singh
Hi Mark,

Thanks for checking,

There is one bug in this patch , we will share the fix after testing probably 
on monday.

Thanks
Maninder Singh


>>Merged to the staging branch.

>On 5/18/15 12:17 AM, Maninder Singh wrote:
>> EP-F6AA0618C49C4AEDA73BFF1B39950BAB
>> Hi,
>> 
>> Subject: [PATCH 1/1] LD_PRELOAD Implementation in Prelink
>> 
>> prelink fails if  there are ld_preload libs present at target with below 
>> error.
>>  expect libsX.so.1, found /lib/libY.so in dependency order
>>  where libY.so.1 is ld_preload lib
>>  
>> To use this feature :
>> ./prelink --ld-preload=libpreload1.so:libpreload2.so: upto 20 libs
>> Order of libraries to be preloaded is significant. Make sure sequence
>> mentioned in prelink
>> should be same as runtime sequence.
>> 
>> Signed-off-by: Vaneet Narang 
>> Signed-off-by: Maninder Singh 
>> Reviewed-by: Ajeet Yadav 
>> Reviewed-by: Geon-ho Kim 
>> ---
>>  src/gather.c|8 +++-
>>  src/get.c   |9 -
>>  src/main.c  |6 ++
>>  src/prelink.h   |1 +
>>  src/rtld/rtld.c |   51 +--
>>  5 files changed, 67 insertions(+), 8 deletions(-)
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


[yocto] [prelink-cross][PATCH 1/1] rtld: remove if check before free

2015-06-23 Thread Maninder Singh
No need of explicit NULL check before free

Signed-off-by: Maninder Singh 
---
 trunk/src/rtld/rtld.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/trunk/src/rtld/rtld.c b/trunk/src/rtld/rtld.c
index 35dfde7..3ed1db3 100644
--- a/trunk/src/rtld/rtld.c
+++ b/trunk/src/rtld/rtld.c
@@ -1270,7 +1270,6 @@ process_one_dso (DSO *dso, int host_paths)
   (uint32_t) l->l_map_start);
}
 
-  if (filename)
free (filename);
 
   cur_dso_ent = cur_dso_ent->next;
-- 
1.7.1

-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


[yocto] [EDT][prelink-cross] LD_PRELOAD Implementation in Prelink

2015-05-17 Thread Maninder Singh
EP-F6AA0618C49C4AEDA73BFF1B39950BAB
Hi,

Subject: [PATCH 1/1] LD_PRELOAD Implementation in Prelink

prelink fails if  there are ld_preload libs present at target with below error.
expect libsX.so.1, found /lib/libY.so in dependency order
where libY.so.1 is ld_preload lib
 
To use this feature :
./prelink --ld-preload=libpreload1.so:libpreload2.so: upto 20 libs
Order of libraries to be preloaded is significant. Make sure sequence
mentioned in prelink
should be same as runtime sequence.

Signed-off-by: Vaneet Narang 
Signed-off-by: Maninder Singh 
Reviewed-by: Ajeet Yadav 
Reviewed-by: Geon-ho Kim 
---
 src/gather.c|8 +++-
 src/get.c   |9 -
 src/main.c  |6 ++
 src/prelink.h   |1 +
 src/rtld/rtld.c |   51 +--
 5 files changed, 67 insertions(+), 8 deletions(-)

diff --git a/src/gather.c b/src/gather.c
index c3d3128..5ccd243 100644
--- a/src/gather.c
+++ b/src/gather.c
@@ -61,7 +61,7 @@ gather_deps (DSO *dso, struct prelink_entry *ent)
 {
   int i, j, seen = 0;
   FILE *f = NULL;
-  const char *argv[6];
+  const char *argv[8];
   const char *envp[5];
   char *line = NULL, *p, *q = NULL;
   const char **depends = NULL;
@@ -74,6 +74,7 @@ gather_deps (DSO *dso, struct prelink_entry *ent)
   int nliblist = 0;
   const char *dl;
   const char *ent_filename;
+  int etype = dso->ehdr.e_type;
 
   if (check_dso (dso))
 {
@@ -181,6 +182,11 @@ gather_deps (DSO *dso, struct prelink_entry *ent)
   argv[i++] = "--library-path";
   argv[i++] = ld_library_path;
 }
+
+  if(etype == ET_EXEC && ld_preload) {
+  argv[i++] = "--ld-preload";
+  argv[i++] = ld_preload;
+  }
   argv[i++] = "--target-paths";
   argv[i++] = ent_filename;
   argv[i] = NULL;
diff --git a/src/get.c b/src/get.c
index 6a63f02..043af22 100644
--- a/src/get.c
+++ b/src/get.c
@@ -641,12 +641,13 @@ prelink_get_relocations (struct prelink_info *info)
 {
   FILE *f;
   DSO *dso = info->dso;
-  const char *argv[6];
+  const char *argv[8];
   const char *envp[4];
   int i, ret, status;
   char *p;
   const char *dl = dynamic_linker ?: dso->arch->dynamic_linker;
   const char *ent_filename;
+  int etype = info->dso->ehdr.e_type;
 
   if (info->ent->type == ET_DYN)
 {
@@ -709,6 +710,12 @@ prelink_get_relocations (struct prelink_info *info)
   argv[i++] = "--library-path";
   argv[i++] = ld_library_path;
 }
+
+  if(etype == ET_EXEC && ld_preload) {
+  argv[i++] = "--ld-preload";
+  argv[i++] = ld_preload;
+  }  
+
   argv[i++] = "--target-paths";
   argv[i++] = ent_filename;
   argv[i] = NULL;
diff --git a/src/main.c b/src/main.c
index 15c1d53..a99816d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -59,6 +59,7 @@ const char *ld_library_path;
 const char *prelink_conf = PRELINK_CONF;
 const char *prelink_cache = PRELINK_CACHE;
 const char *undo_output;
+char *ld_preload = NULL;
 int noreexecinit;
 time_t initctime;
 
@@ -84,6 +85,7 @@ static char argp_doc[] = PRELINK_PROG " -- program to 
relocate and prelink ELF s
 #define OPT_SYSROOT0x8d
 #define OPT_RTLD   0x8e
 #define OPT_ALLOW_TEXTREL  0x8f
+#define OPT_LD_PRELOAD  0x90
 
 static struct argp_option options[] = {
   {"all",  'a', 0, 0,  "Prelink all binaries" },
@@ -123,6 +125,7 @@ static struct argp_option options[] = {
   {"rtld", OPT_RTLD, "RTLD", OPTION_HIDDEN, "" },
   {"init", 'i', 0, 0,  "Do not re-execute init" },
   {"allow-textrel",OPT_ALLOW_TEXTREL, 0, 0, "Allow text relocations even 
on architectures where they may not work" },
+  {"ld-preload",   OPT_LD_PRELOAD, "LIBLIST", 0,  "List of libraries 
preloaded on target" },
   { 0 }
 };
 
@@ -250,6 +253,9 @@ parse_opt (int key, char *arg, struct argp_state *state)
 case OPT_ALLOW_TEXTREL:
   allow_bad_textrel = 1;
   break;
+case OPT_LD_PRELOAD:
+  ld_preload = arg;
+  break;
 default:
   return ARGP_ERR_UNKNOWN;
 }
diff --git a/src/prelink.h b/src/prelink.h
index 66aba99..a6ce607 100644
--- a/src/prelink.h
+++ b/src/prelink.h
@@ -597,6 +597,7 @@ extern enum verify_method_t verify_method;
 extern int quick;
 extern long long seed;
 extern GElf_Addr mmap_reg_start, mmap_reg_end, layout_page_size;
+extern char *ld_preload;
 
 extern const char *sysroot;
 
diff --git a/src/rtld/rtld.c b/src/rtld/rtld.c
index 2ad3ade..f014bea 100644
--- a/src/rtld/rtld.c
+++ b/src/rtld/rtld.c
@@ -47,6 +47,7 @@ unsigned int _dl_debug_mask = 0;
 /* LD_DYNAMIC_WEAK option.  Default is off, changing to 1
is equivalent to setting LD_DYNAMIC_WEAK. */
 unsigned int _dl_dynamic_weak

[yocto] [EDT][prelink-cross][PATCH 1/1] bugifx for soname mismatch

2015-05-17 Thread Maninder Singh
EP-F6AA0618C49C4AEDA73BFF1B39950BAB

Hi,

Subject: [PATCH 1/1] bugifx for soname mismatch

As per my understanding, this issue needs to be fixed in loader, But if can not 
be fixed 
then there is work around for following issue.

Issue case:-
1. Create a library libB.so having soname libB.so
2. At compile time we linked libB.so to binary, and thus in NEEDED section it 
will show libB.so
gcc test.c -o test -lB
3. Now create a softlink as below:-
ln -sf libA.so libB.so
(libB.so -> libA.so)
4. No when we do prelink, Library list section '.gnu.liblist' contains  entries 
as below:
0: libA.so  2014-12-02T04:28:40 0x95c929e5 0   0 
//SONAME
5. And at run time prelink will be failed because of dependency mismatch due to 
soname issue.
expect libA.so, found /lib/libB.so in dependency order
prelink checking: failed

Issue is prelink fills soname in gnu.liblist section but loader uses filename 
not soname.So we
created a workaround for this issue.

To use filename instead of soname in gnu.liblist
Usage :./prelink -s or ./prelink --ignore-soname


Signed-off-by: Maninder Singh 
Signed-off-by: Vaneet Narang 
Reviewed-by: Ajeet Yadav 
Reviewed-by: Geon-ho Kim 
---
 src/get.c |2 ++
 src/main.c|5 +
 src/prelink.h |1 +
 3 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/get.c b/src/get.c
index ffefe73..bb01331 100644
--- a/src/get.c
+++ b/src/get.c
@@ -182,6 +182,8 @@ prelink_record_relocations (struct prelink_info *info, FILE 
*f,
}
}
}
+  if(ignore_soname) 
+  soname = strrchr(filename, '/') + 1;
 
   if (! tdeps)
deps[0].ent = info->ent;
diff --git a/src/main.c b/src/main.c
index 15c1d53..5891dbc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -61,6 +61,7 @@ const char *prelink_cache = PRELINK_CACHE;
 const char *undo_output;
 int noreexecinit;
 time_t initctime;
+int ignore_soname = 0;
 
 const char *argp_program_version = PRELINK_PROG PKGVERSION " 1.0";
 
@@ -123,6 +124,7 @@ static struct argp_option options[] = {
   {"rtld", OPT_RTLD, "RTLD", OPTION_HIDDEN, "" },
   {"init", 'i', 0, 0,  "Do not re-execute init" },
   {"allow-textrel",OPT_ALLOW_TEXTREL, 0, 0, "Allow text relocations even 
on architectures where they may not work" },
+  {"ignore-soname",'s', 0, 0,  "To use filename instead of soname in 
gnu.liblist" },
   { 0 }
 };
 
@@ -250,6 +252,9 @@ parse_opt (int key, char *arg, struct argp_state *state)
 case OPT_ALLOW_TEXTREL:
   allow_bad_textrel = 1;
   break;
+case 's':
+  ignore_soname = 1;
+  break; 
 default:
   return ARGP_ERR_UNKNOWN;
 }
diff --git a/src/prelink.h b/src/prelink.h
index 66aba99..778e67a 100644
--- a/src/prelink.h
+++ b/src/prelink.h
@@ -597,6 +597,7 @@ extern enum verify_method_t verify_method;
 extern int quick;
 extern long long seed;
 extern GElf_Addr mmap_reg_start, mmap_reg_end, layout_page_size;
+extern int ignore_soname;
 
 extern const char *sysroot;
 
-- 
1.7.1


Thanks 
Maninder Singh
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


[yocto] [EDT][prelink-cross] possible memory leak in opd_size

2015-05-05 Thread Maninder Singh
EP-F6AA0618C49C4AEDA73BFF1B39950BAB

Hi,

we found one issue through code-walk through
and it seems we are creating unusable OPD table , Not sure about fix, please 
check below fix. 

Signed-off-by: Vaneet Narang 
Signed-off-by: Maninder Singh 
Reviewed-by: Ajeet Yadav 
---
 trunk/src/fptr.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/trunk/src/fptr.c b/trunk/src/fptr.c
index cfe3aed..39271d5 100644
--- a/trunk/src/fptr.c
+++ b/trunk/src/fptr.c
@@ -458,6 +458,7 @@ opd_size (struct prelink_info *info, GElf_Word entsize)
e->val = f->val;
e->gp = f->gp;
e->opd = ret | OPD_ENT_NEW;
+   f->ent = e;
ret += entsize;
   }

--
1.7.1


Thanks and Regards,
Maninder Singh
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


[yocto] [EDT][prelink-cross][PATCH] cleanup code

2015-05-05 Thread Maninder Singh
EP-F6AA0618C49C4AEDA73BFF1B39950BAB
Hi,

Remove dso NULL check because before calling this API
already checking for dso NULL and also dso pointer is used before this check.

Signed-off-by: Akhilesh Kumar 
Reviewed-by: Ajeet Yadav 
---
 trunk/src/gather.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/trunk/src/gather.c b/trunk/src/gather.c
index c3d3128..8f310f6 100644
--- a/trunk/src/gather.c
+++ b/trunk/src/gather.c
@@ -561,7 +561,6 @@ make_unprelinkable:

   assert (ent->type == ET_NONE);
   ent->type = ET_UNPRELINKABLE;
-  if (dso)
close_dso (dso);
   return 0;
 }
--
1.7.1

Thanks 
Maninder Singh
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


[yocto] [EDT][PATCH][prelink-cross] dso validation check fix

2015-05-05 Thread Maninder Singh
EP-F6AA0618C49C4AEDA73BFF1B39950BAB
Hi Mark,

dso null pointer check is wrongly placed.


Signed-off-by: Maninder Singh 
Signed-off-by: Vaneet Narang 
Reviewed-by: Ajeet Yadav 
---
 trunk/src/rtld/rtld.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/trunk/src/rtld/rtld.c b/trunk/src/rtld/rtld.c
index 35dfde7..f88ce7f 100644
--- a/trunk/src/rtld/rtld.c
+++ b/trunk/src/rtld/rtld.c
@@ -479,13 +479,13 @@ find_lib_in_path (struct search_path *path, const char 
*soname,
   if (wrap_access (ret, F_OK) == 0)
{
  DSO *dso = open_dso (ret);
+ if (dso == NULL)
+   continue;
   int dso_class = gelf_getclass (dso->elf);
  int dso_machine = (dso_class == ELFCLASS32) ?
elf32_getehdr (dso->elf)->e_machine :
elf64_getehdr (dso->elf)->e_machine;

- if (dso == NULL)
-   continue;

  /* Skip 32-bit libraries when looking for 64-bit.  Also
 skip libraries for alternative machines.  */
--
1.7.1


Thanks and Regards,
Maninder Singh
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


[yocto] [EDT] [PATCH] [prelink-cross] realloc fix memory leak

2015-05-05 Thread Maninder Singh
 EP-F6AA0618C49C4AEDA73BFF1B39950BAB

Hi Mark,

Free previously allocated memory if realloc fails.

Signed-off-by: Maninder Singh 
Signed-off-by: Vaneet narang 
Reviewed-by: Akhilesh Kumar 
---
 trunk/src/doit.c|4 +++-
 trunk/src/gather.c  |4 +++-
 trunk/src/undoall.c |4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/trunk/src/doit.c b/trunk/src/doit.c
index c94fc53..0995fce 100644
--- a/trunk/src/doit.c
+++ b/trunk/src/doit.c
@@ -53,7 +53,7 @@ prelink_ent (struct prelink_entry *ent)
   DSO *dso;
   struct stat64 st;
   struct prelink_link *hardlink;
-  char *move = NULL;
+  char *move = NULL, *move_temp;
   size_t movelen = 0;
 
   for (i = 0; i < ent->ndepends; ++i)
@@ -176,9 +176,11 @@ prelink_ent (struct prelink_entry *ent)
   if (len + sizeof (".#prelink#") > movelen)
{
  movelen = len + sizeof (".#prelink#");
+ move_temp = move;
  move = realloc (move, movelen);
  if (move == NULL)
{
+ free(move_temp);
  error (0, ENOMEM, "Could not hardlink %s to %s",
 hardlink->canon_filename, ent->canon_filename);
  movelen = 0;
diff --git a/trunk/src/gather.c b/trunk/src/gather.c
index c3d3128..733b49f 100644
--- a/trunk/src/gather.c
+++ b/trunk/src/gather.c
@@ -64,7 +64,7 @@ gather_deps (DSO *dso, struct prelink_entry *ent)
   const char *argv[6];
   const char *envp[5];
   char *line = NULL, *p, *q = NULL;
-  const char **depends = NULL;
+  const char **depends = NULL, **depends_temp;
   size_t ndepends = 0, ndepends_alloced = 0;
   size_t len = 0;
   ssize_t n;
@@ -261,11 +261,13 @@ gather_deps (DSO *dso, struct prelink_entry *ent)
   if (ndepends == ndepends_alloced)
{
  ndepends_alloced += 10;
+ depends_temp = depends;
  depends =
(const char **) realloc (depends,
 ndepends_alloced * sizeof (char *));
  if (depends == NULL)
{
+ free(depends_temp);
  error (0, ENOMEM, "%s: Could not record dependencies",
 ent->filename);
  goto error_out;
diff --git a/trunk/src/undoall.c b/trunk/src/undoall.c
index 90e9240..6163da3 100644
--- a/trunk/src/undoall.c
+++ b/trunk/src/undoall.c
@@ -33,7 +33,7 @@ undo_one (void **p, void *info)
   DSO *dso;
   struct stat64 st;
   struct prelink_link *hardlink;
-  char *move = NULL;
+  char *move = NULL, *move_temp;
   size_t movelen = 0;
 
   if (ent->done != 2)
@@ -116,9 +116,11 @@ undo_one (void **p, void *info)
   if (len + sizeof (".#prelink#") > movelen)
{
  movelen = len + sizeof (".#prelink#");
+ move_temp = move;
  move = realloc (move, movelen);
  if (move == NULL)
{
+ free(move_temp);
  error (0, ENOMEM, "Could not hardlink %s to %s",
 hardlink->canon_filename, ent->canon_filename);
  movelen = 0;
-- 
1.7.1


Thanks and Regards,
Maninder Singh
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] [prelink-cross][PATCH 1/1] debug message for dependencies not found

2015-04-07 Thread Maninder Singh
Hi Mark,

We have checked the commit on cross_prelik_staging, it is correct But i did one 
typo error Please correct following:-
Just change Reviewed-by: Ajeet Yadav 
to
Reviewed-by: Ajeet Yadav  for voth patches.
Typo arror for ajeet.v ---> ajeet.y
Thanks
Maninder Singh
>This and the other patch have been merged onto the cross_prelink_staging 
>branch.

>Please test that I merged it properly.  (Everything passed my basic testing, 
>but
>I haven't run it against any ARM/HF libraries or similar.)

>--Mark

On 4/6/15 4:07 AM, Maninder Singh wrote:
> Hi,
> Same mail sent earlier Changing subject line, By mistake shared subject line 
> of other patch.
> 
> prelink gives below error message for failure dependency:
> ./prelink: /test_binary: Could not find one of the dependencies
> 
> This provides name of dependent library which is missing like below:
> ./prelink: /test_binary: Could not find one of the dependencies:
> ./prelink-rtld: error while loading shared libraries: libB.so: cannot open 
> shared object file: No such file or directory
> where libB.so is missing dependecy
> 
> Signed-off-by: Maninder Singh 
> Signed-off-by: Vaneet Narang 
> Reviewed-by: Ajeet Yadav 
> Reviewed-by: Geon-ho Kim 
> ---
>  src/gather.c |4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gather.c b/src/gather.c
> index 5ccd243..4a3f428 100644
> --- a/src/gather.c
> +++ b/src/gather.c
> @@ -240,8 +240,8 @@ gather_deps (DSO *dso, struct prelink_entry *ent)
>   if (q != NULL)
> {
>   error (0, 0,
> -"%s: Could not find one of the dependencies",
> -ent->filename);
> +"%s: Could not find one of the dependencies:\n%s",
> +ent->filename, line);
>   goto error_out;
> }
> }
> --
> 
> 
> Thanks 
> Maninder Singh
> 
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


[yocto] [prelink-cross][PATCH 1/1] debug message for dependencies not found

2015-04-06 Thread Maninder Singh
Hi,
Same mail sent earlier Changing subject line, By mistake shared subject line of 
other patch.

prelink gives below error message for failure dependency:
./prelink: /test_binary: Could not find one of the dependencies

This provides name of dependent library which is missing like below:
./prelink: /test_binary: Could not find one of the dependencies:
./prelink-rtld: error while loading shared libraries: libB.so: cannot open 
shared object file: No such file or directory
where libB.so is missing dependecy

Signed-off-by: Maninder Singh 
Signed-off-by: Vaneet Narang 
Reviewed-by: Ajeet Yadav 
Reviewed-by: Geon-ho Kim 
---
 src/gather.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gather.c b/src/gather.c
index 5ccd243..4a3f428 100644
--- a/src/gather.c
+++ b/src/gather.c
@@ -240,8 +240,8 @@ gather_deps (DSO *dso, struct prelink_entry *ent)
  if (q != NULL)
{
  error (0, 0,
-"%s: Could not find one of the dependencies",
-ent->filename);
+"%s: Could not find one of the dependencies:\n%s",
+ent->filename, line);
  goto error_out;
    }
    }
--


Thanks 
Maninder Singh

-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


[yocto] [prelink-cross] [PATCH 1/1] debug-for-missing-loader-and-libc

2015-04-06 Thread Maninder Singh
Hi,

During cross prelink if we miss out ld-linux.so.* or libc.so.* It prints below 
info:
./prelink: /test_binary: Could not parse `prelink-rtld: dl-version.c:219: 
rtld_check_map_versions:
 Assertion `needed != ((void *)0)' failed.'

And thus we miss actual cause for this failure,  by this patch we will know 
failure reason.
./prelink: /test_binary: Could not parse `./prelink-rtld: error while loading 
shared libraries: ld-linux.so.3'
(In this case ld-linux.so.3 was missing)

Signed-off-by: Maninder Singh 
Signed-off-by: Vaneet Narang 
Reviewed-by: Ajeet Yadav 
Reviewed-by: Geon-ho Kim 
---
 src/rtld/dl-version.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/rtld/dl-version.c b/src/rtld/dl-version.c
index e4040a6..eb62943 100644
--- a/src/rtld/dl-version.c
+++ b/src/rtld/dl-version.c
@@ -216,6 +216,12 @@ _dl_check_map_versions (struct ldlibs_link_map *map, int 
verbose, int trace_mode
  /* If NEEDED is NULL this means a dependency was not found
 and no stub entry was created.  This should never happen.  */
+ if(needed == NULL)
+   {
+ _dl_signal_error (errval, NULL, NULL, strtab + ent->vn_file);
+ printf("error while loading shared libraries: %s", strtab + 
ent->vn_file);
+ exit(0);
+   }
  assert (needed != NULL);
  /* Make sure this is no stub we created because of a missing
--
1.7.1

And also if it is ok we can remove this one --- assert (needed != NULL); 
because we are using exit(0) for (needed==NULL) 

Thanks,
Maninder Singh
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


[yocto] [prelink-cross][PATCH 1/1] debug-for-missing-loader-and-libc

2015-04-06 Thread Maninder Singh
Hi,

prelink gives below error message for failure dependency:
./prelink: /test_binary: Could not find one of the dependencies

This provides name of dependent library which is missing like below:
./prelink: /test_binary: Could not find one of the dependencies:
./prelink-rtld: error while loading shared libraries: libB.so: cannot open 
shared object file: No such file or directory
where libB.so is missing dependecy

Signed-off-by: Maninder Singh 
Signed-off-by: Vaneet Narang 
Reviewed-by: Ajeet Yadav 
Reviewed-by: Geon-ho Kim 
---
 src/gather.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gather.c b/src/gather.c
index 5ccd243..4a3f428 100644
--- a/src/gather.c
+++ b/src/gather.c
@@ -240,8 +240,8 @@ gather_deps (DSO *dso, struct prelink_entry *ent)
  if (q != NULL)
{
  error (0, 0,
-"%s: Could not find one of the dependencies",
-ent->filename);
+"%s: Could not find one of the dependencies:\n%s",
+ent->filename, line);
  goto error_out;
    }
    }
--


Thanks 
Maninder Singh
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] [prelink-cross] [PATCH 1/1] Remove extra check for ld-linux.so.3 in strcmp

2015-03-31 Thread Maninder Singh
Hi Mark,
there is one typo error in this:-
http://git.yoctoproject.org/cgit/cgit.cgi/prelink-cross/commit/?h=cross_prelink_staging&id=fd99a47124b1f1141f2afe4e87da7cb209cc2927
+ src/get.c: Remove extra checkf ro ld-linux.so.3 in strcmp
*** check for *
Thanks
--

Hi Mark,
Sorry for missing ID in Signed-off-by: Maninder Singh 
Signed-off-by: Maninder Singh 

I suggested that change just to remove redundat code.
This looks Ok to me 
http://git.yoctoproject.org/cgit/cgit.cgi/prelink-cross/commit/?h=cross_prelink_staging&id=fd99a47124b1f1141f2afe4e87da7cb209cc2927

Thanks a lot

Maninder Singh

> Hmm, I never saw the original email (or thread).

(I have no record of ever receiving the original email.  How odd...)

> What is the context for this, simply that there are multiple ld-linux.do.3 in
> the same check and remove one or the other is more efficient?
> 
> (I suspect it will be optimized out, but I can make the change quickly 
> enough.)

I have merged the change, slightly different format.

See:

http://git.yoctoproject.org/cgit/cgit.cgi/prelink-cross/commit/?h=cross_prelink_staging&id=fd99a47124b1f1141f2afe4e87da7cb209cc2927

This is in the staging area.

Maninder if this is ok, I'm more then happy to add your signed-off-by line to
the commit before moving it into the cross_prelink branch.

Thanks!
--Mark

> --Mark
> 
> On 3/31/15 1:01 PM, Khem Raj wrote:
>>
>>> On Mar 30, 2015, at 8:14 PM, Maninder Singh >>> > wrote:
>>>
>>> Hi,
>>>
>>>
>>> From 05ab779af24baef957972aa1d2a9e9d29212cc4c Mon Sep 17 00:00:00 2001
>>> From: Maninder Singh >
>>> Date: Thu, 19 Mar 2015 03:02:59 +0530
>>> Subject: [PATCH 1/1] Remove extra check for ld-linux.so.3 in strcmp
>>>   
>>> if (! strcmp (soname, "ld-linux.so.2")
>>>   || ! strcmp (soname, "ld-linux.so.3")  >
>>>   || ! strcmp (soname, "ld.so.1")
>>>   || ! strcmp (soname, "ld-linux-ia64.so.2")
>>>   || ! strcmp (soname, "ld-linux-x86-64.so.2")
>>>   || ! strcmp (soname, "ld64.so.1")
>>>   || ! strcmp (soname, "ld-linux.so.3") --->
>>> redundant code
>>>   || ! strcmp (soname, "ld-linux-armhf.so.3"))
>>>
>>> Signed-off-by: Maninder Singh 
>>>
>>
>> use First Last 
>>
>>> ---
>>> src/get.c |1 -
>>> 1 files changed, 0 insertions(+), 1 deletions(-)
>>> diff --git a/src/get.c b/src/get.c
>>> index 6a63f02..a34668a 100644
>>> --- a/src/get.c
>>> +++ b/src/get.c
>>> @@ -35,7 +35,6 @@ is_ldso_soname (const char *soname)
>>>|| ! strcmp (soname, "ld-linux-ia64.so.2")
>>>|| ! strcmp (soname, "ld-linux-x86-64.so.2")
>>>|| ! strcmp (soname, "ld64.so.1")
>>> -  || ! strcmp (soname, "ld-linux.so.3")
>>>|| ! strcmp (soname, "ld-linux-armhf.so.3"))
>>>  return 1;
>>>return 0;
>>> -- 
>>> 1.7.1
>>>
>>>
>>> Thanks and Regards,
>>> Maninder Singh
>>>
>>> <201503310844012_QKNMBDIF.gif>
>>>
>>> -- 
>>> ___
>>> yocto mailing list
>>> yocto@yoctoproject.org 
>>> https://lists.yoctoproject.org/listinfo/yocto
>>
> 
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [yocto] [prelink-cross] [PATCH 1/1] Remove extra check for ld-linux.so.3 in strcmp

2015-03-31 Thread Maninder Singh
Hi Mark,
Sorry for missing ID in Signed-off-by: Maninder Singh 
Signed-off-by: Maninder Singh 

I suggested that change just to remove redundat code.
This looks Ok to me 
http://git.yoctoproject.org/cgit/cgit.cgi/prelink-cross/commit/?h=cross_prelink_staging&id=fd99a47124b1f1141f2afe4e87da7cb209cc2927

Thanks a lot

Maninder Singh

> Hmm, I never saw the original email (or thread).

(I have no record of ever receiving the original email.  How odd...)

> What is the context for this, simply that there are multiple ld-linux.do.3 in
> the same check and remove one or the other is more efficient?
> 
> (I suspect it will be optimized out, but I can make the change quickly 
> enough.)

I have merged the change, slightly different format.

See:

http://git.yoctoproject.org/cgit/cgit.cgi/prelink-cross/commit/?h=cross_prelink_staging&id=fd99a47124b1f1141f2afe4e87da7cb209cc2927

This is in the staging area.

Maninder if this is ok, I'm more then happy to add your signed-off-by line to
the commit before moving it into the cross_prelink branch.

Thanks!
--Mark

> --Mark
> 
> On 3/31/15 1:01 PM, Khem Raj wrote:
>>
>>> On Mar 30, 2015, at 8:14 PM, Maninder Singh >>> > wrote:
>>>
>>> Hi,
>>>
>>>
>>> From 05ab779af24baef957972aa1d2a9e9d29212cc4c Mon Sep 17 00:00:00 2001
>>> From: Maninder Singh >
>>> Date: Thu, 19 Mar 2015 03:02:59 +0530
>>> Subject: [PATCH 1/1] Remove extra check for ld-linux.so.3 in strcmp
>>>   
>>> if (! strcmp (soname, "ld-linux.so.2")
>>>   || ! strcmp (soname, "ld-linux.so.3")  >
>>>   || ! strcmp (soname, "ld.so.1")
>>>   || ! strcmp (soname, "ld-linux-ia64.so.2")
>>>   || ! strcmp (soname, "ld-linux-x86-64.so.2")
>>>   || ! strcmp (soname, "ld64.so.1")
>>>   || ! strcmp (soname, "ld-linux.so.3") --->
>>> redundant code
>>>   || ! strcmp (soname, "ld-linux-armhf.so.3"))
>>>
>>> Signed-off-by: Maninder Singh 
>>>
>>
>> use First Last 
>>
>>> ---
>>> src/get.c |1 -
>>> 1 files changed, 0 insertions(+), 1 deletions(-)
>>> diff --git a/src/get.c b/src/get.c
>>> index 6a63f02..a34668a 100644
>>> --- a/src/get.c
>>> +++ b/src/get.c
>>> @@ -35,7 +35,6 @@ is_ldso_soname (const char *soname)
>>>|| ! strcmp (soname, "ld-linux-ia64.so.2")
>>>|| ! strcmp (soname, "ld-linux-x86-64.so.2")
>>>|| ! strcmp (soname, "ld64.so.1")
>>> -  || ! strcmp (soname, "ld-linux.so.3")
>>>|| ! strcmp (soname, "ld-linux-armhf.so.3"))
>>>  return 1;
>>>return 0;
>>> -- 
>>> 1.7.1
>>>
>>>
>>> Thanks and Regards,
>>> Maninder Singh
>>>
>>> <201503310844012_QKNMBDIF.gif>
>>>
>>> -- 
>>> ___
>>> yocto mailing list
>>> yocto@yoctoproject.org 
>>> https://lists.yoctoproject.org/listinfo/yocto
>>
> 
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


[yocto] [prelink-cross] [PATCH 1/1] Remove extra check for ld-linux.so.3 in strcmp

2015-03-31 Thread Maninder Singh
Title: Samsung Enterprise Portal mySingle

Hi,
From 05ab779af24baef957972aa1d2a9e9d29212cc4c Mon Sep 17 00:00:00 2001From: Maninder Singh <maninder...@samsung.com>Date: Thu, 19 Mar 2015 03:02:59 +0530Subject: [PATCH 1/1] Remove extra check for ld-linux.so.3 in strcmp  if (! strcmp (soname, "ld-linux.so.2")  || ! strcmp (soname, "ld-linux.so.3")  >  || ! strcmp (soname, "ld.so.1")  || ! strcmp (soname, "ld-linux-ia64.so.2")  || ! strcmp (soname, "ld-linux-x86-64.so.2")  || ! strcmp (soname, "ld64.so.1")  || ! strcmp (soname, "ld-linux.so.3") ---> redundant code  || ! strcmp (soname, "ld-linux-armhf.so.3"))Signed-off-by: Maninder Singh ---src/get.c |1 -1 files changed, 0 insertions(+), 1 deletions(-)diff --git a/src/get.c b/src/get.cindex 6a63f02..a34668a 100644--- a/src/get.c+++ b/src/get.c@@ -35,7 +35,6 @@ is_ldso_soname (const char *soname)   || ! strcmp (soname, "ld-linux-ia64.so.2")   || ! strcmp (soname, "ld-linux-x86-64.so.2")   || ! strcmp (soname, "ld64.so.1")-  || ! strcmp (soname, "ld-linux.so.3")   || ! strcmp (soname, "ld-linux-armhf.so.3")) return 1;   return 0;-- 1.7.1Thanks and Regards,Maninder Singh




-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto