[Lsb-messages] /var/www/bzr/lsb/4.1/misc-test r2262: Backport ELFOSABI_LINUX change from devel.

Jeff Licquia licquia at linuxfoundation.org
Mon Aug 6 23:55:28 UTC 2012


------------------------------------------------------------
revno: 2262
committer: Jeff Licquia <licquia at linuxfoundation.org>
branch nick: misc-test
timestamp: Mon 2012-08-06 19:55:28 -0400
message:
  Backport ELFOSABI_LINUX change from devel.
modified:
  appchk/check_file.c
  archk/check_archive.c
  elfchk/elfchk.c
  elfchk/hdr.c
  elfchk/hdr.h
  libchk/libchk.c
  rpmchk/archive.c
-------------- next part --------------
=== modified file 'appchk/check_file.c'
--- a/appchk/check_file.c	2008-06-25 13:25:13 +0000
+++ b/appchk/check_file.c	2012-08-06 23:55:28 +0000
@@ -72,7 +72,7 @@
   Elf_Shdr	*hdr1;
 
   /* Check all headers in extra lib */
-  if (checkElfhdr(elffile, fileType, journal) != ELF_ERROR) {
+  if (checkElfhdr(elffile, fileType, journal, 1) != ELF_ERROR) {
 
     /* Search through program headers for the one with the dynamic
        symbols in it. */

=== modified file 'archk/check_archive.c'
--- a/archk/check_archive.c	2008-12-02 21:27:32 +0000
+++ b/archk/check_archive.c	2012-08-06 23:55:28 +0000
@@ -153,7 +153,7 @@
     elffile->addr += offset;
     /* At this point, we think we are now pointing to an ELF object */
 
-    checkElfhdr(elffile, ELF_IS_OBJ, journal);
+    checkElfhdr(elffile, ELF_IS_OBJ, journal, 1);
 
     return 1;
 }

=== modified file 'elfchk/elfchk.c'
--- a/elfchk/elfchk.c	2010-01-27 15:50:43 +0000
+++ b/elfchk/elfchk.c	2012-08-06 23:55:28 +0000
@@ -28,7 +28,7 @@
 	    fprintf(stderr, "elfchk debug set to 0x%x\n", elfchk_debug);
     }
 
-    elf_type = checkElfhdr(file1, isProgram, journal);
+    elf_type = checkElfhdr(file1, isProgram, journal, 1);
 
     /* If wrong architecture, all ELF structures are messed... */
     if (elf_type != ELF_ERROR) {	

=== modified file 'elfchk/hdr.c'
--- a/elfchk/hdr.c	2011-02-26 03:52:38 +0000
+++ b/elfchk/hdr.c	2012-08-06 23:55:28 +0000
@@ -14,13 +14,15 @@
 static char* get_machine_name (unsigned e_machine);
 
 int
-checkElfhdr(ElfFile *file1, Elf_type expect, struct tetj_handle *journal)
+checkElfhdr(ElfFile *file1, Elf_type expect, struct tetj_handle *journal,
+	    int checking_app)
 {
 #define TMP_STRING_SIZE (400)
   char tmp_string[TMP_STRING_SIZE+1];
 Elf_Ehdr *hdr1;
 int elf_type = ELF_UNKNOWN;
 int hdrfield_error;
+int abi_forbidden;
 
 hdr1=(Elf_Ehdr *)file1->addr;
 
@@ -94,15 +96,20 @@
 
 /*
  * EI_OSABI can be either ELFOSABI_SYSV or ELFOSABI_LINUX, 
- * can't use checkhdrident macro for such a check 
+ * but only for system libraries.  We can't use checkhdrident
+ * macro for such a check.
  */
 tetj_tp_count++;
 tetj_purpose_start(journal, tetj_activity_count, tetj_tp_count,
-	"Check header id EI_OSABI is either ELFOSABI_SYSV or ELFOSABI_LINUX");
-if(hdr1->e_ident[EI_OSABI] != ELFOSABI_SYSV && 
-   hdr1->e_ident[EI_OSABI] != ELFOSABI_LINUX ) {
+	"Check header id EI_OSABI for the proper ELFOSABI value");
+abi_forbidden = (hdr1->e_ident[EI_OSABI] != ELFOSABI_SYSV);
+if(!checking_app) {
+    abi_forbidden = abi_forbidden && 
+                    (hdr1->e_ident[EI_OSABI] != ELFOSABI_LINUX);
+ }
+if(abi_forbidden) {
     snprintf( tmp_string, TMP_STRING_SIZE,
-"checkElfhdr: e_ident[EI_OSABI] is neither ELFOSABI_SYSV nor ELFOSABI_LINUX");
+"checkElfhdr: e_ident[EI_OSABI] is not set to an allowable value");
     fprintf(stderr, "%s\n", tmp_string);
     tetj_testcase_info(journal, tetj_activity_count, tetj_tp_count, 0, 0, 0,
                        tmp_string);

=== modified file 'elfchk/hdr.h'
--- a/elfchk/hdr.h	2011-03-02 23:01:15 +0000
+++ b/elfchk/hdr.h	2012-08-06 23:55:28 +0000
@@ -23,7 +23,7 @@
    If its not a program its considered to be shared library */
 /* If ELF type is unknown, the function will return the type of file */
 extern int checkElfhdr(ElfFile *file1, Elf_type expect, 
-                        struct tetj_handle *journal);
+                       struct tetj_handle *journal, int checking_app);
 /* Return the ELF type of the file */
 extern int getElfType(ElfFile *file1);
 #endif /* _ELF_HDR_H */

=== modified file 'libchk/libchk.c'
--- a/libchk/libchk.c	2010-09-01 12:56:42 +0000
+++ b/libchk/libchk.c	2012-08-06 23:55:28 +0000
@@ -861,7 +861,7 @@
   tetj_purpose_end(journal, tetj_activity_count, tetj_tp_count);
 
   /* Check elf header contents */
-  elf_type = checkElfhdr(file, ELF_IS_DSO, journal);
+  elf_type = checkElfhdr(file, ELF_IS_DSO, journal, 0);
 
 #ifdef xDEBUG
   for(i=1;file->versionnames[i];i++)

=== modified file 'rpmchk/archive.c'
--- a/rpmchk/archive.c	2011-03-02 20:29:24 +0000
+++ b/rpmchk/archive.c	2012-08-06 23:55:28 +0000
@@ -179,14 +179,14 @@
 
 	        elfFile->filename = strdup(filename);
 	        /* Protect from crash if alien architecture. */
-		if( checkElfhdr(elfFile, elf_type, journal) != ELF_ERROR ) {
+		if( checkElfhdr(elfFile, elf_type, journal, 1) != ELF_ERROR ) {
 		    /*
 		    * If file is a DSO, include those symbols
 		    * while verifying executable symbols 
 		    */
 		    addDTNeeded(filename);
 
-		    checkElfhdr(elfFile, elf_type, journal);
+		    checkElfhdr(elfFile, elf_type, journal, 1);
 		    /*
 		    * Search through program headers for the
 		    * one with the dynamic symbols in it. 



More information about the lsb-messages mailing list