blob: 36afd0fe9747b757d561a65ffa0e6b166b0729b3 [file] [log] [blame]
Mimi Zohar94c3aac2016-12-19 16:22:35 -08001/*
2 * Copyright (C) 2016 IBM Corporation
3 *
4 * Authors:
5 * Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
6 * Mimi Zohar <zohar@linux.vnet.ibm.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13#include "ima.h"
14
15/*
16 * Restore the measurement list from the previous kernel.
17 */
18void ima_load_kexec_buffer(void)
19{
20 void *kexec_buffer = NULL;
21 size_t kexec_buffer_size = 0;
22 int rc;
23
24 rc = ima_get_kexec_buffer(&kexec_buffer, &kexec_buffer_size);
25 switch (rc) {
26 case 0:
27 rc = ima_restore_measurement_list(kexec_buffer_size,
28 kexec_buffer);
29 if (rc != 0)
30 pr_err("Failed to restore the measurement list: %d\n",
31 rc);
32
33 ima_free_kexec_buffer();
34 break;
35 case -ENOTSUPP:
36 pr_debug("Restoring the measurement list not supported\n");
37 break;
38 case -ENOENT:
39 pr_debug("No measurement list to restore\n");
40 break;
41 default:
42 pr_debug("Error restoring the measurement list: %d\n", rc);
43 }
44}