Print this page
OS-3712 lx brand: DTrace pid provider induces core dumps on 64-bit processes (cstyle)
OS-3712 lx brand: DTrace pid provider induces core dumps on 64-bit processes

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/dtrace/fasttrap_isa.c
          +++ new/usr/src/uts/intel/dtrace/fasttrap_isa.c
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27      -#pragma ident   "%Z%%M% %I%     %E% SMI"
       27 +/*
       28 + * Copyright (c) 2015, Joyent, Inc. All rights reserved.
       29 + */
  28   30  
  29   31  #include <sys/fasttrap_isa.h>
  30   32  #include <sys/fasttrap_impl.h>
  31   33  #include <sys/dtrace.h>
  32   34  #include <sys/dtrace_impl.h>
  33   35  #include <sys/cmn_err.h>
  34   36  #include <sys/regset.h>
  35   37  #include <sys/privregs.h>
  36   38  #include <sys/segments.h>
  37   39  #include <sys/x86_archext.h>
  38   40  #include <sys/sysmacros.h>
  39   41  #include <sys/trap.h>
  40   42  #include <sys/archsystm.h>
       43 +#include <sys/proc.h>
       44 +#include <sys/brand.h>
       45 +#include <sys/machbrand.h>
  41   46  
  42   47  /*
  43   48   * Lossless User-Land Tracing on x86
  44   49   * ---------------------------------
  45   50   *
  46   51   * The execution of most instructions is not dependent on the address; for
  47   52   * these instructions it is sufficient to copy them into the user process's
  48   53   * address space and execute them. To effectively single-step an instruction
  49   54   * in user-land, we copy out the following sequence of instructions to scratch
  50   55   * space in the user thread's ulwp_t structure.
↓ open down ↓ 1336 lines elided ↑ open up ↑
1387 1392  
1388 1393                  /*
1389 1394                   * Compute the address of the ulwp_t and step over the
1390 1395                   * ul_self pointer. The method used to store the user-land
1391 1396                   * thread pointer is very different on 32- and 64-bit
1392 1397                   * kernels.
1393 1398                   */
1394 1399  #if defined(__amd64)
1395 1400                  if (p->p_model == DATAMODEL_LP64) {
1396 1401                          addr = lwp->lwp_pcb.pcb_fsbase;
     1402 +
     1403 +                        /*
     1404 +                         * If we're branded, convert the fsbase from the
     1405 +                         * brand's fsbase to the native fsbase.
     1406 +                         */
     1407 +                        if (PROC_IS_BRANDED(p) && BRMOP(p)->b_fsbase != NULL)
     1408 +                                addr = BRMOP(p)->b_fsbase(lwp, addr);
     1409 +
1397 1410                          addr += sizeof (void *);
1398 1411                  } else {
1399 1412                          addr = lwp->lwp_pcb.pcb_gsbase;
1400 1413                          addr += sizeof (caddr32_t);
1401 1414                  }
1402 1415  #else
1403 1416                  addr = USEGD_GETBASE(&lwp->lwp_pcb.pcb_gsdesc);
1404 1417                  addr += sizeof (void *);
1405 1418  #endif
1406 1419  
↓ open down ↓ 339 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX