Commit Graph

1039 Commits

Author SHA1 Message Date
Toomas Soome
3f247eab7a loader: biosmem allocate heap just below 4GB
The current biosmem code is walking bios smap entries and looking for smap
entry just below 4GB line, if there is such entry, its base and size is set
for heap base and size. Instead of entry base, we should use last HEAP_MIN
(currently 64MB) bytes just below 4GB, to make maximum space for kernel and
modules.

The problem was revealed on ASUS B350M-A system board, an AMD Ryzen 3 1200 CPU

memory map:

SMAP type=01 base=0000000000000000 len=000000000009d400 attr=01
SMAP type=02 base=000000000009d400 len=0000000000002c00 attr=01
SMAP type=02 base=00000000000e0000 len=0000000000020000 attr=01
SMAP type=01 base=0000000000100000 len=0000000009c00000 attr=01
SMAP type=02 base=0000000009d00000 len=0000000000300000 attr=01
SMAP type=01 base=000000000a000000 len=00000000be69b000 attr=01
SMAP type=03 base=00000000c869b000 len=0000000000016000 attr=01
SMAP type=01 base=00000000c86b1000 len=00000000124e7000 attr=01
SMAP type=02 base=00000000dab98000 len=0000000000138000 attr=01
SMAP type=03 base=00000000dacd0000 len=0000000000008000 attr=01
SMAP type=01 base=00000000dacd8000 len=0000000000100000 attr=01
SMAP type=04 base=00000000dadd8000 len=00000000003b3000 attr=01
SMAP type=02 base=00000000db18b000 len=0000000000d42000 attr=01
SMAP type=01 base=00000000dbecd000 len=0000000002133000 attr=01
SMAP type=01 base=0000000100000000 len=000000011f380000 attr=01
SMAP type=02 base=00000000de000000 len=0000000002000000 attr=01
SMAP type=02 base=00000000f8000000 len=0000000004000000 attr=01
SMAP type=02 base=00000000fdf00000 len=0000000000100000 attr=01
SMAP type=02 base=00000000fea00000 len=0000000000010000 attr=01
SMAP type=02 base=00000000feb80000 len=0000000000082000 attr=01
SMAP type=02 base=00000000fec10000 len=0000000000001000 attr=01
SMAP type=02 base=00000000fec30000 len=0000000000001000 attr=01
SMAP type=02 base=00000000fed00000 len=0000000000001000 attr=01
SMAP type=02 base=00000000fed40000 len=0000000000005000 attr=01
SMAP type=02 base=00000000fed80000 len=0000000000010000 attr=01
SMAP type=02 base=00000000fedc2000 len=000000000000e000 attr=01
SMAP type=02 base=00000000fedd4000 len=0000000000002000 attr=01
SMAP type=02 base=00000000fee00000 len=0000000000100000 attr=01
SMAP type=02 base=00000000ff000000 len=0000000001000000 attr=01

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D12368
2017-09-18 15:17:01 +00:00
Toomas Soome
8b448cf1d6 loader: biosmem.c cstyle cleanup
No functional changes, just cleanup.

Reviewed by:	allanjude, imp
Differential Revision:	https://reviews.freebsd.org/D12370
2017-09-14 16:42:29 +00:00
Warner Losh
868cb4f19e Remove useless 'static' for an enum definition.
Sponsored by: Netflix
2017-08-26 18:30:03 +00:00
Maxim Sobolev
c7e10205ae Make spinconsole platform independent and hook it up into EFI loader on
i386 and amd64. Not enabled on ARMs, those are lacking timer routines.

MFC after:	2 moths
Sponsored by:	Sippy Software, Inc.
2017-08-25 17:29:48 +00:00
Ryan Libby
2473c1b145 i386/boot2: -fno-asynchronous-unwind-tables for gcc
The amd64 build of boot2 was failing with gcc 6.3.0 due to being more
than 1 kB too large. It was apparently generating a .eh_frame section
which was not being removed by objcopy -S. The .eh_frame section seems
to be mandatory per the amd64 ABI, but boot2 is compiled for i386 (uses
-m32), and therefore should be optional in this context. Suppress
generation of .eh_frame with the -fno-asynchronous-unwind-tables flag to
gcc. This saves 1348 bytes (the limit is 7680 bytes).

