From owner-p4-projects@FreeBSD.ORG Thu Aug 17 21:35:36 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6FC1F16A4DF; Thu, 17 Aug 2006 21:35:36 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 27DE216A4DA for ; Thu, 17 Aug 2006 21:35:36 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id CA63C43D45 for ; Thu, 17 Aug 2006 21:35:35 +0000 (GMT) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k7HLZUWi096139 for ; Thu, 17 Aug 2006 21:35:30 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k7HLZUTw096136 for perforce@freebsd.org; Thu, 17 Aug 2006 21:35:30 GMT (envelope-from jb@freebsd.org) Date: Thu, 17 Aug 2006 21:35:30 GMT Message-Id: <200608172135.k7HLZUTw096136@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 104441 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Aug 2006 21:35:36 -0000 http://perforce.freebsd.org/chv.cgi?CH=104441 Change 104441 by jb@jb_freebsd2 on 2006/08/17 21:34:37 IFlibbsdelf Affected files ... .. //depot/projects/dtrace/src/lib/libelf/_libelf.h#6 integrate .. //depot/projects/dtrace/src/lib/libelf/elf_errmsg.c#5 integrate .. //depot/projects/dtrace/src/lib/libelf/gelf_getehdr.3#3 integrate .. //depot/projects/dtrace/src/lib/libelf/gelf_newehdr.3#3 integrate .. //depot/projects/dtrace/src/lib/libelf/libelf_convert.m4#7 integrate .. //depot/projects/dtrace/src/lib/libelf/libelf_ehdr.c#3 integrate Differences ... ==== //depot/projects/dtrace/src/lib/libelf/_libelf.h#6 (text+ko) ==== @@ -107,8 +107,8 @@ Elf64_Phdr *e_phdr64; } e_phdr; union { - Elf32_Shdr *e_shdr32; - Elf64_Shdr *e_shdr64; + Elf32_Phdr *e_shdr32; + Elf64_Phdr *e_shdr64; } e_shdr; } e_elf; } e_u; ==== //depot/projects/dtrace/src/lib/libelf/elf_errmsg.c#5 (text+ko) ==== @@ -50,7 +50,8 @@ DEFINE_ERROR(STAT, "Cannot determine file parameters"), DEFINE_ERROR(TRUNCATE, "File truncation failed"), DEFINE_ERROR(UNIMPL, "Feature is unimplemented"), - DEFINE_ERROR(VERSION, "Unknown API version") + DEFINE_ERROR(VERSION, "Unknown API version"), + DEFINE_ERROR(NUM, "Unknown error") #undef DEFINE_ERROR }; ==== //depot/projects/dtrace/src/lib/libelf/gelf_getehdr.3#3 (text+ko) ==== @@ -99,6 +99,10 @@ does not have an associated header. .It Bq Er ELF_E_RESOURCE An out of memory condition was detected during execution. +.It Bq Er ELF_E_VERSION +The ELF descriptor +.Ar elf +had an unsupported ELF version number. .El .Sh SEE ALSO .Xr elf 3 , ==== //depot/projects/dtrace/src/lib/libelf/gelf_newehdr.3#3 (text+ko) ==== @@ -151,6 +151,10 @@ A malformed ELF header was detected. .It Bq Er ELF_E_RESOURCE An out of memory condition was detected during execution. +.It Bq Er ELF_E_VERSION +The ELF descriptor +.Ar elf +had an unsupported ELF version number. .El .Sh SEE ALSO .Xr elf 3 , ==== //depot/projects/dtrace/src/lib/libelf/libelf_convert.m4#7 (text+ko) ==== @@ -129,7 +129,9 @@ #define WRITE_XWORD(P,X) WRITE_WORD64(P,X) #define WRITE_IDENT(P,X) do { \ (void) memcpy((P), (X), sizeof((X))); \ + (P) = (P) + EI_NIDENT; \ } while (0) + /* * Read in various integral values. The source pointer could be * unaligned. Values are read in in native byte order. The source @@ -189,7 +191,7 @@ #define READ_XWORD(P,X) READ_WORD64(P,X) #define READ_IDENT(P,X) do { \ (void) memcpy((X), (P), sizeof((X))); \ - (P) = (P) + sizeof((X)); \ + (P) = (P) + EI_NIDENT; \ } while (0) divert(-1) ==== //depot/projects/dtrace/src/lib/libelf/libelf_ehdr.c#3 (text+ko) ==== @@ -66,6 +66,11 @@ return (NULL); } + if (e->e_version != EV_CURRENT) { + LIBELF_SET_ERROR(VERSION, 0); + return (NULL); + } + if (e->e_class == ELFCLASSNONE) e->e_class = ec;