kexec_file.c (2612e3bbc0386368a850140a6c9b990cd496a5ec) kexec_file.c (e6265fe7775ec51241850abc854c9652d4709996)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * kexec: kexec_file_load system call
4 *
5 * Copyright (C) 2014 Red Hat Inc.
6 * Authors:
7 * Vivek Goyal <vgoyal@redhat.com>
8 */

--- 671 unchanged lines hidden (view full) ---

680 struct shash_desc *desc;
681 int ret = 0, i, j, zero_buf_sz, sha_region_sz;
682 size_t desc_size, nullsz;
683 char *digest;
684 void *zero_buf;
685 struct kexec_sha_region *sha_regions;
686 struct purgatory_info *pi = &image->purgatory_info;
687
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * kexec: kexec_file_load system call
4 *
5 * Copyright (C) 2014 Red Hat Inc.
6 * Authors:
7 * Vivek Goyal <vgoyal@redhat.com>
8 */

--- 671 unchanged lines hidden (view full) ---

680 struct shash_desc *desc;
681 int ret = 0, i, j, zero_buf_sz, sha_region_sz;
682 size_t desc_size, nullsz;
683 char *digest;
684 void *zero_buf;
685 struct kexec_sha_region *sha_regions;
686 struct purgatory_info *pi = &image->purgatory_info;
687
688 if (!IS_ENABLED(CONFIG_ARCH_HAS_KEXEC_PURGATORY))
688 if (!IS_ENABLED(CONFIG_ARCH_SUPPORTS_KEXEC_PURGATORY))
689 return 0;
690
691 zero_buf = __va(page_to_pfn(ZERO_PAGE(0)) << PAGE_SHIFT);
692 zero_buf_sz = PAGE_SIZE;
693
694 tfm = crypto_alloc_shash("sha256", 0, 0);
695 if (IS_ERR(tfm)) {
696 ret = PTR_ERR(tfm);

--- 88 unchanged lines hidden (view full) ---

785out_free_desc:
786 kfree(desc);
787out_free_tfm:
788 kfree(tfm);
789out:
790 return ret;
791}
792
689 return 0;
690
691 zero_buf = __va(page_to_pfn(ZERO_PAGE(0)) << PAGE_SHIFT);
692 zero_buf_sz = PAGE_SIZE;
693
694 tfm = crypto_alloc_shash("sha256", 0, 0);
695 if (IS_ERR(tfm)) {
696 ret = PTR_ERR(tfm);

--- 88 unchanged lines hidden (view full) ---

785out_free_desc:
786 kfree(desc);
787out_free_tfm:
788 kfree(tfm);
789out:
790 return ret;
791}
792
793#ifdef CONFIG_ARCH_HAS_KEXEC_PURGATORY
793#ifdef CONFIG_ARCH_SUPPORTS_KEXEC_PURGATORY
794/*
795 * kexec_purgatory_setup_kbuf - prepare buffer to load purgatory.
796 * @pi: Purgatory to be loaded.
797 * @kbuf: Buffer to setup.
798 *
799 * Allocates the memory needed for the buffer. Caller is responsible to free
800 * the memory after use.
801 *

--- 343 unchanged lines hidden (view full) ---

1145
1146 if (get_value)
1147 memcpy((void *)buf, sym_buf, size);
1148 else
1149 memcpy((void *)sym_buf, buf, size);
1150
1151 return 0;
1152}
794/*
795 * kexec_purgatory_setup_kbuf - prepare buffer to load purgatory.
796 * @pi: Purgatory to be loaded.
797 * @kbuf: Buffer to setup.
798 *
799 * Allocates the memory needed for the buffer. Caller is responsible to free
800 * the memory after use.
801 *

--- 343 unchanged lines hidden (view full) ---

1145
1146 if (get_value)
1147 memcpy((void *)buf, sym_buf, size);
1148 else
1149 memcpy((void *)sym_buf, buf, size);
1150
1151 return 0;
1152}
1153#endif /* CONFIG_ARCH_HAS_KEXEC_PURGATORY */
1153#endif /* CONFIG_ARCH_SUPPORTS_KEXEC_PURGATORY */
1154
1155int crash_exclude_mem_range(struct crash_mem *mem,
1156 unsigned long long mstart, unsigned long long mend)
1157{
1158 int i, j;
1159 unsigned long long start, end, p_start, p_end;
1160 struct range temp_range = {0, 0};
1161

--- 173 unchanged lines hidden ---
1154
1155int crash_exclude_mem_range(struct crash_mem *mem,
1156 unsigned long long mstart, unsigned long long mend)
1157{
1158 int i, j;
1159 unsigned long long start, end, p_start, p_end;
1160 struct range temp_range = {0, 0};
1161

--- 173 unchanged lines hidden ---