vboot-utils: update to 89.13729.

Also clean up template.

Related #28507.
This commit is contained in:
Érico Rolim 2021-02-20 02:39:02 -03:00 committed by Érico Nogueira Rolim
parent 56869e53bc
commit 77036f295c
5 changed files with 82 additions and 100 deletions

View file

@ -1,13 +0,0 @@
diff --git a/cgpt/cgpt_wrapper.c b/cgpt/cgpt_wrapper.c
index 62635f3f..b27a3eef 100644
--- cgpt/cgpt_wrapper.c
+++ cgpt/cgpt_wrapper.c
@@ -20,6 +20,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
+#include <sys/sysmacros.h>
#include "cgpt.h"
#include "cgpt_nor.h"

View file

@ -1,49 +0,0 @@
--- firmware/stub/vboot_api_stub_sf.c.orig
+++ firmware/stub/vboot_api_stub_sf.c
@@ -5,7 +5,9 @@
* Stub implementations of firmware-provided API functions.
*/
+#if defined(__GLIBC__)
#include <execinfo.h>
+#endif
#include <stdint.h>
#define _STUB_IMPLEMENTATION_
@@ -34,11 +36,13 @@ static struct alloc_node *alloc_head;
static void print_stacktrace(void)
{
+#if defined(__GLIBC__)
void *buffer[MAX_STACK_LEVELS];
int levels = backtrace(buffer, MAX_STACK_LEVELS);
// print to stderr (fd = 2), and remove this function from the trace
backtrace_symbols_fd(buffer + 1, levels - 1, 2);
+#endif
}
void *VbExMalloc(size_t size)
@@ -57,7 +61,11 @@ void *VbExMalloc(size_t size)
node->next = alloc_head;
node->ptr = p;
node->size = size;
+#if defined(__GLIBC__)
node->bt_levels = backtrace(node->bt_buffer, MAX_STACK_LEVELS);
+#else
+ node->bt_levels = 0;
+#endif
alloc_head = node;
return p;
@@ -118,8 +126,10 @@ int vboot_api_stub_check_memory(void)
next = node->next;
fprintf(stderr, "\nptr=%p, size=%zd\n", node->ptr, node->size);
fflush(stderr);
+#if defined(__GLIBC__)
backtrace_symbols_fd(node->bt_buffer + 1, node->bt_levels - 1,
2);
+#endif
free(node);
}

View file

@ -0,0 +1,58 @@
commit 8f2787e5eb72406231b83a4bc6ee20daa640ab41
Author: Érico Rolim <erico.erc@gmail.com>
Date: Sun Feb 21 00:45:12 2021 -0300
Fix wrong memory access on 32-bit glibc.
off_t on 32-bit glibc is a 32-bit value by default, and building with
large file is optional.
We also fix the makefile to actually enable large file support.
This isn't an issue on musl since it builds with large file support by
default.
diff --git Makefile Makefile
index 3a72d3d..0f9caa4 100644
--- Makefile
+++ Makefile
@@ -252,7 +252,7 @@ CFLAGS += -D_GNU_SOURCE
# but if the environment doesn't support it, at least compile support
# for what is possible.
# Pass through cflags_use_64bits to evaluate it only once, here.
-cflags_use_64bits := $(call test_ccflag,-D_FILE_OFFSET_BITS=64,\#include <fts.h>)
+cflags_use_64bits := $(call test_ccflag,-D_FILE_OFFSET_BITS=64,#include <fts.h>)
CFLAGS += $(cflags_use_64bits)
# Code coverage
diff --git futility/cmd_gbb_utility.c futility/cmd_gbb_utility.c
index 2a76ecb..ab0d568 100644
--- futility/cmd_gbb_utility.c
+++ futility/cmd_gbb_utility.c
@@ -225,7 +225,7 @@ static uint8_t *read_entire_file(const char *filename, off_t *sizeptr)
buf = (uint8_t *) malloc(sb.st_size);
if (!buf) {
fprintf(stderr, "ERROR: can't malloc %" PRIi64 " bytes: %s\n",
- sb.st_size, strerror(errno));
+ (int64_t)sb.st_size, strerror(errno));
goto fail;
}
@@ -333,7 +333,7 @@ static int read_from_file(const char *msg, const char *filename,
if (ferror(fp)) {
fprintf(stderr,
"ERROR: Read %zu/%" PRIi64 " bytes from %s: %s\n",
- count, sb.st_size, filename, strerror(errno));
+ count, (int64_t)sb.st_size, filename, strerror(errno));
errorcnt++;
r = errno;
}
@@ -557,7 +557,7 @@ static int do_gbb(int argc, char *argv[])
errorcnt++;
fprintf(stderr,
"ERROR: can't malloc %" PRIi64 " bytes: %s\n",
- filesize, strerror(errno));
+ (int64_t)filesize, strerror(errno));
break;
}

