hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/mm/usercopy.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * This implements the various checks for CONFIG_HARDENED_USERCOPY*,
34 * which are designed to protect kernel memory from needless exposure
....@@ -6,11 +7,6 @@
67 *
78 * Copyright (C) 2001-2016 PaX Team, Bradley Spengler, Open Source
89 * 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
- *
1410 */
1511 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
1612
....@@ -47,7 +43,7 @@
4743
4844 /*
4945 * 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,
5147 * so if this check fails, the other end is outside the stack).
5248 */
5349 if (obj < stack || stackend < obj + len)
....@@ -298,7 +294,10 @@
298294
299295 static int __init parse_hardened_usercopy(char *str)
300296 {
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;
302301 }
303302
304303 __setup("hardened_usercopy=", parse_hardened_usercopy);