Print this page
Reduce lint
OS-5462 lxbrand kernel should be lint clean
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
OS-5354 lx shebang argument handling is incorrect
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
OS-5189 lx dev enumeration can deadlock with zfs
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
OS-4937 lxbrand ptracer count updates can race
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Joshua M. Clulow <jmc@joyent.com>
OS-3742 lxbrand add support for signalfd
OS-4382 remove obsolete brand hooks added during lx development
OS-4306 lxbrand setsockopt(IP_MULTICAST_TTL) handles optlen poorly
OS-4303 lxbrand ltp ptrace05 fails
Reviewed by: Joshua M. Clulow <jmc@joyent.com>
OS-4188 NULL dereference in lwp_hash_in
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Joshua M. Clulow <jmc@joyent.com>
OS-4119 lxbrand panic when running native perl inside lx zone
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
OS-4151 setbrand hooks should be sane during fork
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Joshua M. Clulow <jmc@joyent.com>
OS-4129 lxbrand should not abuse p_brand_data for storing exit signal
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Joshua M. Clulow <jmc@joyent.com>
OS-3825 lxbrand rsyslogd abort on centos6
OS-4047 lxbrand vsyscall while SIGSEGV? on next trap we're handler-free!
Reviewed by: Bryan Cantrill <bryan@joyent.com>
OS-3926 lxbrand in-kernel fchownat(2), fchown(2), lchown(2), chown(2) and 16-bit ID counterparts
OS-3920 lxbrand use native *at(2) system calls for LX emulation
OS-3561 lxbrand emulation library should execute on alternate stack
OS-3558 lxbrand add support for full in-kernel syscall handling
OS-3545 lx_syscall_regs should not walk stack
OS-3868 many LTP testcases now hang
OS-3901 lxbrand lx_recvmsg fails to translate control messages when 64-bit
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
OS-3712 lx brand: DTrace pid provider induces core dumps on 64-bit processes
OS-3594 lx brand: need support for MAP_32BIT
OS-3554 lx brand: node.js test test-fs-append-file.js hangs on 64-bit
OS-3517 lx brand: branded zones don't interpret .interp section
OS-2844 lx brand should support 64-bit user-land
OS-3280 need a way to specify the root of a native system in the lx brand
OS-3279 lx brand should allow delegated datasets
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
OS-3149 lx brand always sends SIGCHLD to parent processes, regardless of how clone was invoked
OS-2887 lxbrand add WALL, WCLONE, WNOTHREAD support to waitid
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
OS-2834 ship lx brand
        
*** 20,29 ****
--- 20,30 ----
   */
  
  /*
   * Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
   * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+  * Copyright 2016, Joyent, Inc.
   */
  
  #include <sys/errno.h>
  #include <sys/exec.h>
  #include <sys/file.h>
*** 43,91 ****
  #include <sys/brand.h>
  #include "s10_brand.h"
  
  char *s10_emulation_table = NULL;
  
! void    s10_init_brand_data(zone_t *);
  void    s10_free_brand_data(zone_t *);
  void    s10_setbrand(proc_t *);
  int     s10_getattr(zone_t *, int, void *, size_t *);
  int     s10_setattr(zone_t *, int, void *, size_t);
  int     s10_brandsys(int, int64_t *, uintptr_t, uintptr_t, uintptr_t,
!                 uintptr_t, uintptr_t, uintptr_t);
  void    s10_copy_procdata(proc_t *, proc_t *);
! void    s10_proc_exit(struct proc *, klwp_t *);
  void    s10_exec();
