/[gentoo-projects]/pax-utils/scanelf.c
Gentoo

Diff of /pax-utils/scanelf.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.98 Revision 1.99
1/* 1/*
2 * Copyright 2003-2006 Gentoo Foundation 2 * Copyright 2003-2006 Gentoo Foundation
3 * Distributed under the terms of the GNU General Public License v2 3 * Distributed under the terms of the GNU General Public License v2
4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.98 2006/01/05 03:12:07 vapier Exp $ 4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.99 2006/01/10 01:35:06 vapier Exp $
5 * 5 *
6 * Copyright 2003-2006 Ned Ludd - <solar@gentoo.org> 6 * Copyright 2003-2006 Ned Ludd - <solar@gentoo.org>
7 * Copyright 2004-2006 Mike Frysinger - <vapier@gentoo.org> 7 * Copyright 2004-2006 Mike Frysinger - <vapier@gentoo.org>
8 */ 8 */
9 9
10#include "paxinc.h" 10#include "paxinc.h"
11 11
12static const char *rcsid = "$Id: scanelf.c,v 1.98 2006/01/05 03:12:07 vapier Exp $"; 12static const char *rcsid = "$Id: scanelf.c,v 1.99 2006/01/10 01:35:06 vapier Exp $";
13#define argv0 "scanelf" 13#define argv0 "scanelf"
14 14
15#define IS_MODIFIER(c) (c == '%' || c == '#') 15#define IS_MODIFIER(c) (c == '%' || c == '#')
16 16
17 17
136 136
137static char *scanelf_file_phdr(elfobj *elf, char *found_phdr, char *found_relro, char *found_load) 137static char *scanelf_file_phdr(elfobj *elf, char *found_phdr, char *found_relro, char *found_load)
138{ 138{
139 static char ret[12]; 139 static char ret[12];
140 char *found; 140 char *found;
141 unsigned long i, shown;
142 unsigned char multi_stack, multi_relro, multi_load; 141 unsigned long i, shown, multi_stack, multi_relro, multi_load;
142 int max_pt_load;
143 143
144 if (!show_phdr) return NULL; 144 if (!show_phdr) return NULL;
145 145
146 memcpy(ret, "--- --- ---\0", 12); 146 memcpy(ret, "--- --- ---\0", 12);
147 147
148 shown = 0; 148 shown = 0;
149 multi_stack = multi_relro = multi_load = 0; 149 multi_stack = multi_relro = multi_load = 0;
150 max_pt_load = elf_max_pt_load(elf);
150 151
151#define SHOW_PHDR(B) \ 152#define SHOW_PHDR(B) \
152 if (elf->elf_class == ELFCLASS ## B) { \ 153 if (elf->elf_class == ELFCLASS ## B) { \
153 Elf ## B ## _Ehdr *ehdr = EHDR ## B (elf->ehdr); \ 154 Elf ## B ## _Ehdr *ehdr = EHDR ## B (elf->ehdr); \
154 Elf ## B ## _Off offset; \ 155 Elf ## B ## _Off offset; \
165 if (multi_relro++) warnf("%s: multiple PT_GNU_RELRO's !?", elf->filename); \ 166 if (multi_relro++) warnf("%s: multiple PT_GNU_RELRO's !?", elf->filename); \
166 found = found_relro; \ 167 found = found_relro; \
167 offset = 4; \ 168 offset = 4; \
168 check_flags = PF_X; \ 169 check_flags = PF_X; \
169 } else if (EGET(phdr[i].p_type) == PT_LOAD) { \ 170 } else if (EGET(phdr[i].p_type) == PT_LOAD) { \
170 if (multi_load++ > 2) warnf("%s: more than 2 PT_LOAD's !?", elf->filename); \ 171 if (multi_load++ > max_pt_load) warnf("%s: more than %i PT_LOAD's !?", elf->filename, max_pt_load); \
171 found = found_load; \ 172 found = found_load; \
172 offset = 8; \ 173 offset = 8; \
173 check_flags = PF_W|PF_X; \ 174 check_flags = PF_W|PF_X; \
174 } else \ 175 } else \
175 continue; \ 176 continue; \

Legend:
Removed from v.1.98  
changed lines
  Added in v.1.99

  ViewVC Help
Powered by ViewVC 1.1.20