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
        
*** 22,32 ****
  /*
   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
   * Use is subject to license terms.
   */
  
! #pragma ident   "%Z%%M% %I%     %E% SMI"
  
  #include <sys/fasttrap_isa.h>
  #include <sys/fasttrap_impl.h>
  #include <sys/dtrace.h>
  #include <sys/dtrace_impl.h>
--- 22,34 ----
  /*
   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
   * Use is subject to license terms.
   */
  
! /*
!  * Copyright (c) 2015, Joyent, Inc. All rights reserved.
!  */
  
  #include <sys/fasttrap_isa.h>
  #include <sys/fasttrap_impl.h>
  #include <sys/dtrace.h>
  #include <sys/dtrace_impl.h>
*** 36,45 ****
--- 38,50 ----
  #include <sys/segments.h>
  #include <sys/x86_archext.h>
  #include <sys/sysmacros.h>
  #include <sys/trap.h>
  #include <sys/archsystm.h>
+ #include <sys/proc.h>
+ #include <sys/brand.h>
+ #include <sys/machbrand.h>
  
  /*
   * Lossless User-Land Tracing on x86
   * ---------------------------------
   *
*** 1392,1401 ****
--- 1397,1414 ----
                   * kernels.
                   */
  #if defined(__amd64)
                  if (p->p_model == DATAMODEL_LP64) {
                          addr = lwp->lwp_pcb.pcb_fsbase;
+ 
+                         /*
+                          * If we're branded, convert the fsbase from the
+                          * brand's fsbase to the native fsbase.
+                          */
+                         if (PROC_IS_BRANDED(p) && BRMOP(p)->b_fsbase != NULL)
+                                 addr = BRMOP(p)->b_fsbase(lwp, addr);
+ 
                          addr += sizeof (void *);
                  } else {
                          addr = lwp->lwp_pcb.pcb_gsbase;
                          addr += sizeof (caddr32_t);
                  }