! int     s10_initlwp(klwp_t *);
  void    s10_forklwp(klwp_t *, klwp_t *);
  void    s10_freelwp(klwp_t *);
  void    s10_lwpexit(klwp_t *);
  int     s10_elfexec(vnode_t *, execa_t *, uarg_t *, intpdata_t *, int,
!         long *, int, caddr_t, cred_t *, int);
  void    s10_sigset_native_to_s10(sigset_t *);
  void    s10_sigset_s10_to_native(sigset_t *);
  
  /* s10 brand */
  struct brand_ops s10_brops = {
!         s10_init_brand_data,
!         s10_free_brand_data,
!         s10_brandsys,
!         s10_setbrand,
!         s10_getattr,
!         s10_setattr,
!         s10_copy_procdata,
!         s10_proc_exit,
!         s10_exec,
!         lwp_setrval,
!         s10_initlwp,
!         s10_forklwp,
!         s10_freelwp,
!         s10_lwpexit,
!         s10_elfexec,
!         s10_sigset_native_to_s10,
!         s10_sigset_s10_to_native,
!         S10_NSIG,
  };
  
  #ifdef  sparc
  
  struct brand_mach_ops s10_mops = {
--- 44,115 ----
  #include <sys/brand.h>
  #include "s10_brand.h"
  
  char *s10_emulation_table = NULL;
  
! void    s10_init_brand_data(zone_t *, kmutex_t *);
  void    s10_free_brand_data(zone_t *);
  void    s10_setbrand(proc_t *);
  int     s10_getattr(zone_t *, int, void *, size_t *);
  int     s10_setattr(zone_t *, int, void *, size_t);
  int     s10_brandsys(int, int64_t *, uintptr_t, uintptr_t, uintptr_t,
!                 uintptr_t);
  void    s10_copy_procdata(proc_t *, proc_t *);
! void    s10_proc_exit(struct proc *);
  void    s10_exec();
! void    s10_initlwp(klwp_t *, void *);
  void    s10_forklwp(klwp_t *, klwp_t *);
  void    s10_freelwp(klwp_t *);
  void    s10_lwpexit(klwp_t *);
  int     s10_elfexec(vnode_t *, execa_t *, uarg_t *, intpdata_t *, int,
!         long *, int, caddr_t, cred_t *, int *);
  void    s10_sigset_native_to_s10(sigset_t *);
  void    s10_sigset_s10_to_native(sigset_t *);
  
  /* s10 brand */
  struct brand_ops s10_brops = {
!         s10_init_brand_data,            /* b_init_brand_data */
!         s10_free_brand_data,            /* b_free_brand_data */
!         s10_brandsys,                   /* b_brandsys */
!         s10_setbrand,                   /* b_setbrand */
!         s10_getattr,                    /* b_getattr */
!         s10_setattr,                    /* b_setattr */
!         s10_copy_procdata,              /* b_copy_procdata */
!         s10_proc_exit,                  /* b_proc_exit */
!         s10_exec,                       /* b_exec */
!         lwp_setrval,                    /* b_lwp_setrval */
!         NULL,                           /* b_lwpdata_alloc */
!         NULL,                           /* b_lwpdata_free */
!         s10_initlwp,                    /* b_initlwp */
!         NULL,                           /* b_initlwp_post */
!         s10_forklwp,                    /* b_forklwp */
!         s10_freelwp,                    /* b_freelwp */
!         s10_lwpexit,                    /* b_lwpexit */
!         s10_elfexec,                    /* b_elfexec */
!         s10_sigset_native_to_s10,       /* b_sigset_native_to_brand */
!         s10_sigset_s10_to_native,       /* b_sigset_brand_to_native */
!         NULL,                           /* b_sigfd_translate */
!         S10_NSIG,                       /* b_nsig */
!         NULL,                           /* b_exit_with_sig */
!         NULL,                           /* b_wait_filter */
!         NULL,                           /* b_native_exec */
!         NULL,                           /* b_map32limit */
!         NULL,                           /* b_stop_notify */
!         NULL,                           /* b_waitid_helper */
!         NULL,                           /* b_sigcld_repost */
!         NULL,                           /* b_issig_stop */
!         NULL,                           /* b_sig_ignorable */
!         NULL,                           /* b_savecontext */
! #if defined(_SYSCALL32_IMPL)
!         NULL,                           /* b_savecontext32 */
! #endif
!         NULL,                           /* b_restorecontext */
!         NULL,                           /* b_sendsig_stack */
!         NULL,                           /* b_sendsig */
!         NULL,                           /* b_setid_clear */
!         NULL,                           /* b_pagefault */
!         B_TRUE                          /* b_intp_parse_arg */
  };
  
  #ifdef  sparc
  
  struct brand_mach_ops s10_mops = {
*** 97,117 ****
  
  #ifdef  __amd64
  
  struct brand_mach_ops s10_mops = {
          s10_brand_sysenter_callback,
          s10_brand_int91_callback,
          s10_brand_syscall_callback,
!         s10_brand_syscall32_callback
  };
  
  #else   /* ! __amd64 */
  
  struct brand_mach_ops s10_mops = {
          s10_brand_sysenter_callback,
          NULL,
          s10_brand_syscall_callback,
          NULL
  };
  #endif  /* __amd64 */
  
  #endif  /* _sparc */
--- 121,147 ----
  
  #ifdef  __amd64
  
  struct brand_mach_ops s10_mops = {
          s10_brand_sysenter_callback,
+         NULL,
          s10_brand_int91_callback,
          s10_brand_syscall_callback,
!         s10_brand_syscall32_callback,
!         NULL,
!         NULL
  };
  
  #else   /* ! __amd64 */
  
  struct brand_mach_ops s10_mops = {
          s10_brand_sysenter_callback,
          NULL,
+         NULL,
          s10_brand_syscall_callback,
+         NULL,
+         NULL,
          NULL
  };
  #endif  /* __amd64 */
  
  #endif  /* _sparc */
*** 118,128 ****
  
  struct brand    s10_brand = {
          BRAND_VER_1,
          "solaris10",
          &s10_brops,
!         &s10_mops
  };
  
  static struct modlbrand modlbrand = {
          &mod_brandops,          /* type of module */
          "Solaris 10 Brand",     /* description of module */
--- 148,159 ----
  
  struct brand    s10_brand = {
          BRAND_VER_1,
          "solaris10",
          &s10_brops,
!         &s10_mops,
!         sizeof (brand_proc_data_t),
  };
  
  static struct modlbrand modlbrand = {
          &mod_brandops,          /* type of module */
          "Solaris 10 Brand",     /* description of module */
*** 247,260 ****
          mutex_exit(&curproc->p_lock);
  
          return (0);
  }
  
! /*ARGSUSED*/
  int
  s10_brandsys(int cmd, int64_t *rval, uintptr_t arg1, uintptr_t arg2,
!     uintptr_t arg3, uintptr_t arg4, uintptr_t arg5, uintptr_t arg6)
  {
          proc_t  *p = curproc;
          int     res;
  
          *rval = 0;
--- 278,291 ----
          mutex_exit(&curproc->p_lock);
  
          return (0);
  }
  
! /* ARGSUSED5 */
  int
  s10_brandsys(int cmd, int64_t *rval, uintptr_t arg1, uintptr_t arg2,
!     uintptr_t arg3, uintptr_t arg4)
  {
          proc_t  *p = curproc;
          int     res;
  
          *rval = 0;
*** 324,348 ****
  {
          brand_solaris_copy_procdata(child, parent, &s10_brand);
  }
  
  void
! s10_proc_exit(struct proc *p, klwp_t *l)
  {
!         brand_solaris_proc_exit(p, l, &s10_brand);
  }
  
  void
  s10_exec()
  {
          brand_solaris_exec(&s10_brand);
  }
  
! int
! s10_initlwp(klwp_t *l)
  {
!         return (brand_solaris_initlwp(l, &s10_brand));
  }
  
  void
  s10_forklwp(klwp_t *p, klwp_t *c)
  {
--- 355,380 ----
  {
          brand_solaris_copy_procdata(child, parent, &s10_brand);
  }
  
  void
! s10_proc_exit(struct proc *p)
  {
!         brand_solaris_proc_exit(p, &s10_brand);
  }
  
  void
  s10_exec()
  {
          brand_solaris_exec(&s10_brand);
  }
  
! /* ARGSUSED */
! void
! s10_initlwp(klwp_t *l, void *bd)
  {
!         brand_solaris_initlwp(l, &s10_brand);
  }
  
  void
  s10_forklwp(klwp_t *p, klwp_t *c)
  {
*** 377,402 ****
  s10_free_brand_data(zone_t *zone)
  {
          kmem_free(zone->zone_brand_data, sizeof (s10_zone_data_t));
  }
  
  void
! s10_init_brand_data(zone_t *zone)
  {
          ASSERT(zone->zone_brand == &s10_brand);
          ASSERT(zone->zone_brand_data == NULL);
          zone->zone_brand_data = kmem_zalloc(sizeof (s10_zone_data_t), KM_SLEEP);
  }
  
  int
  s10_elfexec(vnode_t *vp, execa_t *uap, uarg_t *args, intpdata_t *idatap,
          int level, long *execsz, int setid, caddr_t exec_file, cred_t *cred,
!         int brand_action)
  {
          return (brand_solaris_elfexec(vp, uap, args, idatap, level, execsz,
              setid, exec_file, cred, brand_action, &s10_brand, S10_BRANDNAME,
!             S10_LIB, S10_LIB32, S10_LINKER, S10_LINKER32));
  }
  
  void
  s10_sigset_native_to_s10(sigset_t *set)
  {
--- 409,435 ----
  s10_free_brand_data(zone_t *zone)
  {
          kmem_free(zone->zone_brand_data, sizeof (s10_zone_data_t));
  }
  
+ /* ARGSUSED */
  void
! s10_init_brand_data(zone_t *zone, kmutex_t *zsl)
  {
          ASSERT(zone->zone_brand == &s10_brand);
          ASSERT(zone->zone_brand_data == NULL);
          zone->zone_brand_data = kmem_zalloc(sizeof (s10_zone_data_t), KM_SLEEP);
  }
  
  int
  s10_elfexec(vnode_t *vp, execa_t *uap, uarg_t *args, intpdata_t *idatap,
      int level, long *execsz, int setid, caddr_t exec_file, cred_t *cred,
!     int *brand_action)
  {
          return (brand_solaris_elfexec(vp, uap, args, idatap, level, execsz,
              setid, exec_file, cred, brand_action, &s10_brand, S10_BRANDNAME,
!             S10_LIB, S10_LIB32));
  }
  
  void
  s10_sigset_native_to_s10(sigset_t *set)
  {