Skip to content

Commit 50cd95a

Browse files
committed
Merge tag 'execve-v6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull execve fix from Kees Cook: - Replace remaining kmap() uses with kmap_local_page() (Fabio M. De Francesco) * tag 'execve-v6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: exec: Replace kmap{,_atomic}() with kmap_local_page()
2 parents e45c890 + 3a608cf commit 50cd95a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

fs/exec.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -584,11 +584,11 @@ static int copy_strings(int argc, struct user_arg_ptr argv,
584584

585585
if (kmapped_page) {
586586
flush_dcache_page(kmapped_page);
587-
kunmap(kmapped_page);
587+
kunmap_local(kaddr);
588588
put_arg_page(kmapped_page);
589589
}
590590
kmapped_page = page;
591-
kaddr = kmap(kmapped_page);
591+
kaddr = kmap_local_page(kmapped_page);
592592
kpos = pos & PAGE_MASK;
593593
flush_arg_page(bprm, kpos, kmapped_page);
594594
}
@@ -602,7 +602,7 @@ static int copy_strings(int argc, struct user_arg_ptr argv,
602602
out:
603603
if (kmapped_page) {
604604
flush_dcache_page(kmapped_page);
605-
kunmap(kmapped_page);
605+
kunmap_local(kaddr);
606606
put_arg_page(kmapped_page);
607607
}
608608
return ret;
@@ -880,11 +880,11 @@ int transfer_args_to_stack(struct linux_binprm *bprm,
880880

881881
for (index = MAX_ARG_PAGES - 1; index >= stop; index--) {
882882
unsigned int offset = index == stop ? bprm->p & ~PAGE_MASK : 0;
883-
char *src = kmap(bprm->page[index]) + offset;
883+
char *src = kmap_local_page(bprm->page[index]) + offset;
884884
sp -= PAGE_SIZE - offset;
885885
if (copy_to_user((void *) sp, src, PAGE_SIZE - offset) != 0)
886886
ret = -EFAULT;
887-
kunmap(bprm->page[index]);
887+
kunmap_local(src);
888888
if (ret)
889889
goto out;
890890
}
@@ -1686,13 +1686,13 @@ int remove_arg_zero(struct linux_binprm *bprm)
16861686
ret = -EFAULT;
16871687
goto out;
16881688
}
1689-
kaddr = kmap_atomic(page);
1689+
kaddr = kmap_local_page(page);
16901690

16911691
for (; offset < PAGE_SIZE && kaddr[offset];
16921692
offset++, bprm->p++)
16931693
;
16941694

1695-
kunmap_atomic(kaddr);
1695+
kunmap_local(kaddr);
16961696
put_arg_page(page);
16971697
} while (offset == PAGE_SIZE);
16981698

0 commit comments

Comments
 (0)