Reviewed by:	dim, imp
Approved by:	markj (mentor)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D11928
2017-08-09 20:13:49 +00:00
Enji Cooper
1ef2a611de Revert r321969
My change had good intentions, but the implementation was incorrect:
- printf was returning the number of characters in the format string
  plus the NUL, but failed in two regards implementation wise:
-- the pathological case, printf(""), wasn't being handled properly since
   the pointer is always incremented, so the value returned would be
   off-by-one.
-- printf(3) reports the number of characters printed post-conversion via
   vfprintf, etc.
- putchar(3) should return the character printed or EOF, not the number
  of characters output to the screen.

My goal in making the change (again) was to increase parity, but as bde
pointed out these are freestanding functions, so they don't have to
conform to libc/POSIX. I argued that the functions should be named
differently since the implementation is different enough to warrant it
and to allow boot2 code to be usable when linked against sys/boot and
libstand and other libraries in base. I have no interest in pushing
this change forward more though, as the original concern I had behind
the change with zfsboottest was resolved in r321849 and r321852. The
next person that updates the toolchain gets to deal with the
inconsistency if it's flagged by a newer compiler.

MFC after:	1 month
Reported by:	ed, markj
2017-08-03 13:50:46 +00:00
Enji Cooper
b9fe1d4f15 Fix the return types for printf and putchar to match their libc and
POSIX equivalents

Both printf and putchar return int, not void.

This will allow code that leverages the libcalls and checks/rely on the
return type to interchangeably between loader code and non-loader
code.

MFC after:	1 month
2017-08-03 05:27:05 +00:00
Toomas Soome
ee059e6369 loader: chain load relocate data declaration is bad
The implementation is using fixed size array allocated in asm module,
need to use proper array declaration for C source.

CID:		1376405
Reported by:	Coverity, cem
Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D11321
2017-06-29 04:33:55 +00:00
Ed Maste
22398b764e Allow Clang's integrated assembler to assemble boot0
dim@ compared clang IAS-built and GNU as-built boot0 and found them
equivalent.  IAS encoded one instruction using two bytes where GNU as
used three, and another instruction using three bytes where GNU as used
two.  The net result is equivalent and tested, so there is no need to
force IAS off for boot0.
2017-06-23 18:41:49 +00:00
Toomas Soome
769bad9f8a Add chain loader support for loader
Implement simple chain loader in loader; this update does add chain command,
taking device or file as argument to load and start new boot loader.

In case of BIOS, the chain will read the boot block to address 0000:7c00 and
jumps on it. In case of UEFI, the chain command is to be used with efi
application, typically stored in EFI System Partition.

The update also does add simple menu entry, if the variable chain_disk is set.
The value of the variable chain_disk is used as argument for chain loading.

Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D5992
2017-06-16 20:08:44 +00:00
Baptiste Daroussin
41131c64be Followup on the user-class changes
Reported by:	Jose Luis Duran (via github)
2017-05-28 18:31:13 +00:00
Baptiste Daroussin
b5b274ce12 Catch with the change in the user class 2017-05-27 14:07:46 +00:00
Baptiste Daroussin
4e2a7b5c99 Capitalize DHCP
Reported by:	danfe
2017-05-27 13:55:20 +00:00
Baptiste Daroussin
aff810f1b2 Document recent changes on pxeboot 2017-05-27 13:26:18 +00:00
Baptiste Daroussin
5fe86cd909 Always build tftpfs support along with nfs for pxeboot
This change was already done for loader.efi
2017-05-27 12:20:13 +00:00
Toomas Soome
136b6a0f5f libstand: increase nfs max read size to 16k
With ip fragment reassembly implemented, it makes sense to allow
larger nfs reads. Note due to loader heap size limit, we do not want
to set too large maximum read size. Also we do not change default read size.

