Print this page
OS-5057 libproc file_info_t file_pname too short
Reviewed by: Cody Mello <cody.mello@joyent.com>
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
OS-3780 libproc could know about .gnu_debuglink for remote symbol tables
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>


   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 /*
  26  * Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
  27  * Copyright (c) 2014, Joyent, Inc. All rights reserved.
  28  * Copyright (c) 2013 by Delphix. All rights reserved.
  29  */
  30 
  31 #ifndef _PCONTROL_H
  32 #define _PCONTROL_H
  33 
  34 /*
  35  * Implemention-specific include file for libproc process management.
  36  * This is not to be seen by the clients of libproc.
  37  */
  38 
  39 #include <stdio.h>
  40 #include <gelf.h>
  41 #include <synch.h>
  42 #include <procfs.h>
  43 #include <rtld_db.h>
  44 #include <libproc.h>
  45 #include <libctf.h>
  46 #include <limits.h>
  47 #include <libproc.h>


  75  */
  76 typedef struct sym_tbl {        /* symbol table */
  77         Elf_Data *sym_data_pri; /* primary table */
  78         Elf_Data *sym_data_aux; /* auxiliary table */
  79         size_t  sym_symn_aux;   /* number of entries in auxiliary table */
  80         size_t  sym_symn;       /* total number of entries in both tables */
  81         char    *sym_strs;      /* ptr to strings */
  82         size_t  sym_strsz;      /* size of string table */
  83         GElf_Shdr sym_hdr_pri;  /* primary symbol table section header */
  84         GElf_Shdr sym_hdr_aux;  /* auxiliary symbol table section header */
  85         GElf_Shdr sym_strhdr;   /* string table section header */
  86         Elf     *sym_elf;       /* faked-up ELF handle from core file */
  87         void    *sym_elfmem;    /* data for faked-up ELF handle */
  88         uint_t  *sym_byname;    /* symbols sorted by name */
  89         uint_t  *sym_byaddr;    /* symbols sorted by addr */
  90         size_t  sym_count;      /* number of symbols in each sorted list */
  91 } sym_tbl_t;
  92 
  93 typedef struct file_info {      /* symbol information for a mapped file */
  94         plist_t file_list;      /* linked list */
  95         char    file_pname[PRMAPSZ];    /* name from prmap_t */
  96         struct map_info *file_map;      /* primary (text) mapping */
  97         int     file_ref;       /* references from map_info_t structures */
  98         int     file_fd;        /* file descriptor for the mapped file */

  99         int     file_init;      /* 0: initialization yet to be performed */
 100         GElf_Half file_etype;   /* ELF e_type from ehdr */
 101         GElf_Half file_class;   /* ELF e_ident[EI_CLASS] from ehdr */
 102         rd_loadobj_t *file_lo;  /* load object structure from rtld_db */
 103         char    *file_lname;    /* load object name from rtld_db */
 104         char    *file_lbase;    /* pointer to basename of file_lname */
 105         char    *file_rname;    /* resolved on-disk object pathname */
 106         char    *file_rbase;    /* pointer to basename of file_rname */
 107         Elf     *file_elf;      /* ELF handle so we can close */

 108         void    *file_elfmem;   /* data for faked-up ELF handle */
 109         sym_tbl_t file_symtab;  /* symbol table */
 110         sym_tbl_t file_dynsym;  /* dynamic symbol table */
 111         uintptr_t file_dyn_base;        /* load address for ET_DYN files */
 112         uintptr_t file_plt_base;        /* base address for PLT */
 113         size_t  file_plt_size;  /* size of PLT region */
 114         uintptr_t file_jmp_rel; /* base address of PLT relocations */
 115         uintptr_t file_ctf_off; /* offset of CTF data in object file */
 116         size_t  file_ctf_size;  /* size of CTF data in object file */
 117         int     file_ctf_dyn;   /* does the CTF data reference the dynsym */
 118         void    *file_ctf_buf;  /* CTF data for this file */
 119         ctf_file_t *file_ctfp;  /* CTF container for this file */
 120         char    *file_shstrs;   /* section header string table */
 121         size_t  file_shstrsz;   /* section header string table size */
 122         uintptr_t *file_saddrs; /* section header addresses */
 123         uint_t  file_nsaddrs;   /* number of section header addresses */
 124 } file_info_t;
 125 
 126 typedef struct map_info {       /* description of an address space mapping */
 127         prmap_t map_pmap;       /* /proc description of this mapping */




   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 /*
  26  * Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
  27  * Copyright (c) 2015, Joyent, Inc. All rights reserved.
  28  * Copyright (c) 2013 by Delphix. All rights reserved.
  29  */
  30 
  31 #ifndef _PCONTROL_H
  32 #define _PCONTROL_H
  33 
  34 /*
  35  * Implemention-specific include file for libproc process management.
  36  * This is not to be seen by the clients of libproc.
  37  */
  38 
  39 #include <stdio.h>
  40 #include <gelf.h>
  41 #include <synch.h>
  42 #include <procfs.h>
  43 #include <rtld_db.h>
  44 #include <libproc.h>
  45 #include <libctf.h>
  46 #include <limits.h>
  47 #include <libproc.h>


  75  */
  76 typedef struct sym_tbl {        /* symbol table */
  77         Elf_Data *sym_data_pri; /* primary table */
  78         Elf_Data *sym_data_aux; /* auxiliary table */
  79         size_t  sym_symn_aux;   /* number of entries in auxiliary table */
  80         size_t  sym_symn;       /* total number of entries in both tables */
  81         char    *sym_strs;      /* ptr to strings */
  82         size_t  sym_strsz;      /* size of string table */
  83         GElf_Shdr sym_hdr_pri;  /* primary symbol table section header */
  84         GElf_Shdr sym_hdr_aux;  /* auxiliary symbol table section header */
  85         GElf_Shdr sym_strhdr;   /* string table section header */
  86         Elf     *sym_elf;       /* faked-up ELF handle from core file */
  87         void    *sym_elfmem;    /* data for faked-up ELF handle */
  88         uint_t  *sym_byname;    /* symbols sorted by name */
  89         uint_t  *sym_byaddr;    /* symbols sorted by addr */
  90         size_t  sym_count;      /* number of symbols in each sorted list */
  91 } sym_tbl_t;
  92 
  93 typedef struct file_info {      /* symbol information for a mapped file */
  94         plist_t file_list;      /* linked list */
  95         char    file_pname[PATH_MAX];   /* name from prmap_t */
  96         struct map_info *file_map;      /* primary (text) mapping */
  97         int     file_ref;       /* references from map_info_t structures */
  98         int     file_fd;        /* file descriptor for the mapped file */
  99         int     file_dbgfile;   /* file descriptor for the debug file */
 100         int     file_init;      /* 0: initialization yet to be performed */
 101         GElf_Half file_etype;   /* ELF e_type from ehdr */
 102         GElf_Half file_class;   /* ELF e_ident[EI_CLASS] from ehdr */
 103         rd_loadobj_t *file_lo;  /* load object structure from rtld_db */
 104         char    *file_lname;    /* load object name from rtld_db */
 105         char    *file_lbase;    /* pointer to basename of file_lname */
 106         char    *file_rname;    /* resolved on-disk object pathname */
 107         char    *file_rbase;    /* pointer to basename of file_rname */
 108         Elf     *file_elf;      /* ELF handle so we can close */
 109         Elf     *file_dbgelf;   /* Debug ELF handle so we can close */
 110         void    *file_elfmem;   /* data for faked-up ELF handle */
 111         sym_tbl_t file_symtab;  /* symbol table */
 112         sym_tbl_t file_dynsym;  /* dynamic symbol table */
 113         uintptr_t file_dyn_base;        /* load address for ET_DYN files */
 114         uintptr_t file_plt_base;        /* base address for PLT */
 115         size_t  file_plt_size;  /* size of PLT region */
 116         uintptr_t file_jmp_rel; /* base address of PLT relocations */
 117         uintptr_t file_ctf_off; /* offset of CTF data in object file */
 118         size_t  file_ctf_size;  /* size of CTF data in object file */
 119         int     file_ctf_dyn;   /* does the CTF data reference the dynsym */
 120         void    *file_ctf_buf;  /* CTF data for this file */
 121         ctf_file_t *file_ctfp;  /* CTF container for this file */
 122         char    *file_shstrs;   /* section header string table */
 123         size_t  file_shstrsz;   /* section header string table size */
 124         uintptr_t *file_saddrs; /* section header addresses */
 125         uint_t  file_nsaddrs;   /* number of section header addresses */
 126 } file_info_t;
 127 
 128 typedef struct map_info {       /* description of an address space mapping */
 129         prmap_t map_pmap;       /* /proc description of this mapping */