loadpin.c (2a906db2824b75444982f5e9df870106982afca8) | loadpin.c (6e42aec7c75947e0d6b38400628f171364eb8231) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Module and Firmware Pinning Security Module 4 * 5 * Copyright 2011-2016 Google Inc. 6 * 7 * Author: Kees Cook <keescook@chromium.org> 8 */ --- 7 unchanged lines hidden (view full) --- 16#include <linux/mount.h> 17#include <linux/blkdev.h> 18#include <linux/path.h> 19#include <linux/sched.h> /* current */ 20#include <linux/string_helpers.h> 21#include <linux/dm-verity-loadpin.h> 22#include <uapi/linux/loadpin.h> 23 | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Module and Firmware Pinning Security Module 4 * 5 * Copyright 2011-2016 Google Inc. 6 * 7 * Author: Kees Cook <keescook@chromium.org> 8 */ --- 7 unchanged lines hidden (view full) --- 16#include <linux/mount.h> 17#include <linux/blkdev.h> 18#include <linux/path.h> 19#include <linux/sched.h> /* current */ 20#include <linux/string_helpers.h> 21#include <linux/dm-verity-loadpin.h> 22#include <uapi/linux/loadpin.h> 23 |
24#define VERITY_DIGEST_FILE_HEADER "# LOADPIN_TRUSTED_VERITY_ROOT_DIGESTS" 25 |
|
24static void report_load(const char *origin, struct file *file, char *operation) 25{ 26 char *cmdline, *pathname; 27 28 pathname = kstrdup_quotable_file(file, GFP_KERNEL); 29 cmdline = kstrdup_quotable_cmdline(current, GFP_KERNEL); 30 31 pr_notice("%s %s obj=%s%s%s pid=%d cmdline=%s%s%s\n", --- 255 unchanged lines hidden (view full) --- 287 goto err; 288 289 p = data; 290 p[rc] = '\0'; 291 p = strim(p); 292 293 p = strim(data); 294 while ((d = strsep(&p, "\n")) != NULL) { | 26static void report_load(const char *origin, struct file *file, char *operation) 27{ 28 char *cmdline, *pathname; 29 30 pathname = kstrdup_quotable_file(file, GFP_KERNEL); 31 cmdline = kstrdup_quotable_cmdline(current, GFP_KERNEL); 32 33 pr_notice("%s %s obj=%s%s%s pid=%d cmdline=%s%s%s\n", --- 255 unchanged lines hidden (view full) --- 289 goto err; 290 291 p = data; 292 p[rc] = '\0'; 293 p = strim(p); 294 295 p = strim(data); 296 while ((d = strsep(&p, "\n")) != NULL) { |
295 int len = strlen(d); | 297 int len; |
296 struct dm_verity_loadpin_trusted_root_digest *trd; 297 | 298 struct dm_verity_loadpin_trusted_root_digest *trd; 299 |
300 if (d == data) { 301 /* first line, validate header */ 302 if (strcmp(d, VERITY_DIGEST_FILE_HEADER)) { 303 rc = -EPROTO; 304 goto err; 305 } 306 307 continue; 308 } 309 310 len = strlen(d); 311 |
|
298 if (len % 2) { 299 rc = -EPROTO; 300 goto err; 301 } 302 303 len /= 2; 304 305 trd = kzalloc(struct_size(trd, data, len), GFP_KERNEL); --- 110 unchanged lines hidden --- | 312 if (len % 2) { 313 rc = -EPROTO; 314 goto err; 315 } 316 317 len /= 2; 318 319 trd = kzalloc(struct_size(trd, data, len), GFP_KERNEL); --- 110 unchanged lines hidden --- |