Reviewed by:	bcr, allanjude
Differential Revision:	https://reviews.freebsd.org/D10754
2017-05-16 17:35:05 +00:00
Bryan Drewery
07676084ec DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-05-09 01:48:23 +00:00
Toomas Soome
da8fb057e5 loader: network read rework
The current read from network is working from up to down - we have some
protocol needing the data from the network, so we build the buffer space
for that protocol, add the extra space for headers and pass this buffer
down to be filled by nif get call in hope, we have guessed the incoming
packet size right. Amazingly enough this approach mostly does work, but
not always...

So, this update does work from down to up - we allocate buffer (based
on MTU or frame size info), fill it up, and pass on for upper layers.
The obvious problem is that when we should free the buffer - if at all.

In the current implementation the upper layer will free the packet on error
or when the packet is no longer needed.

While working on the issue, the additional issue did pop up - the bios
implementation does not have generic get/put interface but is using pxe
udpsend/udpreceive instead. So the udp calls are gone and undi interface
is implemented instead. Which in turn means slight other changes as we
do not need to have duplicated pxe implementation and can just use dev_net.

To align packet content, the actual read from nic is using shifted buffer by
ETHER_ALIGN (2).

Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D10232
2017-05-06 20:32:27 +00:00
Baptiste Daroussin
a872bf12f8 distinguish NFS versus TFTP boot by rootpath
Don't use DHCP 150 option to decide which protocol use to netboot. When
root-path includes ip address - go thru NFS, if ip address not exists in
root-path - go thru TFTP from server which ip address is in next-server.  But
there is one limitation - only one tftp server in network to provide loader and
everything else.  Does enybody use more than only one?

Submitted by:	kczekirda
Sponsored by:	Oktawave
MFC after:	3 weeks
Relnote:	Yes
Differential Revision:	https://reviews.freebsd.org/D8740
2017-05-06 19:23:58 +00:00
Toomas Soome
f6bd3d520f zfsboot: drvsize() may be unusable on some systems
From user report, the errors are seen:
error 1
error 1
gptzfsboot: error 1 lba 4294967288
gptzfsboot: error 1 lba 1
gptzfsboot: no ZFS pools located, can't boot

The first two errors above are from issuing INT13 EAX=0x4800, meaning we
need to check if EDD is available and use EAX=0x800 if not.

For an workaround I'm using the similar idea as in biosdisk.c - first probe
ah=8h, then check if we have EDD.

Note we would like to see the correct disk size info, but we *may*
get away with anything >64MB, so we could at least test 2 zfs pool labels
on whole disk setup and not to freak out the INT13 interface.

If we get away with initial disk probing, then we have partition sizes from
the partition table and we should be able to complete the disk probing.

Note: this update does not provide full fix to all errors, but we get
the drvsize() errors removed.

Reported by:	Michael W. Lucas
Reviewed by:	julian
Differential Revision:	https://reviews.freebsd.org/D10591
2017-05-04 05:26:37 +00:00
Toomas Soome
c9296b3227 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
2017-04-18 18:07:54 +00:00
Roger Pau Monné
6696a07ed5 loader/multiboot: fix multiboot loading
The current multiboot loader code doesn't clean the metadata added to the
kernel after the bi_load64 dry run, which breaks accounting of the required
memory for the metadata.

This issue didn't show itself before because all the metadata items where small
(8bytes), but after r316343 there's a big blob in the metadata, which triggers
this. Fix it by cleaning the metadata added to the kernel after the bi_load64
dry run. Also add a comment describing the memory layout when booting using
multiboot (Xen Dom0).

This unbreaks booting a FreeBSD/Xen Dom0 after r316343.

MFC after:	3 weeks
Sponsored by:	Citrix Systems R&D
2017-04-13 09:59:12 +00:00
Benno Rice
8fbb1a2916 In r298230 the value of HEAP_MIN was changed from 3MB to 64MB. Correct a
comment that was still referencing the 3MB value.

