diff options
author | Jisheng Zhang <jszhang@marvell.com> | 2016-08-15 04:20:21 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2016-08-15 13:54:43 -0400 |
commit | 92bb8d5d55f7fe1a7a1201c42120c1611840807c (patch) | |
tree | 0479defc4112178c42b331ad8ab51273fdc531eb | |
parent | bcd3006f07ef9c80ac225854c1518c22f2f56d71 (diff) |
ARM: 8597/1: VDSO: put RO and RO after init objects into proper sections
vdso_data_mapping is never modified, so mark it as const.
vdso_total_pages, vdso_data_page, vdso_text_mapping and cntvct_ok are
initialized by vdso_init(), thereafter are read only.
The fact that they are read only after init makes them candidates for
__ro_after_init declarations.
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Nathan Lynch <nathan_lynch@mentor.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/kernel/vdso.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/arm/kernel/vdso.c b/arch/arm/kernel/vdso.c index 994e971a8538..bbbffe946122 100644 --- a/arch/arm/kernel/vdso.c +++ b/arch/arm/kernel/vdso.c | |||
@@ -17,6 +17,7 @@ | |||
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/cache.h> | ||
20 | #include <linux/elf.h> | 21 | #include <linux/elf.h> |
21 | #include <linux/err.h> | 22 | #include <linux/err.h> |
22 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
@@ -39,7 +40,7 @@ | |||
39 | static struct page **vdso_text_pagelist; | 40 | static struct page **vdso_text_pagelist; |
40 | 41 | ||
41 | /* Total number of pages needed for the data and text portions of the VDSO. */ | 42 | /* Total number of pages needed for the data and text portions of the VDSO. */ |
42 | unsigned int vdso_total_pages __read_mostly; | 43 | unsigned int vdso_total_pages __ro_after_init; |
43 | 44 | ||
44 | /* | 45 | /* |
45 | * The VDSO data page. | 46 | * The VDSO data page. |
@@ -47,13 +48,13 @@ unsigned int vdso_total_pages __read_mostly; | |||
47 | static union vdso_data_store vdso_data_store __page_aligned_data; | 48 | static union vdso_data_store vdso_data_store __page_aligned_data; |
48 | static struct vdso_data *vdso_data = &vdso_data_store.data; | 49 | static struct vdso_data *vdso_data = &vdso_data_store.data; |
49 | 50 | ||
50 | static struct page *vdso_data_page; | 51 | static struct page *vdso_data_page __ro_after_init; |
51 | static struct vm_special_mapping vdso_data_mapping = { | 52 | static const struct vm_special_mapping vdso_data_mapping = { |
52 | .name = "[vvar]", | 53 | .name = "[vvar]", |
53 | .pages = &vdso_data_page, | 54 | .pages = &vdso_data_page, |
54 | }; | 55 | }; |
55 | 56 | ||
56 | static struct vm_special_mapping vdso_text_mapping = { | 57 | static struct vm_special_mapping vdso_text_mapping __ro_after_init = { |
57 | .name = "[vdso]", | 58 | .name = "[vdso]", |
58 | }; | 59 | }; |
59 | 60 | ||
@@ -67,7 +68,7 @@ struct elfinfo { | |||
67 | /* Cached result of boot-time check for whether the arch timer exists, | 68 | /* Cached result of boot-time check for whether the arch timer exists, |
68 | * and if so, whether the virtual counter is useable. | 69 | * and if so, whether the virtual counter is useable. |
69 | */ | 70 | */ |
70 | static bool cntvct_ok __read_mostly; | 71 | static bool cntvct_ok __ro_after_init; |
71 | 72 | ||
72 | static bool __init cntvct_functional(void) | 73 | static bool __init cntvct_functional(void) |
73 | { | 74 | { |