| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * This implements the various checks for CONFIG_HARDENED_USERCOPY*, |
|---|
| 3 | 4 | * which are designed to protect kernel memory from needless exposure |
|---|
| .. | .. |
|---|
| 6 | 7 | * |
|---|
| 7 | 8 | * Copyright (C) 2001-2016 PaX Team, Bradley Spengler, Open Source |
|---|
| 8 | 9 | * Security Inc. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 11 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 12 | | - * published by the Free Software Foundation. |
|---|
| 13 | | - * |
|---|
| 14 | 10 | */ |
|---|
| 15 | 11 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
|---|
| 16 | 12 | |
|---|
| .. | .. |
|---|
| 47 | 43 | |
|---|
| 48 | 44 | /* |
|---|
| 49 | 45 | * Reject: object partially overlaps the stack (passing the |
|---|
| 50 | | - * the check above means at least one end is within the stack, |
|---|
| 46 | + * check above means at least one end is within the stack, |
|---|
| 51 | 47 | * so if this check fails, the other end is outside the stack). |
|---|
| 52 | 48 | */ |
|---|
| 53 | 49 | if (obj < stack || stackend < obj + len) |
|---|
| .. | .. |
|---|
| 298 | 294 | |
|---|
| 299 | 295 | static int __init parse_hardened_usercopy(char *str) |
|---|
| 300 | 296 | { |
|---|
| 301 | | - return strtobool(str, &enable_checks); |
|---|
| 297 | + if (strtobool(str, &enable_checks)) |
|---|
| 298 | + pr_warn("Invalid option string for hardened_usercopy: '%s'\n", |
|---|
| 299 | + str); |
|---|
| 300 | + return 1; |
|---|
| 302 | 301 | } |
|---|
| 303 | 302 | |
|---|
| 304 | 303 | __setup("hardened_usercopy=", parse_hardened_usercopy); |
|---|