Commit f6bf6eb6 authored by Andreas Henriksson's avatar Andreas Henriksson

New upstream version 2.29.2

parents 0f24b094 79851652
......@@ -81,6 +81,7 @@ CONTRIBUTORS:
Alain Guibert <alguibert+ulng@free.fr>
Alan Curry <pacman@TheWorld.com>
Alan Wendt <alan@ezlink.com>
Alden Tondettar <alden.tondettar@gmail.com>
Alejandro Martinez Ruiz <alex@nowcomputing.com>
Alexander Kuleshov <kuleshovmail@gmail.com>
Alexander Shishkin <virtuoso@slind.org>
......@@ -424,6 +425,7 @@ CONTRIBUTORS:
Paul Menzel <paulepanter@users.sourceforge.net>
Pavel Maryanov <acid@jack.kiev.ua>
pcpa <paulo.cesar.pereira.de.andrade@gmail.com>
Pedro Miguel Carvalho <PedroMC@pmc.com.pt>
Pedro Ribeiro <p.m42.ribeiro@gmail.com>
peppe <g1pi@libero.it>
Peter Breitenlohner <peb@mppmu.mpg.de>
......
See version control history.
http://git.kernel.org/?p=utils/util-linux/util-linux.git;a=log;h=2.29.1
http://git.kernel.org/?p=utils/util-linux/util-linux.git;a=log;h=2.29.2
util-linux 2.29.2 Release Notes
===============================
This release fixes su(1) security issue CVE-2017-2616:
It is possible for any local user to send SIGKILL to other processes with root
privileges. To exploit this, the user must be able to perform su with a
successful login. SIGKILL can only be sent to processes which were executed
after the su process. It is not possible to send SIGKILL to processes which
were already running.
build-sys:
- fix --disable-all-programs --enable-schedutils [Karel Zak]
- improve detection of the "isnan" function in uClibc [Carlos Santos]
- simplify UL_ENABLE_ALIAS() semantic [Karel Zak]
cfdisk:
- support UI refresh on ^L [Karel Zak]
docs:
- add BUG REPORTING section to README [Karel Zak]
- update AUTHORS file [Karel Zak]
findmnt:
- flush stdout after each (un)(re)mount event, when polling. [Pedro Miguel Carvalho]
- use line separator for --poll output [Karel Zak]
fstrim:
- de-duplicate btrfs sub-volumes [Stanislav Brabec]
lib/strutils:
- return end pointer by isdigit_string() [Karel Zak]
libblkid:
- (gpt) fix force flag [Karel Zak]
- Fix out of bounds reads on bad GPT header [Alden Tondettar]
- fix BLKID_PARTS_FORCE_GPT usage [Karel Zak]
libfdisk:
- (gpt) add check for entries array size [Karel Zak]
- fix fdisk_set_wipe_area() calls [Karel Zak]
libmount:
- make rootfs lookup by parent-id more robust [Karel Zak]
logger:
- support sub-trees in the ID for RFC5424 [Karel Zak]
lscpu:
- Detect Windows Subsystem for Linux [Stanislav Brabec]
- don't use path_exist() before path_fopen() [Karel Zak]
- make osrelease file optional [Karel Zak]
po:
- merge changes [Karel Zak]
- update pt_BR.po (from translationproject.org) [Rafael Fontenelle]
sfdisk:
- --quiet fixes [Karel Zak]
su:
- properly clear child PID [Karel Zak]
tests:
- add build-sys enable-schedutils result [Karel Zak]
umount:
- exclude selinuxfs from --all [Karel Zak]
......@@ -11607,7 +11607,7 @@ distdir: $(DISTFILES)
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
$(am__post_remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
......@@ -11631,7 +11631,7 @@ dist-shar: distdir
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
$(am__post_remove_distdir)
dist-zip: distdir
......@@ -11649,7 +11649,7 @@ dist dist-all:
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lz*) \
......@@ -11659,7 +11659,7 @@ distcheck: dist
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
......
util-linux 2.29.2: Feb 22 2017
* see Documentation/releases/v2.29.2-ReleaseNotes or the complete changelog at
ftp://ftp.kernel.org/pub/linux/utils/util-linux/v2.29/v2.29.2-ChangeLog
util-linux 2.29.1: Jan 20 2017
* see Documentation/releases/v2.29.1-ReleaseNotes or the complete changelog at
ftp://ftp.kernel.org/pub/linux/utils/util-linux/v2.29/v2.29.1-ChangeLog
......
......@@ -16,8 +16,20 @@ DOWNLOAD:
ftp://ftp.kernel.org/pub/linux/utils/util-linux/
BUG REPORTING:
E-MAIL: util-linux@vger.kernel.org
Web: https://github.com/karelzak/util-linux/issues
Note that upstream community has no resources to provide support for end
users with distribution specific issues. It's strongly recommended to
report bugs to the distribution (downstream) maintainers by distribution
bug tracking systems.
SOURCE CODE:
See also Documentation/howto-contribute.txt.
Web interface:
http://git.kernel.org/cgit/utils/util-linux/util-linux.git
https://github.com/karelzak/util-linux
......
......@@ -21,7 +21,7 @@ If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
dnl serial 11 (pkg-config-0.29)
dnl serial 11 (pkg-config-0.29.1)
dnl
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
......@@ -63,7 +63,7 @@ dnl
dnl See the "Since" comment for each macro you use to see what version
dnl of the macros you require.
m4_defun([PKG_PREREQ],
[m4_define([PKG_MACROS_VERSION], [0.29])
[m4_define([PKG_MACROS_VERSION], [0.29.1])
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
])dnl PKG_PREREQ
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for util-linux 2.29.1.
# Generated by GNU Autoconf 2.69 for util-linux 2.29.2.
#
# Report bugs to <kzak@redhat.com>.
#
......@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='util-linux'
PACKAGE_TARNAME='util-linux'
PACKAGE_VERSION='2.29.1'
PACKAGE_STRING='util-linux 2.29.1'
PACKAGE_VERSION='2.29.2'
PACKAGE_STRING='util-linux 2.29.2'
PACKAGE_BUGREPORT='kzak@redhat.com'
PACKAGE_URL='http://www.kernel.org/pub/linux/utils/util-linux/'
......@@ -1886,7 +1886,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures util-linux 2.29.1 to adapt to many kinds of systems.
\`configure' configures util-linux 2.29.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1956,7 +1956,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of util-linux 2.29.1:";;
short | recursive ) echo "Configuration of util-linux 2.29.2:";;
esac
cat <<\_ACEOF
......@@ -2257,7 +2257,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
util-linux configure 2.29.1
util-linux configure 2.29.2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
......@@ -2783,7 +2783,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by util-linux $as_me 2.29.1, which was
It was created by util-linux $as_me 2.29.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
......@@ -5022,7 +5022,7 @@ fi
# Define the identity of the package.
PACKAGE='util-linux'
VERSION='2.29.1'
VERSION='2.29.2'
cat >>confdefs.h <<_ACEOF
......@@ -5379,7 +5379,7 @@ PACKAGE_VERSION_RELEASE=$(echo $PACKAGE_VERSION | awk -F. '{
sub("-.*","",$3); print $3 ~ /^[0-9]+$/ ? $3 : 0}')
LIBBLKID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
LIBBLKID_DATE="20-Jan-2017"
LIBBLKID_DATE="22-Feb-2017"
LIBBLKID_LT_MAJOR=1
LIBBLKID_LT_MINOR=1
LIBBLKID_LT_MICRO=0
......@@ -18549,6 +18549,46 @@ if test "x$ac_cv_lib_m_isnan" = xyes; then :
MATH_LIBS="-lm"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __isnan in -lm" >&5
$as_echo_n "checking for __isnan in -lm... " >&6; }
if ${ac_cv_lib_m___isnan+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lm $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char __isnan ();
int
main ()
{
return __isnan ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_m___isnan=yes
else
ac_cv_lib_m___isnan=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m___isnan" >&5
$as_echo "$ac_cv_lib_m___isnan" >&6; }
if test "x$ac_cv_lib_m___isnan" = xyes; then :
MATH_LIBS="-lm"
fi
fi
done
......@@ -28222,7 +28262,7 @@ else
if test "x$ul_default_estate" != x; then
enable_schedutils=$ul_default_estate
else
enable_schedutils=yes
enable_schedutils=check
fi
......@@ -28230,46 +28270,19 @@ fi
if test "x$enable_schedutils" = xno; then
build_schedutils=no
else
build_schedutils=yes
fi
if test "x$ul_default_estate" != x; then
enable_ionice=$ul_default_estate
build_ionice=yes
if test "x$ul_default_estate" = xno; then
build_ionice=no
fi
else
build_ionice=yes
enable_ionice=check
fi
enable_ionice=$enable_schedutils
if test "x$build_ionice" != xno; then
case $enable_ionice:$build_schedutils in #(
no:*)
build_ionice=no ;;
yes:yes)
build_ionice=yes ;;
yes:*)
as_fn_error $? "schedutils is needed to build ionice" "$LINENO" 5;;
check:yes)
build_ionice=yes ;;
check:*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: schedutils disabled; not building ionice" >&5
$as_echo "$as_me: WARNING: schedutils disabled; not building ionice" >&2;}
build_ionice=no ;;
esac
fi
if test "x$enable_ionice" = xno; then
build_ionice=no
else
build_ionice=yes
fi
......@@ -28490,37 +28503,18 @@ fi
if test "x$ul_default_estate" != x; then
enable_taskset=$ul_default_estate
build_taskset=yes
if test "x$ul_default_estate" = xno; then
build_taskset=no
fi
else
build_taskset=yes
enable_taskset=check
fi
enable_taskset=$enable_schedutils
if test "x$build_taskset" != xno; then
case $enable_taskset:$build_schedutils in #(
no:*)
build_taskset=no ;;
yes:yes)
build_taskset=yes ;;
yes:*)
as_fn_error $? "schedutils is needed to build taskset" "$LINENO" 5;;
check:yes)
build_taskset=yes ;;
check:*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: schedutils disabled; not building taskset" >&5
$as_echo "$as_me: WARNING: schedutils disabled; not building taskset" >&2;}
build_taskset=no ;;
esac
fi
if test "x$enable_taskset" = xno; then
build_taskset=no
else
build_taskset=yes
fi
......@@ -28663,37 +28657,17 @@ fi
if test "x$ul_default_estate" != x; then
enable_chrt=$ul_default_estate
build_chrt=yes
if test "x$ul_default_estate" = xno; then
build_chrt=no
fi
else
build_chrt=yes
enable_chrt=check
fi
enable_chrt=$enable_schedutils
if test "x$build_chrt" != xno; then
case $enable_chrt:$build_schedutils in #(
no:*)
build_chrt=no ;;
yes:yes)
build_chrt=yes ;;
yes:*)
as_fn_error $? "schedutils is needed to build chrt" "$LINENO" 5;;
check:yes)
build_chrt=yes ;;
check:*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: schedutils disabled; not building chrt" >&5
$as_echo "$as_me: WARNING: schedutils disabled; not building chrt" >&2;}
build_chrt=no ;;
esac
fi
if test "x$enable_chrt" = xno; then
build_chrt=no
else
build_chrt=yes
fi
......@@ -31176,7 +31150,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by util-linux $as_me 2.29.1, which was
This file was extended by util-linux $as_me 2.29.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -31243,7 +31217,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
util-linux config.status 2.29.1
util-linux config.status 2.29.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
......
......@@ -28,7 +28,7 @@ PACKAGE_VERSION_RELEASE=$(echo $PACKAGE_VERSION | awk -F. '{
dnl libblkid version
LIBBLKID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
LIBBLKID_DATE="20-Jan-2017"
LIBBLKID_DATE="22-Feb-2017"
LIBBLKID_LT_MAJOR=1
LIBBLKID_LT_MINOR=1
LIBBLKID_LT_MICRO=0
......@@ -428,7 +428,8 @@ AC_CHECK_FUNCS([reboot], [have_reboot=yes],[have_reboot=no])
AM_CONDITIONAL([HAVE_OPENAT], [test "x$have_openat" = xyes])
AC_CHECK_FUNCS([isnan], [],
[AC_CHECK_LIB([m], [isnan], [MATH_LIBS="-lm"])]
[AC_CHECK_LIB([m], [isnan], [MATH_LIBS="-lm"])]
[AC_CHECK_LIB([m], [__isnan], [MATH_LIBS="-lm"])]
)
AC_SUBST([MATH_LIBS])
......@@ -1828,12 +1829,12 @@ AM_CONDITIONAL([BUILD_SETTERM], [test "x$build_setterm" = xyes])
# ionice, taskset and chrt
AC_ARG_ENABLE([schedutils],
AS_HELP_STRING([--disable-schedutils], [do not build chrt, ionice, taskset]),
[], [UL_DEFAULT_ENABLE([schedutils], [yes])]
[], [UL_DEFAULT_ENABLE([schedutils], [check])]
)
UL_BUILD_INIT([schedutils])
UL_BUILD_INIT([ionice], [check])
UL_REQUIRES_BUILD([ionice], [schedutils])
UL_ENABLE_ALIAS([ionice], [schedutils])
UL_BUILD_INIT([ionice])
UL_REQUIRES_SYSCALL_CHECK([ionice],
[UL_CHECK_SYSCALL([ioprio_set],
[alpha], [442],
......@@ -1860,8 +1861,9 @@ UL_REQUIRES_SYSCALL_CHECK([ionice],
AM_CONDITIONAL([BUILD_IONICE], [test "x$build_ionice" = xyes])
UL_BUILD_INIT([taskset], [check])
UL_REQUIRES_BUILD([taskset], [schedutils])
UL_ENABLE_ALIAS([taskset], [schedutils])
UL_BUILD_INIT([taskset])
UL_REQUIRES_HAVE([taskset], [cpu_set_t], [cpu_set_t type])
UL_REQUIRES_SYSCALL_CHECK([taskset],
[UL_CHECK_SYSCALL([sched_getaffinity])],
......@@ -1873,8 +1875,8 @@ have_schedsetter=no
AS_IF([test "x$ac_cv_func_sched_setscheduler" = xyes], [have_schedsetter=yes],
[test "x$ac_cv_func_sched_setattr" = xyes], [have_schedsetter=yes])
UL_BUILD_INIT([chrt], [check])
UL_REQUIRES_BUILD([chrt], [schedutils])
UL_ENABLE_ALIAS([chrt], [schedutils])
UL_BUILD_INIT([chrt])
UL_REQUIRES_HAVE([chrt], [schedsetter], [sched_set functions])
AM_CONDITIONAL([BUILD_CHRT], [test "x$build_chrt" = xyes])
......
......@@ -1517,12 +1517,19 @@ static int ui_menu_move(struct cfdisk *cf, int key)
}
}
return 1; /* key irrelevant for menu move */
if (key == '\014') { /* ^L refresh */
ui_menu_resize(cf);
return 0;
}
DBG(MENU, ul_debug(" no memu move key"));
return 1;
}
/* but don't call me from ui_run(), this is for pop-up menus only */
static void ui_menu_resize(struct cfdisk *cf)
{
DBG(MENU, ul_debug("memu resize/refresh"));
resize();
ui_clean_menu(cf);
menu_refresh_size(cf);
......@@ -2394,6 +2401,7 @@ static int main_menu_action(struct cfdisk *cf, int key)
static void ui_resize_refresh(struct cfdisk *cf)
{
DBG(UI, ul_debug("ui resize/refresh"));
resize();
menu_refresh_size(cf);
lines_refresh(cf);
......@@ -2469,10 +2477,14 @@ static int ui_run(struct cfdisk *cf)
ui_resize_refresh(cf);
if (key == ERR)
continue;
if (key == '\014') { /* ^L refresh */
ui_resize_refresh(cf);
continue;
}
if (ui_menu_move(cf, key) == 0)
continue;
DBG(UI, ul_debug("main action key >%c<.", key));
DBG(UI, ul_debug("main action key >%1$c< [\\0%1$o].", key));
switch (key) {
case KEY_DOWN:
......
......@@ -1678,6 +1678,8 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv)
}
refresh_prompt_buffer(sf, devname, next_partno, created);
if (sf->prompt && (sf->interactive || !sf->quiet)) {
#ifndef HAVE_LIBREADLINE
fputs(sf->prompt, stdout);
......@@ -1697,7 +1699,8 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv)
continue;
} else if (rc == 1) {
rc = SFDISK_DONE_EOF;
fputs(_("Done.\n"), stdout);
if (!sf->quiet)
fputs(_("Done.\n"), stdout);
break;
}
......@@ -1726,7 +1729,7 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv)
rc = rc == 0 ? SFDISK_DONE_ASK : SFDISK_DONE_ABORT;
break;
} else if (!rc) { /* add partition */
if (!sf->interactive &&
if (!sf->interactive && !sf->quiet &&
(!sf->prompt || startswith(sf->prompt, SFDISK_PROMPT))) {
refresh_prompt_buffer(sf, devname, next_partno, created);
fputs(sf->prompt, stdout);
......@@ -1734,8 +1737,7 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv)
rc = fdisk_add_partition(sf->cxt, pa, &cur_partno);
if (rc) {
errno = -rc;
fdisk_warn(sf->cxt, _("Failed to add partition"));
fdisk_warn(sf->cxt, _("Failed to add #%d partition"), next_partno + 1);
}
}
......
......@@ -36,8 +36,12 @@ extern unsigned long strtoul_or_err(const char *str, const char *errmesg);
extern void strtotimeval_or_err(const char *str, struct timeval *tv,
const char *errmesg);
extern int isdigit_string(const char *str);
extern int isxdigit_string(const char *str);
extern int isdigit_strend(const char *str, const char **end);
#define isdigit_string(_s) isdigit_strend(_s, NULL)
extern int isxdigit_strend(const char *str, const char **end);
#define isxdigit_string(_s) isxdigit_strend(_s, NULL)
extern int parse_switch(const char *arg, const char *errmesg, ...);
......
......@@ -174,21 +174,26 @@ int strtosize(const char *str, uintmax_t *res)
return parse_size(str, res, NULL);
}
int isdigit_string(const char *str)
int isdigit_strend(const char *str, const char **end)
{
const char *p;
for (p = str; p && *p && isdigit((unsigned char) *p); p++);
if (end)
*end = p;
return p && p > str && !*p;
}
int isxdigit_string(const char *str)
int isxdigit_strend(const char *str, const char **end)
{
const char *p;
for (p = str; p && *p && isxdigit((unsigned char) *p); p++);
if (end)
*end = p;
return p && p > str && !*p;
}
......
......@@ -30,8 +30,8 @@
extern "C" {
#endif
#define BLKID_VERSION "2.29.1"
#define BLKID_DATE "20-Jan-2017"
#define BLKID_VERSION "2.29.2"
#define BLKID_DATE "22-Feb-2017"
/**
* blkid_dev:
......
......@@ -166,8 +166,8 @@ static int is_pmbr_valid(blkid_probe pr, int *has)
if (has)
*has = 0;
if (flags & BLKID_PARTS_FORCE_GPT)
goto ok; /* skip PMBR check */
else if (flags & BLKID_PARTS_FORCE_GPT)
return 1; /* skip PMBR check */
data = blkid_probe_get_sector(pr, 0);
if (!data) {
......@@ -180,8 +180,10 @@ static int is_pmbr_valid(blkid_probe pr, int *has)
goto failed;
for (i = 0, p = mbr_get_partition(data, 0); i < 4; i++, p++) {
if (p->sys_ind == MBR_GPT_PARTITION)
if (p->sys_ind == MBR_GPT_PARTITION) {
DBG(LOWPROBE, ul_debug(" #%d valid PMBR partition", i + 1));
goto ok;
}
}
failed:
return 0;
......@@ -210,11 +212,13 @@ static struct gpt_header *get_gpt_header(
struct gpt_header *h;
uint32_t crc;
uint64_t lu, fu;
size_t esz;
uint64_t esz;
uint32_t hsz, ssz;
ssz = blkid_probe_get_sectorsize(pr);
DBG(LOWPROBE, ul_debug(" checking for GPT header at %ju", lba));
/* whole sector is allocated for GPT header */
h = (struct gpt_header *) get_lba_buffer(pr, lba, ssz);
if (!h)
......@@ -264,17 +268,16 @@ static struct gpt_header *get_gpt_header(
return NULL;
}
if (le32_to_cpu(h->num_partition_entries) == 0 ||
le32_to_cpu(h->sizeof_partition_entry) == 0 ||
ULONG_MAX / le32_to_cpu(h->num_partition_entries) < le32_to_cpu(h->sizeof_partition_entry)) {
/* Size of blocks with GPT entries */
esz = (uint64_t)le32_to_cpu(h->num_partition_entries) *
le32_to_cpu(h->sizeof_partition_entry);
if (esz == 0 || esz >= UINT32_MAX ||
le32_to_cpu(h->sizeof_partition_entry) != sizeof(struct gpt_entry)) {
DBG(LOWPROBE, ul_debug("GPT entries undefined"));
return NULL;
}
/* Size of blocks with GPT entries */
esz = le32_to_cpu(h->num_partition_entries) *
le32_to_cpu(h->sizeof_partition_entry);
/* The header seems valid, save it
* (we don't care about zeros in hdr->reserved2 area) */
memcpy(hdr, h, sizeof(*h));
......
......@@ -666,6 +666,7 @@ int fdisk_reread_partition_table(struct fdisk_context *cxt)
i = fstat(cxt->dev_fd, &statbuf);
if (i == 0 && S_ISBLK(statbuf.st_mode)) {