Skip to content

Commit 73b9160

Browse files
jinb-parkRussell King
authored andcommitted
ARM: 8748/1: mm: Define vdso_start, vdso_end as array
Define vdso_start, vdso_end as array to avoid compile-time analysis error for the case of built with CONFIG_FORTIFY_SOURCE. and, since vdso_start, vdso_end are used in vdso.c only, move extern-declaration from vdso.h to vdso.c. If kernel is built with CONFIG_FORTIFY_SOURCE, compile-time error happens at this code. - if (memcmp(&vdso_start, "177ELF", 4)) The size of "&vdso_start" is recognized as 1 byte, but n is 4, So that compile-time error is reported. Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Jinbum Park <jinb.park7@gmail.com> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
1 parent ad43fc9 commit 73b9160

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎arch/arm/include/asm/vdso.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ struct mm_struct;
1212

1313
void arm_install_vdso(struct mm_struct *mm, unsigned long addr);
1414

15-
extern char vdso_start, vdso_end;
16-
1715
extern unsigned int vdso_total_pages;
1816

1917
#else /* CONFIG_VDSO */

‎arch/arm/kernel/vdso.c‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939

4040
static struct page **vdso_text_pagelist;
4141

42+
extern char vdso_start[], vdso_end[];
43+
4244
/* Total number of pages needed for the data and text portions of the VDSO. */
4345
unsigned int vdso_total_pages __ro_after_init;
4446

@@ -197,13 +199,13 @@ static int __init vdso_init(void)
197199
unsigned int text_pages;
198200
int i;
199201

200-
if (memcmp(&vdso_start, "\177ELF", 4)) {
202+
if (memcmp(vdso_start, "\177ELF", 4)) {
201203
pr_err("VDSO is not a valid ELF object!\n");
202204
return -ENOEXEC;
203205
}
204206

205-
text_pages = (&vdso_end - &vdso_start) >> PAGE_SHIFT;
206-
pr_debug("vdso: %i text pages at base %p\n", text_pages, &vdso_start);
207+
text_pages = (vdso_end - vdso_start) >> PAGE_SHIFT;
208+
pr_debug("vdso: %i text pages at base %p\n", text_pages, vdso_start);
207209

208210
/* Allocate the VDSO text pagelist */
209211
vdso_text_pagelist = kcalloc(text_pages, sizeof(struct page *),
@@ -218,7 +220,7 @@ static int __init vdso_init(void)
218220
for (i = 0; i < text_pages; i++) {
219221
struct page *page;
220222

221-
page = virt_to_page(&vdso_start + i * PAGE_SIZE);
223+
page = virt_to_page(vdso_start + i * PAGE_SIZE);
222224
vdso_text_pagelist[i] = page;
223225
}
224226

@@ -229,7 +231,7 @@ static int __init vdso_init(void)
229231

230232
cntvct_ok = cntvct_functional();
231233

232-
patch_vdso(&vdso_start);
234+
patch_vdso(vdso_start);
233235

234236
return 0;
235237
}

0 commit comments

Comments
 (0)