Sponsored by:	Dell EMC Isilon
Discussed with:	jhb
2017-04-07 15:41:49 +00:00
Toomas Soome
e41fab8d40 loader: zfs reader should check all labels
The current zfs reader is only checking first label from each device, however,
we do have 4 labels on device and we should check all 4 to be protected
against disk failures and incomplete label updates.

The difficulty is about the fact that 2 label copies are in front of the
pool data, and 2 are at the end, which means, we have to know the size of
the pool data area.

Since we have now the mechanism from common/disk.c to use the partition
information, it does help us in this task; however, there are still some
corner cases.

Namely, if the pool is created without partition, directly on the disk,
and firmware will give us the wrong size for the disk, we only can check
the first two label copies.

Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D10203
2017-04-06 18:17:29 +00:00
Allan Jude
f2f3d2422d Small cleanup to make i386/loader match efi/loader boot environment code 2017-04-03 04:29:57 +00:00
Allan Jude
ec5c0e5be9 Implement boot-time encryption key passing (keybuf)
This patch adds a general mechanism for providing encryption keys to the
kernel from the boot loader. This is intended to enable GELI support at
boot time, providing a better mechanism for passing keys to the kernel
than environment variables. It is designed to be extensible to other
applications, and can easily handle multiple encrypted volumes with
different keys.

This mechanism is currently used by the pending GELI EFI work.
Additionally, this mechanism can potentially be used to interface with
GRUB, opening up options for coreboot+GRUB configurations with completely
encrypted disks.

Another benefit over the existing system is that it does not require
re-deriving the user key from the password at each boot stage.

Most of this patch was written by Eric McCorkle. It was extended by
Allan Jude with a number of minor enhancements and extending the keybuf
feature into boot2.

GELI user keys are now derived once, in boot2, then passed to the loader,
which reuses the key, then passes it to the kernel, where the GELI module
destroys the keybuf after decrypting the volumes.

Submitted by:	Eric McCorkle <eric@metricspace.net> (Original Version)
Reviewed by:	oshogbo (earlier version), cem (earlier version)
MFC after:	3 weeks
Relnotes:	yes
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D9575
2017-04-01 05:05:22 +00:00
Allan Jude
9f67bd210a Add explicit_bzero() to libstand, and switch GELIBoot to using it
Make sure sensitive memory is properly cleared when finished with it

Reviewed by:	Eric McCorkle <eric@metricspace.net>
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D9798
2017-03-31 00:04:32 +00:00
Toomas Soome
cb83812c70 Remove OLD_NFSV2 from loader and libstand
We have parallel NFSv2 and NFSv3 reader implementations, only configurable at
build time, defaulting to v3. Remove v2.

Reviewed by:	allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D10206
2017-03-30 19:32:25 +00:00
Warner Losh
0deb09e26d xfsread inlined uses more space, so remove the inline tag. This
doesn't help clang, but buys us another 32 bytes for gcc 4.2.1. It
also eliminates a warning from gcc 6.3.0 that says inlining this would
be unhelpful.
2017-03-29 18:35:20 +00:00
Enji Cooper
94697f90d6 Parameterize out 7680 (15 * 512) as BOOT2SIZE, similar to sys/boot/i386/zfsboot/...
This is being done to make it easier to change in the future--this action might be
needed sooner rather than later because of gcc 6.3.0 bailing, stating that there
is negative free space left (deficit) in the boot2 bootloader.

MFC after:	2 months
Sponsored by:	Dell EMC Isilon
2017-03-29 09:30:03 +00:00
Toomas Soome
b1740d31c8 loader: move bios getsecs into time.c
Move the time related function into time.c, keep the same logic as libefi.

Reviewed by:	allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D10058
2017-03-28 21:47:12 +00:00
Enji Cooper
c20d3baeb0 Don't hardcode input files for stage 1/2 bootloaders; use .ALLSRC instead
This is a better pattern to follow when creating the bootloaders and doing
the relevant space checks to make sure that the sizes aren't exceeded (and
thus, copy-pasting is a bit less error prone).

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-03-28 21:35:18 +00:00
Enji Cooper
1020003cc6 Use NO_WCAST_ALIGN instead of spelling it out as -Wno-cast-align in CFLAGS
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-03-28 20:30:33 +00:00
Warner Losh
df4fcca522 Remove -fno-guess-branch-probability and -fno-unit-at-a-time.
bde enabled -fno-guess-branch-probability in 2003, well before our
current compiler was imported. At the time it produced weirdly orded
code. It no longer does that. It also saves 0-4 bytes depending on
other options.

