Print this page
NEX-3046 hsfs asserts instead of handling getpage beyond EOF
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Marcel Telka <marcel.telka@nexenta.com>
Revert "NEX-5659 hsfs asserts instead of handling getpage beyond EOF"
This reverts commit c4b53e5f3fdfec5d117f9719bc4b77581f318442.
NEX-5659 hsfs asserts instead of handling getpage beyond EOF
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Marcel Telka <marcel.telka@nexenta.com>
NEX-2974 cannot exec from hsfs since illumos 5405

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/hsfs/hsfs_vnops.c
          +++ new/usr/src/uts/common/fs/hsfs/hsfs_vnops.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  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   22  /*
  23   23   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25      - * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
       25 + * Copyright 2016 Nexenta Systems, Inc.  All rights reserved.
  26   26   * Copyright (c) 2017 by Delphix. All rights reserved.
  27   27   */
  28   28  
  29   29  /*
  30   30   * Vnode operations for the High Sierra filesystem
  31   31   */
  32   32  
  33   33  #include <sys/types.h>
  34   34  #include <sys/t_lock.h>
  35   35  #include <sys/param.h>
↓ open down ↓ 1118 lines elided ↑ open up ↑
1154 1154          pp = NULL;
1155 1155  again:
1156 1156          /* search for page in buffer */
1157 1157          if ((pagefound = page_exists(vp, off)) == 0) {
1158 1158                  /*
1159 1159                   * Need to really do disk IO to get the page.
1160 1160                   */
1161 1161                  if (!calcdone) {
1162 1162                          extension += hp->hs_ra_bytes;
1163 1163  
     1164 +                        len = (extension != 0) ? extension : PAGESIZE;
     1165 +
1164 1166                          /*
1165 1167                           * Some cd writers don't write sectors that aren't
1166 1168                           * used. Also, there's no point in reading sectors
1167 1169                           * we'll never look at.  So, if we're asked to go
1168 1170                           * beyond the end of a file, truncate to the length
1169 1171                           * of that file.
1170 1172                           *
1171 1173                           * Additionally, this behaviour is required by section
1172 1174                           * 6.4.5 of ISO 9660:1988(E).
1173 1175                           */
1174      -                        len = MIN(extension ? extension : PAGESIZE,
1175      -                            filsiz - off);
     1176 +                        if (off < filsiz && off + len > filsiz)
     1177 +                                len = filsiz - off;
1176 1178  
1177      -                        /* A little paranoia. */
1178      -                        ASSERT(len > 0);
1179      -
1180 1179                          /*
1181 1180                           * After all that, make sure we're asking for things
1182      -                         * in units that bdev_strategy() will understand
1183      -                         * (see bug 4202551).
     1181 +                         * in units that bdev_strategy() will understand.
1184 1182                           */
1185 1183                          len = roundup(len, DEV_BSIZE);
1186 1184                          calcdone = 1;
1187 1185                  }
1188 1186  
1189 1187                  pp = pvn_read_kluster(vp, off, seg, addr, &io_off_tmp,
1190 1188                      &io_len_tmp, off, len, 0);
1191 1189  
1192 1190                  if (pp == NULL) {
1193 1191                          /*
↓ open down ↓ 1153 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX