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


   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #pragma ident   "%Z%%M% %I%     %E% SMI"
  28 
  29 #include <sys/types.h>
  30 #include <sys/mkdev.h>
  31 #include <sys/regset.h>
  32 #include <string.h>
  33 
  34 #if defined(__amd64)
  35 #include <sys/fp.h>
  36 #include <ieeefp.h>
  37 #endif
  38 
  39 #include "P32ton.h"
  40 
  41 dev_t
  42 prexpldev(dev32_t d)
  43 {
  44         if (d != (dev32_t)-1L)
  45                 return (makedev((d >> NBITSMINOR32) & MAXMAJ32, d & MAXMIN32));
  46 
  47         return ((dev_t)PRNODEV);
  48 }


 354         dst->pr_zoneid = src->pr_zoneid;
 355         dst->pr_aslwpid = src->pr_aslwpid;
 356         dst->pr_agentid = src->pr_agentid;
 357         dst->pr_sigpend = src->pr_sigpend;
 358         dst->pr_brkbase = src->pr_brkbase;
 359         dst->pr_brksize = src->pr_brksize;
 360         dst->pr_stkbase = src->pr_stkbase;
 361         dst->pr_stksize = src->pr_stksize;
 362 
 363         timestruc_32_to_n(&src->pr_utime, &dst->pr_utime);
 364         timestruc_32_to_n(&src->pr_stime, &dst->pr_stime);
 365         timestruc_32_to_n(&src->pr_cutime, &dst->pr_cutime);
 366         timestruc_32_to_n(&src->pr_cstime, &dst->pr_cstime);
 367 
 368         dst->pr_sigtrace = src->pr_sigtrace;
 369         dst->pr_flttrace = src->pr_flttrace;
 370         dst->pr_sysentry = src->pr_sysentry;
 371         dst->pr_sysexit = src->pr_sysexit;
 372         dst->pr_dmodel = src->pr_dmodel;
 373 


 374         lwpstatus_32_to_n(&src->pr_lwp, &dst->pr_lwp);
 375 }
 376 
 377 void
 378 lwpsinfo_32_to_n(const lwpsinfo32_t *src, lwpsinfo_t *dst)
 379 {
 380         dst->pr_flag = src->pr_flag;
 381         dst->pr_lwpid = src->pr_lwpid;
 382         dst->pr_addr = src->pr_addr;
 383         dst->pr_wchan = src->pr_wchan;
 384         dst->pr_stype = src->pr_stype;
 385         dst->pr_state = src->pr_state;
 386         dst->pr_sname = src->pr_sname;
 387         dst->pr_nice = src->pr_nice;
 388         dst->pr_syscall = src->pr_syscall;
 389         dst->pr_oldpri = src->pr_oldpri;
 390         dst->pr_cpu = src->pr_cpu;
 391         dst->pr_pri = src->pr_pri;
 392         dst->pr_pctcpu = src->pr_pctcpu;
 393 


 727         dst->pr_zoneid = (id32_t)src->pr_zoneid;
 728         dst->pr_aslwpid = (id32_t)src->pr_aslwpid;
 729         dst->pr_agentid = (id32_t)src->pr_agentid;
 730         dst->pr_sigpend = src->pr_sigpend;
 731         dst->pr_brkbase = (caddr32_t)src->pr_brkbase;
 732         dst->pr_brksize = (size32_t)src->pr_brksize;
 733         dst->pr_stkbase = (caddr32_t)src->pr_stkbase;
 734         dst->pr_stksize = (size32_t)src->pr_stksize;
 735 
 736         timestruc_n_to_32(&src->pr_utime, &dst->pr_utime);
 737         timestruc_n_to_32(&src->pr_stime, &dst->pr_stime);
 738         timestruc_n_to_32(&src->pr_cutime, &dst->pr_cutime);
 739         timestruc_n_to_32(&src->pr_cstime, &dst->pr_cstime);
 740 
 741         dst->pr_sigtrace = src->pr_sigtrace;
 742         dst->pr_flttrace = src->pr_flttrace;
 743         dst->pr_sysentry = src->pr_sysentry;
 744         dst->pr_sysexit = src->pr_sysexit;
 745         dst->pr_dmodel = src->pr_dmodel;
 746 


 747         lwpstatus_n_to_32(&src->pr_lwp, &dst->pr_lwp);
 748 }
 749 
 750 void
 751 lwpsinfo_n_to_32(const lwpsinfo_t *src, lwpsinfo32_t *dst)
 752 {
 753         dst->pr_flag = src->pr_flag;
 754         dst->pr_lwpid = (id32_t)src->pr_lwpid;
 755         dst->pr_addr = (caddr32_t)src->pr_addr;
 756         dst->pr_wchan = (caddr32_t)src->pr_wchan;
 757         dst->pr_stype = src->pr_stype;
 758         dst->pr_state = src->pr_state;
 759         dst->pr_sname = src->pr_sname;
 760         dst->pr_nice = src->pr_nice;
 761         dst->pr_syscall = src->pr_syscall;
 762         dst->pr_oldpri = src->pr_oldpri;
 763         dst->pr_cpu = src->pr_cpu;
 764         dst->pr_pri = src->pr_pri;
 765         dst->pr_pctcpu = src->pr_pctcpu;
 766 




   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 


  27 #include <sys/types.h>
  28 #include <sys/mkdev.h>
  29 #include <sys/regset.h>
  30 #include <string.h>
  31 
  32 #if defined(__amd64)
  33 #include <sys/fp.h>
  34 #include <ieeefp.h>
  35 #endif
  36 
  37 #include "P32ton.h"
  38 
  39 dev_t
  40 prexpldev(dev32_t d)
  41 {
  42         if (d != (dev32_t)-1L)
  43                 return (makedev((d >> NBITSMINOR32) & MAXMAJ32, d & MAXMIN32));
  44 
  45         return ((dev_t)PRNODEV);
  46 }


 352         dst->pr_zoneid = src->pr_zoneid;
 353         dst->pr_aslwpid = src->pr_aslwpid;
 354         dst->pr_agentid = src->pr_agentid;
 355         dst->pr_sigpend = src->pr_sigpend;
 356         dst->pr_brkbase = src->pr_brkbase;
 357         dst->pr_brksize = src->pr_brksize;
 358         dst->pr_stkbase = src->pr_stkbase;
 359         dst->pr_stksize = src->pr_stksize;
 360 
 361         timestruc_32_to_n(&src->pr_utime, &dst->pr_utime);
 362         timestruc_32_to_n(&src->pr_stime, &dst->pr_stime);
 363         timestruc_32_to_n(&src->pr_cutime, &dst->pr_cutime);
 364         timestruc_32_to_n(&src->pr_cstime, &dst->pr_cstime);
 365 
 366         dst->pr_sigtrace = src->pr_sigtrace;
 367         dst->pr_flttrace = src->pr_flttrace;
 368         dst->pr_sysentry = src->pr_sysentry;
 369         dst->pr_sysexit = src->pr_sysexit;
 370         dst->pr_dmodel = src->pr_dmodel;
 371 
 372         (void) memcpy(&dst->pr_secflags, &src->pr_secflags, sizeof (psecflags_t));
 373 
 374         lwpstatus_32_to_n(&src->pr_lwp, &dst->pr_lwp);
 375 }
 376 
 377 void
 378 lwpsinfo_32_to_n(const lwpsinfo32_t *src, lwpsinfo_t *dst)
 379 {
 380         dst->pr_flag = src->pr_flag;
 381         dst->pr_lwpid = src->pr_lwpid;
 382         dst->pr_addr = src->pr_addr;
 383         dst->pr_wchan = src->pr_wchan;
 384         dst->pr_stype = src->pr_stype;
 385         dst->pr_state = src->pr_state;
 386         dst->pr_sname = src->pr_sname;
 387         dst->pr_nice = src->pr_nice;
 388         dst->pr_syscall = src->pr_syscall;
 389         dst->pr_oldpri = src->pr_oldpri;
 390         dst->pr_cpu = src->pr_cpu;
 391         dst->pr_pri = src->pr_pri;
 392         dst->pr_pctcpu = src->pr_pctcpu;
 393 


 727         dst->pr_zoneid = (id32_t)src->pr_zoneid;
 728         dst->pr_aslwpid = (id32_t)src->pr_aslwpid;
 729         dst->pr_agentid = (id32_t)src->pr_agentid;
 730         dst->pr_sigpend = src->pr_sigpend;
 731         dst->pr_brkbase = (caddr32_t)src->pr_brkbase;
 732         dst->pr_brksize = (size32_t)src->pr_brksize;
 733         dst->pr_stkbase = (caddr32_t)src->pr_stkbase;
 734         dst->pr_stksize = (size32_t)src->pr_stksize;
 735 
 736         timestruc_n_to_32(&src->pr_utime, &dst->pr_utime);
 737         timestruc_n_to_32(&src->pr_stime, &dst->pr_stime);
 738         timestruc_n_to_32(&src->pr_cutime, &dst->pr_cutime);
 739         timestruc_n_to_32(&src->pr_cstime, &dst->pr_cstime);
 740 
 741         dst->pr_sigtrace = src->pr_sigtrace;
 742         dst->pr_flttrace = src->pr_flttrace;
 743         dst->pr_sysentry = src->pr_sysentry;
 744         dst->pr_sysexit = src->pr_sysexit;
 745         dst->pr_dmodel = src->pr_dmodel;
 746 
 747         (void) memcpy(&dst->pr_secflags, &src->pr_secflags, sizeof (psecflags_t));
 748 
 749         lwpstatus_n_to_32(&src->pr_lwp, &dst->pr_lwp);
 750 }
 751 
 752 void
 753 lwpsinfo_n_to_32(const lwpsinfo_t *src, lwpsinfo32_t *dst)
 754 {
 755         dst->pr_flag = src->pr_flag;
 756         dst->pr_lwpid = (id32_t)src->pr_lwpid;
 757         dst->pr_addr = (caddr32_t)src->pr_addr;
 758         dst->pr_wchan = (caddr32_t)src->pr_wchan;
 759         dst->pr_stype = src->pr_stype;
 760         dst->pr_state = src->pr_state;
 761         dst->pr_sname = src->pr_sname;
 762         dst->pr_nice = src->pr_nice;
 763         dst->pr_syscall = src->pr_syscall;
 764         dst->pr_oldpri = src->pr_oldpri;
 765         dst->pr_cpu = src->pr_cpu;
 766         dst->pr_pri = src->pr_pri;
 767         dst->pr_pctcpu = src->pr_pctcpu;
 768