Home | History | Annotate | Download | only in dkwedge
History log of /src/sys/dev/dkwedge/dkwedge_gpt.c
RevisionDateAuthorComments
 1.26  11-Apr-2020  jdolecek allocate buffer for disk I/O via geteblk() instead of malloc(), so they
are properly aligned; e.g. readdisklabel() does the same

also removed the DKW_MALLOC()/DKW_FREE()/DKW_REALLOC() macros as apparently
unnecessary, these files don't seem to be compiled into any userland tools

dkwedge_gpt.c confirmed working, others compile-tested only
 1.25  30-Mar-2020  wiz branches: 1.25.2;
Teach dk(4) about ZFS.

"looks ok" mlelstv
 1.24  09-Jul-2019  maxv Fix info leak: always clear 'dkw', because some of its (otherwise
uninitialized) fields can be copied to userland, typically in the
DIOCGWEDGEINFO ioctl.
 1.23  22-Jun-2019  maxv Fix buffer overflow. Triggerable by plugging a specially-crafted USB key
in the machine (the kernel automatically tries to parse its GPT header).
The check could maybe be appeased to allow bigger sizes, but we've never
done that, so I'm leaving it as-is.
 1.22  10-Apr-2019  mlelstv add types for windows and linux partitions.
 1.21  06-Nov-2018  mrg add support to detect the 3 vmware GPT partition types:

- VMKcore (dump partition)
- VMFS
- VMware reserved

this enables vmkcore partitions for netbsd swap or dump, as well
as naming all of them.
 1.20  07-Sep-2017  christos branches: 1.20.2; 1.20.4;
use arraycount.
 1.19  06-Sep-2017  christos PR/52522: ent_name is not necessarily 0 terminated, so check bounds.
XXX: pullup-8
 1.18  19-Jan-2017  maya branches: 1.18.6;
use a bounded copy. NFCI
 1.17  28-Apr-2016  christos branches: 1.17.2; 1.17.4;
Fix tyop
 1.16  28-Apr-2016  christos Fix error message.
 1.15  23-Aug-2015  jakllsch Quadruple GPT partition entry count limit (to 512 entries or 64KiB).

The UEFI 2.3.1 specification states that:
"A minimum of 16,384 bytes of space must be reserved for the GPT Partition Entry Array."
and [the size of a partition entry shall be a power of two greater than 128]
and that [the defined fields of a partition entry total 128 bytes].

Clamping the entries means that no partitions on the drive will be detected,
as this will result in an incorrect partition entry array CRC. This change
reduces the likelyhood of useless partitions, while still not allowing a
huge kernel memory allocation to load the partition entries into.

In the future this code should probably be reworked to checksum and evaluate
the partition array in chunks while still limiting the number of GPT
wedges added per drive to something reasonable.
 1.14  04-Nov-2014  mlelstv branches: 1.14.2;
Be less noisy when handling wedge name conflicts.
 1.13  18-Oct-2014  snj src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.12  17-May-2010  jakllsch branches: 1.12.18; 1.12.34;
Use wput_utf8() to improve conversion of UTF-16 GPT partition names to UTF-8.
Drop static CRC32 function in favor of the one from libkern.
 1.11  25-Jan-2010  mlelstv branches: 1.11.2; 1.11.4;
GPTs are defined in terms of physical blocks.
- Fix reading of GPT for devices with non-512byte sectors
- Fix bounds check to use DEV_BSIZE units.
 1.10  23-Oct-2008  jakllsch Allow wedges to be created for all defined partitions on a GPT disk.
Use __arraycount on the GUID to type mapping array.
Add HFS to the list of types with dkw_ptypes.

reviewed by cube.
 1.9  29-Jun-2008  christos branches: 1.9.2;
Recognize apple ufs partitions from Antoine Reilles
 1.8  28-Apr-2008  martin branches: 1.8.2; 1.8.4;
Remove clause 3 and 4 from TNF licenses
 1.7  28-Dec-2007  riz branches: 1.7.6; 1.7.8; 1.7.10;
As discussed on tech-userlevel, add NetBSD GPT partition types for
swap, ffs, lfs, raidframe, ccd and cgd. gpt(8) now defaults to
NetBSD ffs if no type is given, but previous FreeBSD types are
still recognized in the DKWEDGE_AUTODISCOVER code.
 1.6  04-Mar-2007  christos branches: 1.6.16; 1.6.22; 1.6.28;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.5  13-Sep-2006  christos branches: 1.5.4; 1.5.6; 1.5.10;
use a c99 initializer
 1.4  13-Aug-2006  martin branches: 1.4.2;
Backout previous - it is already dealt with at the config level.
 1.3  13-Aug-2006  martin Make the discovery methods optional (as they were already declared
in conf/files)
 1.2  11-Dec-2005  christos branches: 1.2.4; 1.2.8;
