From owner-svn-src-all@freebsd.org Tue Apr 18 18:19:03 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08A8FD44838 for ; Tue, 18 Apr 2017 18:19:03 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E0D01130E for ; Tue, 18 Apr 2017 18:19:02 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 868047c8-2463-11e7-bfb5-0d159cd3c324 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id 868047c8-2463-11e7-bfb5-0d159cd3c324; Tue, 18 Apr 2017 18:19:14 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id v3IIIstG009242; Tue, 18 Apr 2017 12:18:54 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1492539534.96207.33.camel@freebsd.org> Subject: Re: svn commit: r317097 - in head/sys/boot: common efi/libefi i386/libi386 mips/beri/loader powerpc/ps3 uboot/lib usb/storage userboot/userboot From: Ian Lepore To: Toomas Soome , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Tue, 18 Apr 2017 12:18:54 -0600 In-Reply-To: <201704181807.v3II7sJ4023532@repo.freebsd.org> References: <201704181807.v3II7sJ4023532@repo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Apr 2017 18:19:03 -0000 On Tue, 2017-04-18 at 18:07 +0000, Toomas Soome wrote: > Author: tsoome > Date: Tue Apr 18 18:07:54 2017 > New Revision: 317097 > URL: https://svnweb.freebsd.org/changeset/base/317097 > > Log: >   loader: F_READ/F_WRITE should be checked against masked flag >    >   The work to make it possible to avoid bcache via using F_NORA > modifier did >   miss the fact that not all loader platforms are using the bcache, > and so >   it is possible the modifier is not cleared, as bcache strategy > function is >   not used. >    >   For fix, we make sure the checks are dont with masked flag. >    >   This patch does fix boot for platforms which do not use bcache. >    >   Reported by: emaste >   Reviewed by: emaste >   Differential Revision: https://reviews.freebsd.org/D10422 > Now the boot fails on arm with: Found U-Boot device: disk   Checking unit=0 slice= partition=...disk0: real size != size -- Ian > Modified: >   head/sys/boot/common/md.c >   head/sys/boot/efi/libefi/efipart.c >   head/sys/boot/i386/libi386/bioscd.c >   head/sys/boot/i386/libi386/biosdisk.c >   head/sys/boot/mips/beri/loader/beri_disk_cfi.c >   head/sys/boot/mips/beri/loader/beri_disk_sdcard.c >   head/sys/boot/powerpc/ps3/ps3cdrom.c >   head/sys/boot/powerpc/ps3/ps3disk.c >   head/sys/boot/uboot/lib/disk.c >   head/sys/boot/usb/storage/umass_loader.c >   head/sys/boot/userboot/userboot/userboot_disk.c > > Modified: head/sys/boot/common/md.c > ===================================================================== > ========= > --- head/sys/boot/common/md.c Tue Apr 18 17:39:20 2017 > (r317096) > +++ head/sys/boot/common/md.c Tue Apr 18 18:07:54 2017 > (r317097) > @@ -106,7 +106,7 @@ md_strategy(void *devdata, int rw, daddr >   if (rsize != NULL) >   *rsize = size; >   > - switch (rw) { > + switch (rw & F_MASK) { >   case F_READ: >   bcopy(md_image.start + ofs, buf, size); >   return (0); > > Modified: head/sys/boot/efi/libefi/efipart.c > ===================================================================== > ========= > --- head/sys/boot/efi/libefi/efipart.c Tue Apr 18 17:39:20 > 2017 (r317096) > +++ head/sys/boot/efi/libefi/efipart.c Tue Apr 18 18:07:54 > 2017 (r317097) > @@ -819,7 +819,7 @@ efipart_readwrite(EFI_BLOCK_IO *blkio, i >   if ((blk + nblks - 1) > blkio->Media->LastBlock) >   return (EIO); >   > - switch (rw) { > + switch (rw & F_MASK) { >   case F_READ: >   status = blkio->ReadBlocks(blkio, blkio->Media- > >MediaId, blk, >       nblks * blkio->Media->BlockSize, buf); > > Modified: head/sys/boot/i386/libi386/bioscd.c > ===================================================================== > ========= > --- head/sys/boot/i386/libi386/bioscd.c Tue Apr 18 17:39:20 > 2017 (r317096) > +++ head/sys/boot/i386/libi386/bioscd.c Tue Apr 18 18:07:54 > 2017 (r317097) > @@ -268,7 +268,7 @@ bc_realstrategy(void *devdata, int rw, d >   return (EINVAL); >  #endif >   > - if (rw != F_READ) > + if ((rw & F_MASK) != F_READ) >   return(EROFS); >   dev = (struct i386_devdesc *)devdata; >   unit = dev->d_unit; > > Modified: head/sys/boot/i386/libi386/biosdisk.c > ===================================================================== > ========= > --- head/sys/boot/i386/libi386/biosdisk.c Tue Apr 18 17:39:20 > 2017 (r317096) > +++ head/sys/boot/i386/libi386/biosdisk.c Tue Apr 18 18:07:54 > 2017 (r317097) > @@ -618,7 +618,7 @@ bd_realstrategy(void *devdata, int rw, d >   DEBUG("short read %d", blks); >      } >   > -    switch(rw){ > +    switch (rw & F_MASK) { >      case F_READ: >   DEBUG("read %d from %lld to %p", blks, dblk, buf); >   > > Modified: head/sys/boot/mips/beri/loader/beri_disk_cfi.c > ===================================================================== > ========= > --- head/sys/boot/mips/beri/loader/beri_disk_cfi.c Tue Apr 18 > 17:39:20 2017 (r317096) > +++ head/sys/boot/mips/beri/loader/beri_disk_cfi.c Tue Apr 18 > 18:07:54 2017 (r317097) > @@ -73,6 +73,7 @@ beri_cfi_disk_strategy(void *devdata, in >  { >   int error; >   > + flag &= F_MASK; >   if (flag == F_WRITE) >   return (EROFS); >   if (flag != F_READ) > > Modified: head/sys/boot/mips/beri/loader/beri_disk_sdcard.c > ===================================================================== > ========= > --- head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Tue Apr > 18 17:39:20 2017 (r317096) > +++ head/sys/boot/mips/beri/loader/beri_disk_sdcard.c Tue Apr > 18 18:07:54 2017 (r317097) > @@ -73,6 +73,7 @@ beri_sdcard_disk_strategy(void *devdata, >  { >   int error; >   > + flag &= F_MASK; >   if (flag == F_WRITE) >   return (EROFS); >   if (flag != F_READ) > > Modified: head/sys/boot/powerpc/ps3/ps3cdrom.c > ===================================================================== > ========= > --- head/sys/boot/powerpc/ps3/ps3cdrom.c Tue Apr 18 17:39:20 > 2017 (r317096) > +++ head/sys/boot/powerpc/ps3/ps3cdrom.c Tue Apr 18 18:07:54 > 2017 (r317097) > @@ -83,6 +83,7 @@ static int ps3cdrom_strategy(void *devda >   >   DEBUG("d_unit=%u dblk=%llu size=%u", dev->d_unit, dblk, > size); >   > + flag &= F_MASK; >   if (flag != F_READ) { >   dev_printf(dev, "write operation is not > supported!"); >   return EROFS; > > Modified: head/sys/boot/powerpc/ps3/ps3disk.c > ===================================================================== > ========= > --- head/sys/boot/powerpc/ps3/ps3disk.c Tue Apr 18 17:39:20 > 2017 (r317096) > +++ head/sys/boot/powerpc/ps3/ps3disk.c Tue Apr 18 18:07:54 > 2017 (r317097) > @@ -115,6 +115,7 @@ static int ps3disk_strategy(void *devdat >   struct open_dev *od = (struct open_dev *) dev->d_disk.data; >   int err; >   > + flag &= F_MASK; >   if (flag != F_READ) { >   dev_printf(dev, "write operation is not > supported!\n"); >   return EROFS; > > Modified: head/sys/boot/uboot/lib/disk.c > ===================================================================== > ========= > --- head/sys/boot/uboot/lib/disk.c Tue Apr 18 17:39:20 2017 > (r317096) > +++ head/sys/boot/uboot/lib/disk.c Tue Apr 18 18:07:54 2017 > (r317097) > @@ -149,6 +149,7 @@ stor_strategy(void *devdata, int rw, dad >   daddr_t bcount; >   int err; >   > + rw &= F_MASK; >   if (rw != F_READ) { >   stor_printf("write attempt, operation not > supported!\n"); >   return (EROFS); > > Modified: head/sys/boot/usb/storage/umass_loader.c > ===================================================================== > ========= > --- head/sys/boot/usb/storage/umass_loader.c Tue Apr 18 > 17:39:20 2017 (r317096) > +++ head/sys/boot/usb/storage/umass_loader.c Tue Apr 18 > 18:07:54 2017 (r317097) > @@ -92,6 +92,7 @@ umass_disk_strategy(void *devdata, int f >   if (rsizep != NULL) >   *rsizep = 0; >   > + flag &= F_MASK; >   if (flag == F_WRITE) { >   if (usb_msc_write_10(umass_uaa.device, 0, dblk, size > >> 9, buf) != 0) >   return (EINVAL); > > Modified: head/sys/boot/userboot/userboot/userboot_disk.c > ===================================================================== > ========= > --- head/sys/boot/userboot/userboot/userboot_disk.c Tue Apr 18 > 17:39:20 2017 (r317096) > +++ head/sys/boot/userboot/userboot/userboot_disk.c Tue Apr 18 > 18:07:54 2017 (r317097) > @@ -211,6 +211,7 @@ userdisk_realstrategy(void *devdata, int >   size_t resid; >   int rc; >   > + rw &= F_MASK; >   if (rw == F_WRITE) >   return (EROFS); >   if (rw != F_READ) >