kan disabled unit-at-a-time in 2004 because it badly mangled boot2 so
it wouldn't work. That too was before the 4.2.1 compiler, where it no
longer does that. This saves 44 bytes.

I had planned to document why they were needed, but when I discovered
their antiquity, I removed them and boot2 still works and is
smaller. In qemu, the old and new boot2's behaved identically.

These are gcc specific hacks, and won't affect clang-built boot2
at all.
2017-03-28 18:09:01 +00:00
Warner Losh
f2d4cc2f5f Simply retire the sedification of the boot2.s file. It's been obsolete
for years.

clang before 96 free after 100 (+4)
gcc before 163 free after 156 (-7)

Suggested by: bde@
Sponsored by: Netflix
2017-03-28 07:58:27 +00:00
Enji Cooper
156715d048 gpt*boot: Save a bit more memory when LOADER_NO_GELI_SUPPORT is specified
Don't compile geliargs into the image and don't pass geliargs to the respective
bootloader code via __exec(..).

This saves a negligible amount of memory/disk space.

X-MFC with:	r296963
Obtained from:	Isilon OneFS
Sponsored by:	Dell EMC Isilon
2017-03-28 07:10:35 +00:00
Enji Cooper
fa7083e0a0 Unbreak compilation with gcc 4.2.1
-Wtentative-definition-incomplete-type isn't implemented for 4.2.1

X-MFC with:	r304321
Sponsored by:	Dell EMC Isilon
2017-03-28 07:01:40 +00:00
Warner Losh
fa370b1a25 Fix build with path names with 'align' or 'nop' in them.
clang is now inserting .file directives with the entire path in
them. This is fine, except that our sed peephole optimizer removes
them if ${SRCTOP} or ${OBJTOP} contains 'align' or 'nop', leading to
build failures. The sed peephole optimizer removes useful things for
boot2 when used with clang, so restrict its use to gcc. Also, gcc no
longer generates nops to pad things, so there's no point in removing
it. Specialize the optimization to just removing the .align 4 lines to
preclude inadvertant path matching.

Sponsored by: Netflix
Commit brought to you the path: /home/xxx/NCD-3592-logsynopts/FreeBSD
2017-03-27 22:53:36 +00:00
Toomas Soome
c1e968fb62 loader: verify the value from dhcp.interface-mtu and use snprintf to set mtu
Since the uset can set dhcp.interface-mtu, we need to try to validate the
value. So we verify if the conversion to int is successful and we will not
allow to set value greater than max IPv4 packet size.

Also use snprintf for safety.

Reviewed by:	allanjude, bapt
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D8492
2017-03-20 22:20:17 +00:00
Toomas Soome
11e46b7133 loader: pxe.h constants have wrong values
FLTR_PRMSCS should be 0x4 and FLTR_SRC_RTG should be 0x8

PXE Specification 2.1 PXENV_UNDI_OPEN, page 59.

http://download.intel.com/design/archives/wfm/downloads/pxespec.pdf

Reviewed by:	allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D10056
2017-03-20 18:15:36 +00:00
Toomas Soome
429528f376 loader: biosdisk should report IO error from INT13
We should be more verbose about read errors from biosdisk, except filter
out the floppy controller errors, which apparently are resulting from
read attempt from device without the media present.

Reviewed by:	allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D10032
2017-03-16 21:34:14 +00:00
Toomas Soome
b91aad35da loader: remove open_disk cache
As we provide the disk size verification and correction via disk_ioctl
and disk state provided by disk_open(), we can not share the partition
state in disk_devdesc structure. Also the sharing does make a lot of sense
with ufs, as only one partition is open at any given time, but zfs pools
do keep the disk devices open.

