This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils 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]

Re: [PATCH] libelf: Drop internal_function from __libelf_set_data_list_rdlock.


On Tue, 2015-02-17 at 21:00 +0300, Alexander Cherepanov wrote:
> Have to use this patch when building 32-bit version of elfutils for the 
> latest round of fuzzing.

Sorry about that. It was introduced by my commit b543cd "libelf: Fix
elf_newdata when raw ELF file/image data is available".

I see there is more stuff broken on i686. Also introduced by me. Sigh.
I am setting up a buildbot to catch these thing earlier in the future.

> __libelf_set_data_list_rdlock from elf_getdata.c is also used in
> elf_newdata.c and even described in libelfP.h. Drop internal_function
> attribute accordingly. This prevented 32-bit builds.

I think this is the wrong way around. The function is still "internal".
Which means we only use it for internal libelf calls and don't export
it. The reason it breaks on i686 is because in that case defining it as
an internal_function changes the calling convention. See lib/eu-config:

#ifdef __i386__
# define internal_function __attribute__ ((regparm (3), stdcall))
#else
# define internal_function /* nothing */
#endif

So instead of dropping it in the implementation, I think we should add
it in the definition.

Does the attach solve your issue?

Thanks,

Mark
From e53fe39faf51b86b79110d78a440e487496a4db5 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mjw@redhat.com>
Date: Wed, 18 Feb 2015 20:51:40 +0100
Subject: [PATCH] libelf: Make __libelf_set_data_list_rdlock an
 internal_function.

__libelf_set_data_list_rdlock from elf_getdata.c is marked as an
internal_function in the implementation, but not in libelfP.h when it
is declared.  Add internal_function to the declaration. This broke
the i686 build.

Reported-by: Alexander Cherepanov <ch3root@openwall.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 libelf/ChangeLog | 4 ++++
 libelf/libelfP.h | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 235b750..5739c77 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,7 @@
+2015-02-18  Mark Wielaard  <mjw@redhat.com>
+
+	* libelfP.h (__libelf_set_data_list_rdlock): Make internal_function.
+
 2015-02-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
 	* elf32_updatenull.c (__elfw2(LIBELFBITS,updatenull_wrlock)): Consider
diff --git a/libelf/libelfP.h b/libelf/libelfP.h
index 0ad4071..3f4d654 100644
--- a/libelf/libelfP.h
+++ b/libelf/libelfP.h
@@ -537,7 +537,7 @@ extern Elf_Data *__elf_rawdata_internal (Elf_Scn *__scn, Elf_Data *__data)
    raw data available.  Might upgrade the ELF lock from a read to a
    write lock.  If the lock is already a write lock set wrlocked.  */
 extern void __libelf_set_data_list_rdlock (Elf_Scn *scn, int wrlocked)
-  attribute_hidden;
+     internal_function;
 extern char *__elf_strptr_internal (Elf *__elf, size_t __index,
 				    size_t __offset) attribute_hidden;
 extern Elf_Data *__elf32_xlatetom_internal (Elf_Data *__dest,
-- 
1.8.3.1


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