Print this page
uts: Allow for address space randomisation.
Randomise the base addresses of shared objects, non-fixed mappings, the
stack and the heap.  Introduce a service, svc:/system/process-security,
and a tool psecflags(1) to control and observe it

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/sgs/elfdump/common/corenote.c
          +++ new/usr/src/cmd/sgs/elfdump/common/corenote.c
↓ open down ↓ 428 lines elided ↑ open up ↑
 429  429   */
 430  430  static void
 431  431  dump_auxv(note_state_t *state, const char *title)
 432  432  {
 433  433          const sl_auxv_layout_t  *layout = state->ns_arch->auxv;
 434  434          union {
 435  435                  Conv_cap_val_hw1_buf_t          hw1;
 436  436                  Conv_cap_val_hw2_buf_t          hw2;
 437  437                  Conv_cnote_auxv_af_buf_t        auxv_af;
 438  438                  Conv_ehdr_flags_buf_t           ehdr_flags;
      439 +                Conv_secflags_buf_t             secflags;
 439  440                  Conv_inv_buf_t                  inv;
 440  441          } conv_buf;
 441  442          sl_fmtbuf_t     buf;
 442  443          int             ndx, ndx_start;
 443  444          Word            sizeof_auxv;
 444  445  
 445  446          sizeof_auxv = layout->sizeof_struct.slf_eltlen;
 446  447  
 447  448          indent_enter(state, title, &layout->sizeof_struct);
 448  449  
↓ open down ↓ 31 lines elided ↑ open up ↑
 480  481                          num_fmt = SL_FMT_NUM_HEX;
 481  482                          break;
 482  483  
 483  484  
 484  485  
 485  486                  case AT_IGNORE:
 486  487                  case AT_SUN_IFLUSH:
 487  488                          num_fmt = SL_FMT_NUM_HEX;
 488  489                          break;
 489  490  
      491 +                case AT_SUN_SECFLAGS:
      492 +                        w = extract_as_word(state, &layout->a_val);
      493 +                        vstr = conv_psecflags(w, 0, &conv_buf.secflags);
      494 +                        break;
      495 +
 490  496                  case AT_EXECFD:
 491  497                  case AT_PHENT:
 492  498                  case AT_PHNUM:
 493  499                  case AT_PAGESZ:
 494  500                  case AT_SUN_UID:
 495  501                  case AT_SUN_RUID:
 496  502                  case AT_SUN_GID:
 497  503                  case AT_SUN_RGID:
 498  504                  case AT_SUN_LPAGESZ:
 499  505                          num_fmt = SL_FMT_NUM_DEC;
↓ open down ↓ 320 lines elided ↑ open up ↑
 820  826          const sl_timestruc_layout_t *layout = state->ns_arch->timestruc;
 821  827  
 822  828          indent_enter(state, title, &layout->tv_sec);
 823  829  
 824  830          PRINT_DEC_2UP(MSG_ORIG(MSG_CNOTE_T_TV_SEC), tv_sec,
 825  831              MSG_ORIG(MSG_CNOTE_T_TV_NSEC), tv_nsec);
 826  832  
 827  833          indent_exit(state);
 828  834  }
 829  835  
      836 +/*
      837 + * Output information from psecflags_t structure.
      838 + */
      839 +static void
      840 +dump_secflags(note_state_t *state, const char *title)
      841 +{
      842 +        const sl_psecflags_layout_t *layout = state->ns_arch->psecflags;
      843 +        Conv_secflags_buf_t inv;
      844 +        Word w;
      845 +
      846 +        indent_enter(state, title, &layout->psf_effective);
      847 +
      848 +        w = extract_as_word(state, &layout->psf_effective);
      849 +        print_str(state, MSG_ORIG(MSG_CNOTE_T_PSF_EFFECTIVE),
      850 +            conv_psecflags(w, 0, &inv));
      851 +
      852 +        w = extract_as_word(state, &layout->psf_inherit);
      853 +        print_str(state, MSG_ORIG(MSG_CNOTE_T_PSF_INHERIT),
      854 +            conv_psecflags(w, 0, &inv));
      855 +}
 830  856  
 831  857  /*
 832  858   * Output information from utsname structure.
 833  859   */
 834  860  static void
 835  861  dump_utsname(note_state_t *state, const char *title)
 836  862  {
 837  863          const sl_utsname_layout_t       *layout = state->ns_arch->utsname;
 838  864  
 839  865          indent_enter(state, title, &layout->sysname);
↓ open down ↓ 250 lines elided ↑ open up ↑
1090 1116          /*
1091 1117           * In order to line up all the values in a single column,
1092 1118           * we would have to set vcol to a very high value, which results
1093 1119           * in ugly looking output that runs off column 80. So, we use
1094 1120           * two levels of vcol, one for the contents so far, and a
1095 1121           * higher one for the pr_lwp sub-struct.
1096 1122           */
1097 1123          state->ns_vcol += 5;
1098 1124          state->ns_t2col += 5;
1099 1125          state->ns_v2col += 5;
     1126 +
     1127 +        PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_SECFLAGS), pr_secflags,
     1128 +            dump_secflags);
     1129 +
1100 1130          PRINT_SUBTYPE(MSG_ORIG(MSG_CNOTE_T_PR_LWP), pr_lwp, dump_lwpstatus);
1101 1131          state->ns_vcol -= 5;
1102 1132          state->ns_t2col -= 5;
1103 1133          state->ns_v2col -= 5;
1104 1134  
1105 1135          indent_exit(state);
1106 1136  }
1107 1137  
1108 1138  
1109 1139  /*
↓ open down ↓ 754 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX