19 Feb, 2014

1 commit


22 Nov, 2013

1 commit

  • Use ARRAY_SIZE instead of sizeof to get proper max for label length.

    Since this is just a read out of bounds it's not that bad, but the
    problem becomes user-visible eg if one tries to use DEBUG_PAGEALLOC and
    DEBUG_RODATA, at least with some enhancements from Hiroshi. Of course
    the destination array can contain garbage when we read beyond the end of
    source array so that would be another user-visible problem.

    Signed-off-by: Antti P Miettinen
    Reviewed-by: Hiroshi Doyu
    Tested-by: Hiroshi Doyu
    Cc: Will Drewry
    Cc: Matt Fleming
    Acked-by: Davidlohr Bueso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Antti P Miettinen
     

17 Oct, 2013

1 commit

  • In commit 27a7c642174e ("partitions/efi: account for pmbr size in lba")
    we started treating bad sizes in lba field of the partition that has the
    0xEE (GPT protective) as errors.

    However, we may run into these "bad sizes" in the real world if someone
    uses dd to copy an image from a smaller disk to a bigger disk. Since
    this case used to work (even without using force_gpt), keep it working
    and treat the size mismatch as a warning instead of an error.

    Reported-by: Josh Triplett
    Reported-by: Sean Paul
    Signed-off-by: Doug Anderson
    Reviewed-by: Josh Triplett
    Acked-by: Davidlohr Bueso
    Tested-by: Artem Bityutskiy
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Doug Anderson
     

01 Oct, 2013

