Print this page
OS-881 To workaround OS-580 add support to only invalidate mappings from a single process


  98                         return (set_errno(EINVAL));
  99                 }
 100                 if ((attr & SHARED) && (attr & PRIVATE)) {
 101                         return (set_errno(EINVAL));
 102                 }
 103                 if (((cmd == MC_LOCKAS) || (cmd == MC_LOCK) ||
 104                     (cmd == MC_UNLOCKAS) || (cmd == MC_UNLOCK)) &&
 105                     (error = secpolicy_lock_memory(CRED())) != 0)
 106                         return (set_errno(error));
 107         }
 108         if (attr) {
 109                 attr |= PROT_USER;
 110         }
 111 
 112         switch (cmd) {
 113         case MC_SYNC:
 114                 /*
 115                  * MS_SYNC used to be defined to be zero but is now non-zero.
 116                  * For binary compatibility we still accept zero
 117                  * (the absence of MS_ASYNC) to mean the same thing.

 118                  */
 119                 iarg = (uintptr_t)arg;
 120                 if ((iarg & ~MS_INVALIDATE) == 0)
 121                         iarg |= MS_SYNC;
 122 
 123                 if (((iarg & ~(MS_SYNC|MS_ASYNC|MS_INVALIDATE)) != 0) ||
 124                     ((iarg & (MS_SYNC|MS_ASYNC)) == (MS_SYNC|MS_ASYNC))) {



 125                         error = set_errno(EINVAL);
 126                 } else {
 127                         error = as_ctl(as, addr, len, cmd, attr, iarg, NULL, 0);
 128                         if (error) {
 129                                 (void) set_errno(error);
 130                         }
 131                 }
 132                 return (error);
 133         case MC_LOCKAS:
 134                 if ((uintptr_t)arg & ~(MCL_FUTURE|MCL_CURRENT) ||
 135                     (uintptr_t)arg == 0) {
 136                         return (set_errno(EINVAL));
 137                 }
 138                 break;
 139         case MC_LOCK:
 140         case MC_UNLOCKAS:
 141         case MC_UNLOCK:
 142                 break;
 143         case MC_HAT_ADVISE:
 144                 /*




  98                         return (set_errno(EINVAL));
  99                 }
 100                 if ((attr & SHARED) && (attr & PRIVATE)) {
 101                         return (set_errno(EINVAL));
 102                 }
 103                 if (((cmd == MC_LOCKAS) || (cmd == MC_LOCK) ||
 104                     (cmd == MC_UNLOCKAS) || (cmd == MC_UNLOCK)) &&
 105                     (error = secpolicy_lock_memory(CRED())) != 0)
 106                         return (set_errno(error));
 107         }
 108         if (attr) {
 109                 attr |= PROT_USER;
 110         }
 111 
 112         switch (cmd) {
 113         case MC_SYNC:
 114                 /*
 115                  * MS_SYNC used to be defined to be zero but is now non-zero.
 116                  * For binary compatibility we still accept zero
 117                  * (the absence of MS_ASYNC) to mean the same thing.
 118                  * Binary compatibility is not an issue for MS_INVALCURPROC.
 119                  */
 120                 iarg = (uintptr_t)arg;
 121                 if ((iarg & ~MS_INVALIDATE) == 0)
 122                         iarg |= MS_SYNC;
 123 
 124                 if (((iarg &
 125                     ~(MS_SYNC|MS_ASYNC|MS_INVALIDATE|MS_INVALCURPROC)) != 0) ||
 126                     ((iarg & (MS_SYNC|MS_ASYNC)) == (MS_SYNC|MS_ASYNC)) ||
 127                     ((iarg & (MS_INVALIDATE|MS_INVALCURPROC)) ==
 128                     (MS_INVALIDATE|MS_INVALCURPROC))) {
 129                         error = set_errno(EINVAL);
 130                 } else {
 131                         error = as_ctl(as, addr, len, cmd, attr, iarg, NULL, 0);
 132                         if (error) {
 133                                 (void) set_errno(error);
 134                         }
 135                 }
 136                 return (error);
 137         case MC_LOCKAS:
 138                 if ((uintptr_t)arg & ~(MCL_FUTURE|MCL_CURRENT) ||
 139                     (uintptr_t)arg == 0) {
 140                         return (set_errno(EINVAL));
 141                 }
 142                 break;
 143         case MC_LOCK:
 144         case MC_UNLOCKAS:
 145         case MC_UNLOCK:
 146                 break;
 147         case MC_HAT_ADVISE:
 148                 /*