All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [prelink-cross][PATCH 1/1] rtld.c: LD_PRELOAD bugfix
@ 2015-11-10  1:05 Maninder Singh
  0 siblings, 0 replies; 4+ messages in thread
From: Maninder Singh @ 2015-11-10  1:05 UTC (permalink / raw)
  To: Mark Hatle; +Cc: Vaneet Narang, yocto, PANKAJ MISHRA

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 <maninder1.s@samsung.com>
>>> Signed-off-by: Vaneet Narang <v.narang@samsung.com>
>>> Reviewed-by: Doha Hwang <doha.hwang@samsung.com>
>>> ---
>>> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [prelink-cross][PATCH 1/1] rtld.c: LD_PRELOAD bugfix
  2015-11-07 11:24 Maninder Singh
@ 2015-11-09 14:43 ` Mark Hatle
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Hatle @ 2015-11-09 14:43 UTC (permalink / raw)
  To: maninder1.s; +Cc: Vaneet Narang, yocto, PANKAJ MISHRA

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

>> 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 <maninder1.s@samsung.com>
>> Signed-off-by: Vaneet Narang <v.narang@samsung.com>
>> Reviewed-by: Doha Hwang <doha.hwang@samsung.com>
>> ---
>> 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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [prelink-cross][PATCH 1/1] rtld.c: LD_PRELOAD bugfix
@ 2015-11-07 11:24 Maninder Singh
  2015-11-09 14:43 ` Mark Hatle
  0 siblings, 1 reply; 4+ messages in thread
From: Maninder Singh @ 2015-11-07 11:24 UTC (permalink / raw)
  To: mark.hatle; +Cc: Vaneet Narang, yocto, PANKAJ MISHRA

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 <maninder1.s@samsung.com>
>Signed-off-by: Vaneet Narang <v.narang@samsung.com>
>Reviewed-by: Doha Hwang <doha.hwang@samsung.com>
>---
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [prelink-cross][PATCH 1/1] rtld.c: LD_PRELOAD bugfix
@ 2015-09-22  4:59 Maninder Singh
  0 siblings, 0 replies; 4+ messages in thread
From: Maninder Singh @ 2015-09-22  4:59 UTC (permalink / raw)
  To: mark.hatle; +Cc: v.narang, yocto, Maninder Singh, pankaj.m

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 <maninder1.s@samsung.com>
Signed-off-by: Vaneet Narang <v.narang@samsung.com>
Reviewed-by: Doha Hwang <doha.hwang@samsung.com>
---
 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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-10  1:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-10  1:05 [prelink-cross][PATCH 1/1] rtld.c: LD_PRELOAD bugfix Maninder Singh
  -- strict thread matches above, loose matches on Subject: below --
2015-11-07 11:24 Maninder Singh
2015-11-09 14:43 ` Mark Hatle
2015-09-22  4:59 Maninder Singh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.