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
        
*** 19,28 ****
--- 19,29 ----
   * CDDL HEADER END
   */
  
  /*
   * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+  * Copyright 2016 Joyent, Inc.
   */
  
  #include <sys/errno.h>
  #include <sys/exec.h>
  #include <sys/kmem.h>
*** 40,86 ****
  #include <sys/brand.h>
  #include "sn1_brand.h"
  
  char *sn1_emulation_table = NULL;
  
! void    sn1_init_brand_data(zone_t *);
  void    sn1_free_brand_data(zone_t *);
  void    sn1_setbrand(proc_t *);
  int     sn1_getattr(zone_t *, int, void *, size_t *);
  int     sn1_setattr(zone_t *, int, void *, size_t);
  int     sn1_brandsys(int, int64_t *, uintptr_t, uintptr_t, uintptr_t,
!                 uintptr_t, uintptr_t, uintptr_t);
  void    sn1_copy_procdata(proc_t *, proc_t *);
! void    sn1_proc_exit(struct proc *, klwp_t *);
  void    sn1_exec();
! int     sn1_initlwp(klwp_t *);
  void    sn1_forklwp(klwp_t *, klwp_t *);
  void    sn1_freelwp(klwp_t *);
  void    sn1_lwpexit(klwp_t *);
  int     sn1_elfexec(vnode_t *, execa_t *, uarg_t *, intpdata_t *, int,
!         long *, int, caddr_t, cred_t *, int);
  
  /* sn1 brand */
  struct brand_ops sn1_brops = {
!         sn1_init_brand_data,
!         sn1_free_brand_data,
!         sn1_brandsys,
!         sn1_setbrand,
!         sn1_getattr,
!         sn1_setattr,
!         sn1_copy_procdata,
!         sn1_proc_exit,
!         sn1_exec,
!         lwp_setrval,
!         sn1_initlwp,
!         sn1_forklwp,
!         sn1_freelwp,
!         sn1_lwpexit,
!         sn1_elfexec,
!         NULL,
!         NULL,
!         NSIG,
  };
  
  #ifdef  sparc
  
  struct brand_mach_ops sn1_mops = {
--- 41,110 ----
  #include <sys/brand.h>
  #include "sn1_brand.h"
  
  char *sn1_emulation_table = NULL;
  
! void    sn1_init_brand_data(zone_t *, kmutex_t *);
  void    sn1_free_brand_data(zone_t *);
  void    sn1_setbrand(proc_t *);
  int     sn1_getattr(zone_t *, int, void *, size_t *);
  int     sn1_setattr(zone_t *, int, void *, size_t);
  int     sn1_brandsys(int, int64_t *, uintptr_t, uintptr_t, uintptr_t,
!                 uintptr_t);
  void    sn1_copy_procdata(proc_t *, proc_t *);
! void    sn1_proc_exit(struct proc *);
  void    sn1_exec();
! void    sn1_initlwp(klwp_t *, void *);
  void    sn1_forklwp(klwp_t *, klwp_t *);
  void    sn1_freelwp(klwp_t *);
  void    sn1_lwpexit(klwp_t *);
  int     sn1_elfexec(vnode_t *, execa_t *, uarg_t *, intpdata_t *, int,
!         long *, int, caddr_t, cred_t *, int *);
  
  /* sn1 brand */
  struct brand_ops sn1_brops = {
!         sn1_init_brand_data,            /* b_init_brand_data */
!         sn1_free_brand_data,            /* b_free_brand_data */
!         sn1_brandsys,                   /* b_brandsys */
!         sn1_setbrand,                   /* b_setbrand */
!         sn1_getattr,                    /* b_getattr */
!         sn1_setattr,                    /* b_setattr */
!         sn1_copy_procdata,              /* b_copy_procdata */
!         sn1_proc_exit,                  /* b_proc_exit */
!         sn1_exec,                       /* b_exec */
!         lwp_setrval,                    /* b_lwp_setrval */
!         NULL,                           /* b_lwpdata_alloc */
!         NULL,                           /* b_lwpdata_free */
!         sn1_initlwp,                    /* b_initlwp */
!         NULL,                           /* b_initlwp_post */
!         sn1_forklwp,                    /* b_forklwp */
!         sn1_freelwp,                    /* b_freelwp */
!         sn1_lwpexit,                    /* b_lwpexit */
!         sn1_elfexec,                    /* b_elfexec */
!         NULL,                           /* b_sigset_native_to_brand */
!         NULL,                           /* b_sigset_brand_to_native */
!         NULL,                           /* b_sigfd_translate */
!         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 sn1_mops = {
*** 92,112 ****
  
  #ifdef  __amd64
  
  struct brand_mach_ops sn1_mops = {
          sn1_brand_sysenter_callback,
          sn1_brand_int91_callback,
          sn1_brand_syscall_callback,
!         sn1_brand_syscall32_callback
  };
  
  #else   /* ! __amd64 */
  
  struct brand_mach_ops sn1_mops = {
          sn1_brand_sysenter_callback,
          NULL,
          sn1_brand_syscall_callback,
          NULL
  };
  #endif  /* __amd64 */
  
  #endif  /* _sparc */
--- 116,142 ----
  
  #ifdef  __amd64
  
  struct brand_mach_ops sn1_mops = {
          sn1_brand_sysenter_callback,
+         NULL,
          sn1_brand_int91_callback,
          sn1_brand_syscall_callback,
!         sn1_brand_syscall32_callback,
!         NULL,
!         NULL
  };
  
  #else   /* ! __amd64 */
  
  struct brand_mach_ops sn1_mops = {
          sn1_brand_sysenter_callback,
          NULL,
+         NULL,
          sn1_brand_syscall_callback,
+         NULL,
+         NULL,
          NULL
  };
  #endif  /* __amd64 */
  
  #endif  /* _sparc */
*** 113,123 ****
  
  struct brand    sn1_brand = {
          BRAND_VER_1,
          "sn1",
          &sn1_brops,
!         &sn1_mops
  };
  
  static struct modlbrand modlbrand = {
          &mod_brandops,          /* type of module */
          "Solaris N-1 Brand",    /* description of module */
--- 143,154 ----
  
  struct brand    sn1_brand = {
          BRAND_VER_1,
          "sn1",
          &sn1_brops,
!         &sn1_mops,
!         sizeof (brand_proc_data_t),
  };
  
  static struct modlbrand modlbrand = {
          &mod_brandops,          /* type of module */
          "Solaris N-1 Brand",    /* description of module */
*** 146,159 ****
  sn1_setattr(zone_t *zone, int attr, void *buf, size_t bufsize)
  {
          return (EINVAL);
  }
  
! /*ARGSUSED*/
  int
  sn1_brandsys(int cmd, int64_t *rval, uintptr_t arg1, uintptr_t arg2,
!     uintptr_t arg3, uintptr_t arg4, uintptr_t arg5, uintptr_t arg6)
  {
          int     res;
  
          *rval = 0;
  
--- 177,190 ----
  sn1_setattr(zone_t *zone, int attr, void *buf, size_t bufsize)
  {
          return (EINVAL);
  }
  
! /* ARGSUSED5 */
  int
  sn1_brandsys(int cmd, int64_t *rval, uintptr_t arg1, uintptr_t arg2,
!     uintptr_t arg3, uintptr_t arg4)
  {
          int     res;
  
          *rval = 0;
  
*** 169,193 ****
  {
          brand_solaris_copy_procdata(child, parent, &sn1_brand);
  }
  
  void
! sn1_proc_exit(struct proc *p, klwp_t *l)
  {
!         brand_solaris_proc_exit(p, l, &sn1_brand);
  }
  
  void
  sn1_exec()
  {
          brand_solaris_exec(&sn1_brand);
  }
  
! int
! sn1_initlwp(klwp_t *l)
  {
!         return (brand_solaris_initlwp(l, &sn1_brand));
  }
  
  void
  sn1_forklwp(klwp_t *p, klwp_t *c)
  {
--- 200,225 ----
  {
          brand_solaris_copy_procdata(child, parent, &sn1_brand);
  }
  
  void
! sn1_proc_exit(struct proc *p)
  {
!         brand_solaris_proc_exit(p, &sn1_brand);
  }
  
  void
  sn1_exec()
  {
          brand_solaris_exec(&sn1_brand);
  }
  
! /* ARGSUSED */
! void
! sn1_initlwp(klwp_t *l, void *bd)
  {
!         brand_solaris_initlwp(l, &sn1_brand);
  }
  
  void
  sn1_forklwp(klwp_t *p, klwp_t *c)
  {
*** 212,233 ****
  {
  }
  
  /*ARGSUSED*/
  void
! sn1_init_brand_data(zone_t *zone)
  {
  }
  
  int
  sn1_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, &sn1_brand, SN1_BRANDNAME,
!             SN1_LIB, SN1_LIB32, SN1_LINKER, SN1_LINKER32));
  }
  
  int
  _init(void)
  {
--- 244,265 ----
  {
  }
  
  /*ARGSUSED*/
  void
! sn1_init_brand_data(zone_t *zone, kmutex_t *zsl)
  {
  }
  
  int
  sn1_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, &sn1_brand, SN1_BRANDNAME,
!             SN1_LIB, SN1_LIB32));
  }
  
  int
  _init(void)
  {