1 commit

  • Recently commit bab55417b10c ("block: support embedded device command
    line partition") introduced CONFIG_CMDLINE_PARSER. However, that name
    is too generic and sounds like it enables/disables generic kernel boot
    arg processing, when it really is block specific.

    Before this option becomes a part of a full/final release, add the BLK_
    prefix to it so that it is clear in absence of any other context that it
    is block specific.

    In addition, fix up the following less critical items:
    - help text was not really at all helpful.
    - index file for Documentation was not updated
    - add the new arg to Documentation/kernel-parameters.txt
    - clarify wording in source comments

    Signed-off-by: Paul Gortmaker
    Cc: Jens Axboe
    Cc: Cai Zhiyong
    Cc: Wei Yongjun
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Paul Gortmaker
     

15 Sep, 2013

1 commit

  • Matt found that commit 27a7c642174e ("partitions/efi: account for pmbr
    size in lba") caused his GPT formatted eMMC device not to boot. The
    reason is that this commit enforced Linux to always check the lesser of
    the whole disk or 2Tib for the pMBR size in LBA. While most disk
    partitioning tools out there create a pMBR with these characteristics,
    Microsoft does not, as it always sets the entry to the maximum 32-bit
    limitation - even though a drive may be smaller than that[1].

    Loosen this check and only verify that the size is either the whole disk
    or 0xFFFFFFFF. No tool in its right mind would set it to any value
    other than these.

    [1] http://thestarman.pcministry.com/asm/mbr/GPT.htm#GPTPT

    Reported-and-tested-by: Matt Porter
    Signed-off-by: Davidlohr Bueso
    Signed-off-by: Linus Torvalds

    Davidlohr Bueso
     

12 Sep, 2013

10 commits

  • Cc: Davidlohr Bueso
    Cc: Karel Zak
    Cc: Matt Fleming
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • Trivial coding style cleanups - still plenty left.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Davidlohr Bueso
    Reviewed-by: Karel Zak
    Acked-by: Matt Fleming
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Davidlohr Bueso
     
  • I love emacs, but these settings for coding style are annoying when trying
    to open the efi.h file. More important, we already have checkpatch for
    that.

    Signed-off-by: Davidlohr Bueso
    Reviewed-by: Karel Zak
    Acked-by: Matt Fleming
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Davidlohr Bueso
     
  • When verifying GPT header integrity, make sure that first usable LBA is
    smaller than last usable LBA.

    Signed-off-by: Davidlohr Bueso
    Reviewed-by: Karel Zak
    Acked-by: Matt Fleming
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Davidlohr Bueso
     
  • The partition that has the 0xEE (GPT protective), must have the size in
    lba field set to the lesser of the size of the disk minus one or
    0xFFFFFFFF for larger disks.

    Signed-off-by: Davidlohr Bueso
    Reviewed-by: Karel Zak
    Acked-by: Matt Fleming
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Davidlohr Bueso
     
  • One of the biggest problems with GPT is compatibility with older, non-GPT
    systems. The problem is addressed by creating hybrid mbrs, an extension,
    or variant, of the traditional protective mbr. This contains, apart from
    the 0xEE partition, up three additional primary partitions that point to
    the same space marked by up to three GPT partitions. The result is that
    legacy OSs can see the three required MBR partitions and at the same time
    ignore the GPT-aware partitions that protect the GPT structures.

    While hybrid MBRs are hacks, workarounds and simply not part of the GPT
    standard, they do exist and we have no way around them. For instance, by
    default, OSX creates a hybrid scheme when using multi-OS booting.

    In order for Linux to properly discover protective MBRs, it must be made
    aware of devices that have hybrid MBRs. No functionality is changed by
    this patch, just a debug message informing the user of the MBR scheme that
    is being used.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Davidlohr Bueso
    Reviewed-by: Karel Zak
    Acked-by: Matt Fleming
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Davidlohr Bueso
     
  • When detecting a valid protective MBR, the Linux kernel isn't picky about
    the partition (1-4) the 0xEE is at, but, unlike other operating systems,
    it does require it to begin at the second sector (sector 1). This check,
    apart from it not being enforced by UEFI, and causing Linux to potentially
    fail to detect any *valid* partitions on the disk, can present problems
    when dealing with hybrid MBRs[1].

    For compatibility reasons, if the first partition is hybridized, the 0xEE
    partition must be small enough to ensure that it only protects the GPT
    data structures - as opposed to the the whole disk in a protective MBR.
    This problem is very well described by Rod Smith[1]: where MBR-only
    partitioning programs (such as older versions of fdisk) can see some of
    the disk space as unallocated, thus loosing the purpose of the 0xEE
    partition's protection of GPT data structures.

    By dropping this check, this patch enables Linux to be more flexible when
    probing for GPT disklabels.

    [1] http://www.rodsbooks.com/gdisk/hybrid.html#reactions

    Signed-off-by: Davidlohr Bueso
    Reviewed-by: Karel Zak
    Acked-by: Matt Fleming
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Davidlohr Bueso
     
  • Per the UEFI Specs 2.4, June 2013, the starting lba of the partition that
    has the EFI GPT (0xEE) must be set to 0x00000001 - this is obviously the
    LBA of the GPT Partition Header.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Davidlohr Bueso
    Reviewed-by: Karel Zak
    Acked-by: Matt Fleming
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Davidlohr Bueso
     
  • The kernel's GPT implementation currently uses the generic 'struct
    partition' type for dealing with legacy MBR partition records. While this
    is is useful for disklabels that we designed for CHS addressing, such as
    msdos, it doesn't adapt well to newer standards that use LBA instead, such
    as GUID partition tables. Furthermore, these generic partition structures
    do not have all the required fields to properly follow the UEFI specs.

    While a CHS address can be translated to LBA, it's much simpler and
    cleaner to just replace the partition type. This patch adds a new
    'gpt_record' type that is fully compliant with EFI and will allow, in the
    next patches, to add more checks to properly verify a protective MBR,
    which is paramount to probing a device that makes use of GPT.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Davidlohr Bueso
    Reviewed-by: Karel Zak
    Acked-by: Matt Fleming
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Davidlohr Bueso
     
  • Read block device partition table from command line. The partition used
    for fixed block device (eMMC) embedded device. It is no MBR, save
    storage space. Bootloader can be easily accessed by absolute address of
    data on the block device. Users can easily change the partition.

    This code reference MTD partition, source "drivers/mtd/cmdlinepart.c"
    About the partition verbose reference
    "Documentation/block/cmdline-partition.txt"

    [akpm@linux-foundation.org: fix printk text]
    [yongjun_wei@trendmicro.com.cn: fix error return code in parse_parts()]
    Signed-off-by: Cai Zhiyong
    Cc: Karel Zak
    Cc: "Wanglin (Albert)"
    Cc: Marius Groeger
    Cc: David Woodhouse
    Cc: Jens Axboe
    Cc: Brian Norris
    Cc: Artem Bityutskiy
    Signed-off-by: Wei Yongjun
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cai Zhiyong
     

10 Jul, 2013

3 commits

  • Graft AIX partitions enumeration into partitions/msdos.c

    There is already a AIX disks detection logic in msdos.c. When an AIX disk
    has been found, and if configured to, call the aix partitions recognizer.
    This avoids removal of AIX disks protection from msdos.c, avoids code
    duplication, and ensures that AIX partitions enumeration is called before
    plain msdos partitions enumeration.

    Signed-off-by: Philippe De Muyter
    Cc: Karel Zak
    Cc: Jens Axboe
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Philippe De Muyter
     
  • Add partitions/aix.h and partitions/aix.c.

    AIX LVM permits to make "logical volumes" which are made of multiple
    slices of multiple disks. The new code allows only access to the
    "logical volumes" which are made of one slice on the probed disk, a
    slice being a contiguous disk area. The code also detects "logical
    volumes" made of multiple slices on the probed disk, but can not
    describe them to the partition layer, because the partition layer
    generic code does not support that. When such non-contiguous "logical
    volumes" are detected, a diagnostic message is printed.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Philippe De Muyter
    Cc: Karel Zak
    Cc: Jens Axboe
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Philippe De Muyter
     
  • Signed-off-by: Philippe De Muyter
    Cc: Karel Zak
    Cc: Jens Axboe
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Philippe De Muyter
     

30 Apr, 2013

1 commit


28 Feb, 2013

4 commits

  • Currently, sizeof(struct parsed_partitions) may be 64KB in 32bit arch, so
    it is easy to trigger page allocation failure by check_partition,
    especially in hotplug block device situation(such as, USB mass storage,
    MMC card, ...), and Felipe Balbi has observed the failure.

    This patch does below optimizations on the allocation of struct
    parsed_partitions to try to address the issue:

    - make parsed_partitions.parts as pointer so that the pointed memory can
    fit in 32KB buffer, then approximate 32KB memory can be saved

    - vmalloc the buffer pointed by parsed_partitions.parts because 32KB is
    still a bit big for kmalloc

    - given that many devices have the partition count limit, so only
    allocate disk_max_parts() partitions instead of 256 partitions always

    Signed-off-by: Ming Lei
    Reported-by: Felipe Balbi
    Cc: Jens Axboe
    Reviewed-by: Yasuaki Ishimatsu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ming Lei
     
  • It isn't necessary to read the information of partitions whose number is
    equal and more than state->limit since only maximum state->limit
    partitions will be added inside rescan_partitions().

    That is also what other kind of partitions are doing.

    Signed-off-by: Ming Lei
    Cc: Jens Axboe
    Cc: Yasuaki Ishimatsu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ming Lei
     
  • UEFI 2.3.1D will include a change to the spec language mandating that a
    GPT header must be greater than *or equal to* the size of the defined
    structure. While verifying that this would work on Linux, I discovered
    that we're not actually checking the minimum bound at all.

    The result of this is that when we verify the checksum, it's possible that
    on a malformed header (with header_size of 0), we won't actually verify
    any data.

    [akpm@linux-foundation.org: fix printk warning]
    Signed-off-by: Peter Jones
    Acked-by: Matt Fleming
    Cc: Jens Axboe
    Cc: Stephen Warren
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Jones
     
  • AIX formatted disks do not always have the MSDOS 55aa signature.
    This happens e.g. for unbootable AIX disks.

    Up to now, such disks were not recognized as AIX disks, because of the
    missing 55aa. Fix that by inverting the two tests. Let's first
    check for the AIX magic strings, and only if that fails check for
    the MSDOS magic word.

    Signed-off-by: Philippe De Muyter
    Cc: Andreas Mohr
    Cc: OGAWA Hirofumi
    Cc: Jens Axboe
    Cc: Olaf Hering
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Philippe De Muyter
     

18 Dec, 2012

1 commit

  • Pull block driver update from Jens Axboe:
    "Now that the core bits are in, here are the driver bits for 3.8. The
    branch contains:

    - A huge pile of drbd bits that were dumped from the 3.7 merge
    window. Following that, it was both made perfectly clear that
    there is going to be no more over-the-wall pulls and how the
    situation on individual pulls can be improved.

    - A few cleanups from Akinobu Mita for drbd and cciss.

    - Queue improvement for loop from Lukas. This grew into adding a
    generic interface for waiting/checking an even with a specific
    lock, allowing this to be pulled out of md and now loop and drbd is
    also using it.

    - A few fixes for xen back/front block driver from Roger Pau Monne.

    - Partition improvements from Stephen Warren, allowing partiion UUID
    to be used as an identifier."

    * 'for-3.8/drivers' of git://git.kernel.dk/linux-block: (609 commits)
    drbd: update Kconfig to match current dependencies
    drbd: Fix drbdsetup wait-connect, wait-sync etc... commands
    drbd: close race between drbd_set_role and drbd_connect
    drbd: respect no-md-barriers setting also when changed online via disk-options
    drbd: Remove obsolete check
    drbd: fixup after wait_even_lock_irq() addition to generic code
    loop: Limit the number of requests in the bio list
    wait: add wait_event_lock_irq() interface
    xen-blkfront: free allocated page
    xen-blkback: move free persistent grants code
    block: partition: msdos: provide UUIDs for partitions
    init: reduce PARTUUID min length to 1 from 36
    block: store partition_meta_info.uuid as a string
    cciss: use check_signature()
    cciss: cleanup bitops usage
    drbd: use copy_highpage
    drbd: if the replication link breaks during handshake, keep retrying
    drbd: check return of kmalloc in receive_uuids
    drbd: Broadcast sync progress no more often than once per second
    drbd: don't try to clear bits once the disk has failed
    ...

    Linus Torvalds
     

06 Dec, 2012

1 commit

  • The Kconfig currently enables MSDOS partitions by default because they
    are assumed to be essential, but it's necessary to enable "advanced
    partition selection" in order to get GPT support. IMO GPT partitions
    are becoming common enought to deserve the same treatment MSDOS
    partitions get.

    (Side note: I got bit by a disk that had MSDOS and GPT partition
    tables, but for some reason the MSDOS table was different from the
    GPT one. I was stupid enought to disable "advanced partition
    selection" in my .config, which disabled GPT partitioning and made
    my btrfs pool unbootable because it couldn't find the partitions)

    Signed-off-by: Diego Calleja
    Signed-off-by: Jens Axboe

    Diego Calleja
     

23 Nov, 2012

2 commits

  • The MSDOS/MBR partition table includes a 32-bit unique ID, often referred
    to as the NT disk signature. When combined with a partition number within
    the table, this can form a unique ID similar in concept to EFI/GPT's
    partition UUID. Constructing and recording this value in struct
    partition_meta_info allows MSDOS partitions to be referred to on the
    kernel command-line using the following syntax:

    root=PARTUUID=0002dd75-01

    Signed-off-by: Stephen Warren
    Cc: Tejun Heo
    Cc: Will Drewry
    Cc: Kay Sievers
    Signed-off-by: Andrew Morton
    Signed-off-by: Jens Axboe

    Stephen Warren
     
  • This will allow other types of UUID to be stored here, aside from true
    UUIDs. This also simplifies code that uses this field, since it's usually
    constructed from a, used as a, or compared to other, strings.

    Note: A simplistic approach here would be to set uuid_str[36]=0 whenever a
    /PARTNROFF option was found to be present. However, this modifies the
    input string, and causes subsequent calls to devt_from_partuuid() not to
    see the /PARTNROFF option, which causes different results. In order to
    avoid misleading future maintainers, this parameter is marked const.

    Signed-off-by: Stephen Warren
    Cc: Tejun Heo
    Cc: Will Drewry
    Cc: Kay Sievers
    Signed-off-by: Andrew Morton
    Signed-off-by: Jens Axboe

    Stephen Warren
     

26 Sep, 2012

1 commit

  • In some usage scenarios it is desireable to work with disk images or
    virtualized DASD devices. One problem that prevents such applications
    is the partition detection in ibm.c. Currently it works only for
    devices that support the BIODASDINFO2 ioctl, in other words, it only
    works for devices that belong to the DASD device driver.

    The information gained from the BIODASDINFO2 ioctl is only for a small
    set of legacy cases abolutely necessary. All current VOL1, LNX1 and
    CMS1 type of disk labels can be interpreted correctly without this
    information, as long as the generic HDIO_GETGEO ioctl works and
    provides a correct disk geometry.

    This patch makes the ibm.c partition detection as independent as
    possible from the BIODASDINFO2 ioctl. Only the following two cases are
    still restricted to real DASDs:
    - An FBA DASD, or LDL formatted ECKD DASD without any disk label.
    - An old style LNX1 label (without large volume support) on a disk
    with inconsistent device geometry.

    Signed-off-by: Stefan Weinhuber
    Signed-off-by: Martin Schwidefsky

    Stefan Weinhuber
     

16 May, 2012

1 commit


24 Feb, 2012

1 commit

  • From: Ben Hutchings

    Extended VBLKs (those larger than the preset VBLK size) are divided
    into fragments, each with its own VBLK header. Our LDM implementation
    generally assumes that each VBLK is contiguous in memory, so these
    fragments must be assembled before further processing.

    Currently the reassembly seems to be done quite wrongly - no VBLK
    header is copied into the contiguous buffer, and the length of the
    header is subtracted twice from each fragment. Also the total
    length of the reassembled VBLK is calculated incorrectly.

    Signed-off-by: Ben Hutchings
    Signed-off-by: Anton Altaparmakov

    Anton Altaparmakov
     

04 Jan, 2012

2 commits