/[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.251 Revision 1.252
1/* 1/*
2 * Copyright 2003-2012 Gentoo Foundation 2 * Copyright 2003-2012 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.251 2012/11/10 09:43:00 vapier Exp $ 4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.252 2012/11/18 07:39:45 vapier Exp $
5 * 5 *
6 * Copyright 2003-2012 Ned Ludd - <solar@gentoo.org> 6 * Copyright 2003-2012 Ned Ludd - <solar@gentoo.org>
7 * Copyright 2004-2012 Mike Frysinger - <vapier@gentoo.org> 7 * Copyright 2004-2012 Mike Frysinger - <vapier@gentoo.org>
8 */ 8 */
9 9
10static const char rcsid[] = "$Id: scanelf.c,v 1.251 2012/11/10 09:43:00 vapier Exp $"; 10static const char rcsid[] = "$Id: scanelf.c,v 1.252 2012/11/18 07:39:45 vapier Exp $";
11const char argv0[] = "scanelf"; 11const char argv0[] = "scanelf";
12 12
13#include "paxinc.h" 13#include "paxinc.h"
14 14
15#define IS_MODIFIER(c) (c == '%' || c == '#' || c == '+') 15#define IS_MODIFIER(c) (c == '%' || c == '#' || c == '+')
319static char *scanelf_file_phdr(elfobj *elf, char *found_phdr, char *found_relro, char *found_load) 319static char *scanelf_file_phdr(elfobj *elf, char *found_phdr, char *found_relro, char *found_load)
320{ 320{
321 static char ret[12]; 321 static char ret[12];
322 char *found; 322 char *found;
323 unsigned long i, shown, multi_stack, multi_relro, multi_load; 323 unsigned long i, shown, multi_stack, multi_relro, multi_load;
324 int max_pt_load;
325 324
326 if (!show_phdr) return NULL; 325 if (!show_phdr) return NULL;
327 326
328 memcpy(ret, "--- --- ---\0", 12); 327 memcpy(ret, "--- --- ---\0", 12);
329 328
330 shown = 0; 329 shown = 0;
331 multi_stack = multi_relro = multi_load = 0; 330 multi_stack = multi_relro = multi_load = 0;
332 max_pt_load = elf_max_pt_load(elf);
333 331
334#define NOTE_GNU_STACK ".note.GNU-stack" 332#define NOTE_GNU_STACK ".note.GNU-stack"
335#define SHOW_PHDR(B) \ 333#define SHOW_PHDR(B) \
336 if (elf->elf_class == ELFCLASS ## B) { \ 334 if (elf->elf_class == ELFCLASS ## B) { \
337 Elf ## B ## _Ehdr *ehdr = EHDR ## B (elf->ehdr); \ 335 Elf ## B ## _Ehdr *ehdr = EHDR ## B (elf->ehdr); \
353 warnf("%s: multiple PT_GNU_RELRO's !?", elf->filename); \ 351 warnf("%s: multiple PT_GNU_RELRO's !?", elf->filename); \
354 found = found_relro; \ 352 found = found_relro; \
355 offset = 4; \ 353 offset = 4; \
356 check_flags = PF_X; \ 354 check_flags = PF_X; \
357 } else if (EGET(phdr[i].p_type) == PT_LOAD) { \ 355 } else if (EGET(phdr[i].p_type) == PT_LOAD) { \
358 if (EGET(ehdr->e_type) == ET_DYN || EGET(ehdr->e_type) == ET_EXEC) \
359 if (multi_load++ > max_pt_load) \
360 warnf("%s: more than %i PT_LOAD's !?", elf->filename, max_pt_load); \
361 if (file_matches_list(elf->filename, qa_wx_load)) \ 356 if (file_matches_list(elf->filename, qa_wx_load)) \
362 continue; \ 357 continue; \
363 found = found_load; \ 358 found = found_load; \
364 offset = 8; \ 359 offset = 8; \
365 check_flags = PF_W|PF_X; \ 360 check_flags = PF_W|PF_X; \

Legend:
Removed from v.1.251  
changed lines
  Added in v.1.252

  ViewVC Help
Powered by ViewVC 1.1.20