To make sure we do get the correct information about the open device,
just remove the cache.

Reviewed by:	allanjude, smh
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D9757
2017-03-16 12:04:43 +00:00
Sean Bruno
09dced1093 r314948 seems to be missing a variable or two that will break
TFTP/MFSRoot booting via PXE.  For the TFTP_LOADER case, go ahead and
fire off the old bootp() request to ensure that whatever is missing is
populated.

Sponsored by:	Limelight Networks
2017-03-10 17:14:08 +00:00
Mariusz Zaborski
4cd385d9e9 Try to extract the RFC1048 data from PXE. If we get enough info we can skip
the bootp(). It removes unnecessary DHCP request from pxeloader.

Submitted by:	kczekirda
Sponsored by:	Oktawave
Initiated by:	Matthew Dillon
Reviewed by:	smh, gnn, bapt, oshogbo
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D9847
2017-03-09 06:01:24 +00:00
Mariusz Zaborski
ecb76386c8 Some style(9) fixes. No functional changes.
Submitted by:	kczekirda
Sponsored by:	Oktawave
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D9395
2017-03-09 05:13:07 +00:00
Mariusz Zaborski
85b92f82b6 Remove unused macro from common/drv.c.
When we was compering it to code from boot2 it also looks like
this code is buggy and boot2 was never updated to use this code.
USE_XREAD flag is unused in boot2, and common/drv.c was never
build with that flag.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D9780
2017-02-25 18:14:32 +00:00
Toomas Soome
7b02037ef8 loader: disk io should not use alloca()
The alloca() does give us pointer and we have no practical way to check if the
area is actually available, resulting in corruption in corner cases.

Unfortunately we do not have too many options right now, but to use one page.

Reviewed by:	allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D9455
2017-02-06 18:44:15 +00:00
Toomas Soome
35c46ba5bd loader: biosdisk fix for 2+TB disks
This fix is implementing partition based boundary check for
disk IO and updates disk mediasize (if needed), based on information
from partition table.

As it appeared, the signed int based approach still has corner cases,
and the wrapover based behavior is non-standard.

The idea for this fix is based on two assumptions:

The bug about media size is hitting large (2+TB) disks, lesser disks
hopefully, are not affected.

Large disks are using GPT (which does include information about disk size).
Since our concern is about boot support and boot disks are partitioned,
implementing partition boundaries based IO verification should make the
media size issues mostly disappear.

However, for large disk case, we do have the disk size available from GPT table.
If non-GPT cases will appear, we still can make approximate calculation about
disk size based on defined partition(s), however, this is not the objective
of this patch, and can be added later if there is any need.

This patch does implement disk media size adjustment (if needed) in bd_open(),
and boundary check in bd_realstrategy().

Reviewed by:	allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D8595
2017-02-06 18:29:43 +00:00
Toomas Soome
151139ad9e loader: disk/part api needs to use uint64_t offsets
The disk_* and part_* api is using 64bit values for media size and
offsets. However, the current api is using off_t type, which is signed
64-bit int.

In this context the signed media size does not make any sense, and
the offsets are used to mark absolute, not relative locations.

Also, the data from GPT partition table and some other sources is
already using uint64_t data type, so using signed off_t can cause sign
issues.

Reviewed by:	imp
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D8710
2017-02-01 20:10:56 +00:00
Toomas Soome
1ecc859193 dosfs support in libstand is broken since r298230
Apparently the libstand dosfs optimization is a bit too optimistic
and did introduce possible memory corruption.

This patch is backing out the bad part and since this results in
dosfs reading full blocks now, we can also remove extra offset argument
from dv_strategy callback.

The analysis of the issue and the backout patch is provided by Mikhail Kupchik.

PR:		214423
Submitted by:	Mikhail Kupchik
Reported by:	Mikhail Kupchik
Reviewed by:	bapt, allanjude
Approved by:	allanjude (mentor)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D8644
2016-12-30 19:06:29 +00:00