merge ktrace-lwp.
 1.1  04-Oct-2004  thorpej branches: 1.1.2; 1.1.14;
Move wedge code to a subdirectory, as suggested by Christos.
 1.1.14.3  21-Jan-2008  yamt sync with head
 1.1.14.2  03-Sep-2007  yamt sync with head.
 1.1.14.1  30-Dec-2006  yamt sync with head.
 1.1.2.2  19-Oct-2004  skrll Sync with HEAD
 1.1.2.1  04-Oct-2004  skrll file dkwedge_gpt.c was added on branch ktrace-lwp on 2004-10-19 15:56:45 +0000
 1.2.8.1  14-Sep-2006  yamt sync with head.
 1.2.4.1  09-Sep-2006  rpaulo sync with head
 1.4.2.1  18-Nov-2006  ad Sync with head.
 1.5.10.1  03-Jun-2008  skrll Sync with netbsd-4.
 1.5.6.1  12-Mar-2007  rmind Sync with HEAD.
 1.5.4.1  08-Apr-2008  jdc Pull up revisions:
src/sbin/gpt/add.c 1.6
src/sbin/gpt/gpt.c 1.7
src/sbin/gpt/show.c 1.4
src/sys/dev/dkwedge/dkwedge_gpt.c 1.7
src/sys/sys/disk.h 1.47
src/sys/sys/disklabel_gpt.h 1.4
(requested by riz in ticket #1119).

As discussed on tech-userlevel, add NetBSD GPT partition types for
swap, ffs, lfs, raidframe, ccd and cgd. gpt(8) now defaults to
NetBSD ffs if no type is given, but previous FreeBSD types are
still recognized in the DKWEDGE_AUTODISCOVER code.
 1.6.28.1  02-Jan-2008  bouyer Sync with HEAD
 1.6.22.1  18-Feb-2008  mjf Sync with HEAD.
 1.6.16.1  09-Jan-2008  matt sync with HEAD
 1.7.10.4  11-Aug-2010  yamt sync with head.
 1.7.10.3  11-Mar-2010  yamt sync with head
 1.7.10.2  04-May-2009  yamt sync with head.
 1.7.10.1  16-May-2008  yamt sync with head.
 1.7.8.1  18-May-2008  yamt sync with head.
 1.7.6.3  17-Jan-2009  mjf Sync with HEAD.
 1.7.6.2  02-Jul-2008  mjf Sync with HEAD.
 1.7.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.8.4.1  03-Jul-2008  simonb Sync with head.
 1.8.2.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.9.2.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.11.4.1  30-May-2010  rmind sync with head
 1.11.2.1  17-Aug-2010  uebayasi Sync with HEAD.
 1.12.34.1  11-Nov-2014  martin Pull up following revision(s) (requested by mlelstv in ticket #200):
sys/dev/dkwedge/dkwedge_bsdlabel.c: revision 1.23
sys/dev/dkwedge/dkwedge_mbr.c: revision 1.8
sys/dev/dkwedge/dkwedge_gpt.c: revision 1.14
Handle disks with non DEV_BSIZE sectors.
get sector size from disk structure.
Be less noisy when handling wedge name conflicts.
 1.12.18.1  03-Dec-2017  jdolecek update from HEAD
 1.14.2.3  05-Feb-2017  skrll Sync with HEAD
 1.14.2.2  29-May-2016  skrll Sync with HEAD
 1.14.2.1  22-Sep-2015  skrll Sync with HEAD
 1.17.4.1  21-Apr-2017  bouyer Sync with HEAD
 1.17.2.1  20-Mar-2017  pgoyette Sync with HEAD
 1.18.6.1  12-Feb-2018  snj Pull up following revision(s) (requested by christos in ticket #545):
sbin/gpt/backup.c: 1.17-1.18
sbin/gpt/biosboot.c: 1.29-1.30
sbin/gpt/gpt.c: 1.71-1.73
sbin/gpt/gpt.h: 1.36
sbin/gpt/restore.c: 1.17
sbin/gpt/show.c: 1.40-1.41
sys/dev/dkwedge/dkwedge_gpt.c: 1.19-1.20
PR/52522: Piotr Meyer: Don't NUL terminate the gpt label name.
--
- make sure that the utf16 string is padded with 0's where needed.
- since the utf16 string is not 0 terminated, pass the size of the string.
--
use __arraycount
--
PR/52522: ent_name is not necessarily 0 terminated, so check bounds.
--
use arraycount.
 1.20.4.4  21-Apr-2020  martin Sync with HEAD
 1.20.4.3  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.20.4.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.20.4.1  10-Jun-2019  christos Sync with HEAD
 1.20.2.1  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.25.2.1  20-Apr-2020  bouyer Sync with HEAD

RSS XML Feed