View file

@ -1,10 +0,0 @@
--- ./firmware/stub/tpm_lite_stub.c.orig 2015-06-16 12:29:51.609619681 +0200
+++ ./firmware/stub/tpm_lite_stub.c 2015-06-16 12:30:01.216620121 +0200
@@ -14,6 +14,7 @@
#include "utility.h"
#include "vboot_api.h"
+#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>

View file

@ -1,42 +1,38 @@
# Template file for 'vboot-utils' # Template file for 'vboot-utils'
pkgname=vboot-utils pkgname=vboot-utils
version=45.7262 version=89.13729
revision=13 revision=1
_version=${version/./-}
archs="x86_64* i686* aarch64* arm*" archs="x86_64* i686* aarch64* arm*"
_githash=0e8c964915fffb58032bb59bdb31949de718ca90 create_wrksrc=yes
hostmakedepends="pkg-config git" build_style=gnu-makefile
makedepends="libressl-devel libuuid-devel liblzma-devel libyaml-devel" make_use_env=yes
hostmakedepends="pkg-config"
makedepends="libressl-devel libuuid-devel zlib-devel"
short_desc="Verified boot kernel utilities" short_desc="Verified boot kernel utilities"
maintainer="Enno Boland <gottox@voidlinux.org>" maintainer="Enno Boland <gottox@voidlinux.org>"
license="BSD-3-Clause" license="BSD-3-Clause"
homepage="https://chromium.googlesource.com/chromiumos/platform/vboot_reference.git" homepage="https://chromium.googlesource.com/chromiumos/platform/vboot_reference.git"
CFLAGS='-D_GNU_SOURCE -Wno-error -fcommon' distfiles="https://chromium.googlesource.com/chromiumos/platform/vboot_reference.git/+archive/refs/heads/release-R${_version}.B.tar.gz"
checksum=@3d8edd7e3a1672b29f02d93c4cf89f19ad7477694968b0653aa968783c8ba3e6
# 2crypto specifies a section for some variables, which lead to text relocations in the binary
# let's play it safe and disable PIE
nopie=yes
case "$XBPS_TARGET_MACHINE" in case $XBPS_TARGET_MACHINE in
aarch64*) broken="https://build.voidlinux.org/builders/aarch64-musl_builder/builds/8508/steps/shell_3/logs/stdio" ;; x86_64*) _arch=x86_64 ;;
i686*) _arch=x86 ;;
arm*|aarch64*) _arch=arm ;;
*) broken="This package doesn't have a configuration for this target" ;;
esac esac
make_build_args="ARCH=${_arch} WERROR="
do_fetch() { if [ "$XBPS_TARGET_LIBC" = musl ]; then
git clone https://chromium.googlesource.com/chromiumos/platform/vboot_reference.git $pkgname-$version || true makedepends+=" musl-fts-devel"
cd $pkgname-$version export LDLIBS="-lfts"
git checkout $_githash fi
}
do_build() { post_install() {
local _arch=
sed -i "s/MTD_CHAR_MAJOR/90/" cgpt/cgpt_wrapper.c
case $XBPS_TARGET_MACHINE in
x86_64*) _arch=x86_64 ;;
i686*) _arch=x86 ;;
arm*) _arch=arm ;;
esac
make CC="$CC" LD="$CC" AR="$AR" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
MINIMAL=1 ARCH=$_arch ${makejobs} \
cgpt utils futil
}
do_install() {
make STRIP=true DESTDIR=${DESTDIR} MINIMAL=1 install
vmkdir usr/share/vboot vmkdir usr/share/vboot
vcopy tests/devkeys usr/share/vboot/devkeys vcopy tests/devkeys usr/share/vboot/devkeys
vlicense LICENSE vlicense LICENSE