diff options
author | Michael Biebl <biebl@debian.org> | 2017-10-10 00:22:57 +0200 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2017-10-10 00:22:57 +0200 |
commit | f5e65279187b6aa0c0c5a00b14dca9eab441ffb2 (patch) | |
tree | b834735b2b8fabf24499bb8cc12d4f24870436f7 /src/boot | |
parent | 81c583552ee1c3355cdef1b11a33737dd98e6971 (diff) | |
download | systemd-f5e65279187b6aa0c0c5a00b14dca9eab441ffb2.tar.gz |
New upstream version 235
Diffstat (limited to 'src/boot')
l--------- | src/boot/Makefile | 1 | ||||
-rw-r--r-- | src/boot/bootctl.c | 14 | ||||
-rw-r--r-- | src/boot/efi/.gitignore | 2 | ||||
-rw-r--r-- | src/boot/efi/boot.c | 5 | ||||
-rw-r--r-- | src/boot/efi/measure.c | 2 | ||||
-rw-r--r-- | src/boot/efi/meson.build | 4 | ||||
-rw-r--r-- | src/boot/efi/stub.c | 5 |
7 files changed, 17 insertions, 16 deletions
diff --git a/src/boot/Makefile b/src/boot/Makefile deleted file mode 120000 index d0b0e8e008..0000000000 --- a/src/boot/Makefile +++ /dev/null @@ -1 +0,0 @@ -../Makefile
\ No newline at end of file diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c index 233bc80292..85f3b42c48 100644 --- a/src/boot/bootctl.c +++ b/src/boot/bootctl.c @@ -539,12 +539,18 @@ static int copy_file_with_version_check(const char *from, const char *to, bool f r = copy_bytes(fd_from, fd_to, (uint64_t) -1, COPY_REFLINK); if (r < 0) { - unlink(t); - return log_error_errno(errno, "Failed to copy data from \"%s\" to \"%s\": %m", from, t); + (void) unlink(t); + return log_error_errno(r, "Failed to copy data from \"%s\" to \"%s\": %m", from, t); } (void) copy_times(fd_from, fd_to); + r = fsync(fd_to); + if (r < 0) { + (void) unlink_noerrno(t); + return log_error_errno(errno, "Failed to copy data from \"%s\" to \"%s\": %m", from, t); + } + r = renameat(AT_FDCWD, t, AT_FDCWD, to); if (r < 0) { (void) unlink_noerrno(t); @@ -912,7 +918,7 @@ static int install_loader_config(const char *esp_path) { r = sd_id128_get_machine(&machine_id); if (r < 0) - return log_error_errno(r, "Failed to get machine did: %m"); + return log_error_errno(r, "Failed to get machine id: %m"); p = strjoina(esp_path, "/loader/loader.conf"); @@ -932,7 +938,7 @@ static int install_loader_config(const char *esp_path) { fprintf(f, "#timeout 3\n"); fprintf(f, "default %s-*\n", sd_id128_to_string(machine_id, machine_string)); - r = fflush_and_check(f); + r = fflush_sync_and_check(f); if (r < 0) return log_error_errno(r, "Failed to write \"%s\": %m", p); diff --git a/src/boot/efi/.gitignore b/src/boot/efi/.gitignore deleted file mode 100644 index e193acbe12..0000000000 --- a/src/boot/efi/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/systemd_boot.so -/stub.so diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c index 1e990b3825..12176f1fe0 100644 --- a/src/boot/efi/boot.c +++ b/src/boot/efi/boot.c @@ -1650,15 +1650,14 @@ static EFI_STATUS image_start(EFI_HANDLE parent_image, const Config *config, con loaded_image->LoadOptions = options; loaded_image->LoadOptionsSize = (StrLen(loaded_image->LoadOptions)+1) * sizeof(CHAR16); -#ifdef SD_BOOT_LOG_TPM +#if ENABLE_TPM /* Try to log any options to the TPM, especially to catch manually edited options */ err = tpm_log_event(SD_TPM_PCR, (EFI_PHYSICAL_ADDRESS) loaded_image->LoadOptions, loaded_image->LoadOptionsSize, loaded_image->LoadOptions); if (EFI_ERROR(err)) { Print(L"Unable to add image options measurement: %r", err); - uefi_call_wrapper(BS->Stall, 1, 3 * 1000 * 1000); - return err; + uefi_call_wrapper(BS->Stall, 1, 200 * 1000); } #endif } diff --git a/src/boot/efi/measure.c b/src/boot/efi/measure.c index b22d37b62d..324d1c8b9e 100644 --- a/src/boot/efi/measure.c +++ b/src/boot/efi/measure.c @@ -11,7 +11,7 @@ * */ -#ifdef SD_BOOT_LOG_TPM +#if ENABLE_TPM #include <efi.h> #include <efilib.h> diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build index 5ef5b2d20b..eb0be02977 100644 --- a/src/boot/efi/meson.build +++ b/src/boot/efi/meson.build @@ -30,7 +30,7 @@ stub_sources = ''' stub.c '''.split() -if conf.get('ENABLE_EFI', false) and get_option('gnu-efi') != 'false' +if conf.get('ENABLE_EFI') == 1 and get_option('gnu-efi') != 'false' efi_cc = get_option('efi-cc') efi_ld = get_option('efi-ld') @@ -64,7 +64,7 @@ if have_gnu_efi efi_conf = configuration_data() efi_conf.set_quoted('PACKAGE_VERSION', meson.project_version()) efi_conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME) - efi_conf.set('SD_BOOT_LOG_TPM', get_option('tpm')) + efi_conf.set10('ENABLE_TPM', get_option('tpm')) efi_conf.set('SD_TPM_PCR', get_option('tpm-pcrindex')) efi_config_h = configure_file( diff --git a/src/boot/efi/stub.c b/src/boot/efi/stub.c index bab5d46de9..e85ebf2c3f 100644 --- a/src/boot/efi/stub.c +++ b/src/boot/efi/stub.c @@ -87,15 +87,14 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { line[i] = options[i]; cmdline = line; -#ifdef SD_BOOT_LOG_TPM +#if ENABLE_TPM /* Try to log any options to the TPM, especially manually edited options */ err = tpm_log_event(SD_TPM_PCR, (EFI_PHYSICAL_ADDRESS) loaded_image->LoadOptions, loaded_image->LoadOptionsSize, loaded_image->LoadOptions); if (EFI_ERROR(err)) { Print(L"Unable to add image options measurement: %r", err); - uefi_call_wrapper(BS->Stall, 1, 3 * 1000 * 1000); - return err; + uefi_call_wrapper(BS->Stall, 1, 200 * 1000); } #endif } |