Print this page
OS-3602 lxbrand LTP recv* tests failing on MSG_ERRQUEUE flag
OS-3600 lxbrand 32bit cannot boot with OS-3594 fix
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
OS-3594 lx brand: need support for MAP_32BIT

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/grow.c
          +++ new/usr/src/uts/common/os/grow.c
↓ open down ↓ 11 lines elided ↑ open up ↑
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22      -/* Copyright 2013 OmniTI Computer Consulting, Inc. All rights reserved. */
       22 +/*
       23 + * Copyright 2013 OmniTI Computer Consulting, Inc. All rights reserved.
       24 + * Copyright (c) 2014, Joyent, Inc. All rights reserved.
       25 + */
  23   26  
  24   27  /*
  25   28   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  26   29   * Use is subject to license terms.
  27   30   */
  28   31  
  29   32  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  30   33  /*        All Rights Reserved   */
  31   34  
  32   35  #include <sys/types.h>
↓ open down ↓ 12 lines elided ↑ open up ↑
  45   48  #include <sys/cred.h>
  46   49  #include <sys/vnode.h>
  47   50  #include <sys/vfs.h>
  48   51  #include <sys/vm.h>
  49   52  #include <sys/file.h>
  50   53  #include <sys/mman.h>
  51   54  #include <sys/vmparam.h>
  52   55  #include <sys/fcntl.h>
  53   56  #include <sys/lwpchan_impl.h>
  54   57  #include <sys/nbmlock.h>
       58 +#include <sys/brand.h>
  55   59  
  56   60  #include <vm/hat.h>
  57   61  #include <vm/as.h>
  58   62  #include <vm/seg.h>
  59   63  #include <vm/seg_dev.h>
  60   64  #include <vm/seg_vn.h>
  61   65  
  62   66  int use_brk_lpg = 1;
  63   67  int use_stk_lpg = 1;
  64   68  
↓ open down ↓ 470 lines elided ↑ open up ↑
 535  539                   * No user supplied address or the address supplied was not
 536  540                   * available.
 537  541                   */
 538  542                  map_addr(addrp, len, off, vacalign, flags);
 539  543          }
 540  544          if (*addrp == NULL)
 541  545                  return (ENOMEM);
 542  546          return (0);
 543  547  }
 544  548  
      549 +caddr_t
      550 +map_userlimit(proc_t *pp, struct as *as, int flags)
      551 +{
      552 +        if (flags & _MAP_LOW32) {
      553 +                if (PROC_IS_BRANDED(pp) && BROP(pp)->b_map32limit != NULL) {
      554 +                        return ((caddr_t)(uintptr_t)BROP(pp)->b_map32limit(pp));
      555 +                } else {
      556 +                        return ((caddr_t)_userlimit32);
      557 +                }
      558 +        }
 545  559  
      560 +        return (as->a_userlimit);
      561 +}
      562 +
      563 +
 546  564  /*
 547  565   * Used for MAP_ANON - fast way to get anonymous pages
 548  566   */
 549  567  static int
 550  568  zmap(struct as *as, caddr_t *addrp, size_t len, uint_t uprot, int flags,
 551  569      offset_t pos)
 552  570  {
 553  571          struct segvn_crargs vn_a;
 554  572          int error;
 555  573  
 556  574          if (((PROT_ALL & uprot) != uprot))
 557  575                  return (EACCES);
 558  576  
 559  577          if ((flags & MAP_FIXED) != 0) {
 560      -                caddr_t userlimit;
 561      -
 562  578                  /*
 563  579                   * Use the user address.  First verify that
 564  580                   * the address to be used is page aligned.
 565  581                   * Then make some simple bounds checks.
 566  582                   */
 567  583                  if (((uintptr_t)*addrp & PAGEOFFSET) != 0)
 568  584                          return (EINVAL);
 569  585  
 570      -                userlimit = flags & _MAP_LOW32 ?
 571      -                    (caddr_t)USERLIMIT32 : as->a_userlimit;
 572      -                switch (valid_usr_range(*addrp, len, uprot, as, userlimit)) {
      586 +                switch (valid_usr_range(*addrp, len, uprot, as,
      587 +                    map_userlimit(as->a_proc, as, flags))) {
 573  588                  case RANGE_OKAY:
 574  589                          break;
 575  590                  case RANGE_BADPROT:
 576  591                          return (ENOTSUP);
 577  592                  case RANGE_BADADDR:
 578  593                  default:
 579  594                          return (ENOMEM);
 580  595                  }
 581  596          }
 582  597          /*
↓ open down ↓ 147 lines elided ↑ open up ↑
 730  745           * "write only" mappings are hard to do since normally we do
 731  746           * the read from the file before the page can be written.
 732  747           */
 733  748          if (((maxprot & uprot) != uprot) || (fp->f_flag & FREAD) == 0)
 734  749                  return (EACCES);
 735  750  
 736  751          /*
 737  752           * If the user specified an address, do some simple checks here
 738  753           */
 739  754          if ((flags & MAP_FIXED) != 0) {
 740      -                caddr_t userlimit;
 741      -
 742  755                  /*
 743  756                   * Use the user address.  First verify that
 744  757                   * the address to be used is page aligned.
 745  758                   * Then make some simple bounds checks.
 746  759                   */
 747  760                  if (((uintptr_t)*addrp & PAGEOFFSET) != 0)
 748  761                          return (EINVAL);
 749      -
 750      -                userlimit = flags & _MAP_LOW32 ?
 751      -                    (caddr_t)USERLIMIT32 : as->a_userlimit;
 752      -                switch (valid_usr_range(*addrp, len, uprot, as, userlimit)) {
      762 +                switch (valid_usr_range(*addrp, len, uprot, as,
      763 +                    map_userlimit(curproc, as, flags))) {
 753  764                  case RANGE_OKAY:
 754  765                          break;
 755  766                  case RANGE_BADPROT:
 756  767                          return (ENOTSUP);
 757  768                  case RANGE_BADADDR:
 758  769                  default:
 759  770                          return (ENOMEM);
 760  771                  }
 761  772          }
 762  773  
↓ open down ↓ 281 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX