forked from Minki/linux
execve fix for v6.0-rc2
- Replace remaining kmap() uses with kmap_local_page() (Fabio M. De Francesco) -----BEGIN PGP SIGNATURE----- iQJKBAABCgA0FiEEpcP2jyKd1g9yPm4TiXL039xtwCYFAmL/3lEWHGtlZXNjb29r QGNocm9taXVtLm9yZwAKCRCJcvTf3G3AJu9xD/9SivxMYldHN8E+KrVUaOUZB6OF k97f+C4d438/kiZKIIGUqHv2Zbq4w9IFX3YQ9cmbN9dArEbTnvuGH/RTGI2L4yK1 uS4BG+9RZZgZfZ+I2JOxX1elqo2qloEkQQJMSvLSXFqElrb6eQWDSdizWMWto+Yb l3Fsfq3zNf2cbxcCmlSaOZ4FFS3t5Yc7r/ArIRNPXVXIMcZkBdqj0fJ7nR7PplJY YKg7ioAIYUoY2nH97hIWvMWTP+DJc9vXp9+SRUB45qph9gkOBBl34aOC39iMIkEH AhPcGPf09DCZAu9sSfx3jH/YVV2jJg2DNbRw9bQlmfu+fdQBYCw1a2mhenpc0rUI OA4R26KMCI7338aWjDJy9N+kY2fhm0J8L2NxZ4ySo0ZMQf3VxbPsXDh6ijX69ijr DllH09o18RCIxhCRLOfGa3Je93FGnd2b/CI1z1CdQqQ/mdCWRvl3jRCpOXstqcAq 5ptU0tIEeY8+hor6rd2RfT5xqd1LjIrNdE0m5UUuNEv30IP2ldKIBWLH6jvZ5LJ2 U/YWJ8/GR+SLrpMNIX6fUAS+2VZNHUbUj2cfmB87OpBmKOcp+vJwf65OzujIfT21 OeMBkjql8DQlXhHk41SMDPrzzx76TJ0IaK0JCRPeUOggZwBX7txfUW5Xyi2UxseD SRT6R+SXibr0vQyemQ== =DTae -----END PGP SIGNATURE----- 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()
This commit is contained in:
commit
50cd95ac46
14
fs/exec.c
14
fs/exec.c
@ -584,11 +584,11 @@ static int copy_strings(int argc, struct user_arg_ptr argv,
|
||||
|
||||
if (kmapped_page) {
|
||||
flush_dcache_page(kmapped_page);
|
||||
kunmap(kmapped_page);
|
||||
kunmap_local(kaddr);
|
||||
put_arg_page(kmapped_page);
|
||||
}
|
||||
kmapped_page = page;
|
||||
kaddr = kmap(kmapped_page);
|
||||
kaddr = kmap_local_page(kmapped_page);
|
||||
kpos = pos & PAGE_MASK;
|
||||
flush_arg_page(bprm, kpos, kmapped_page);
|
||||
}
|
||||
@ -602,7 +602,7 @@ static int copy_strings(int argc, struct user_arg_ptr argv,
|
||||
out:
|
||||
if (kmapped_page) {
|
||||
flush_dcache_page(kmapped_page);
|
||||
kunmap(kmapped_page);
|
||||
kunmap_local(kaddr);
|
||||
put_arg_page(kmapped_page);
|
||||
}
|
||||
return ret;
|
||||
@ -880,11 +880,11 @@ int transfer_args_to_stack(struct linux_binprm *bprm,
|
||||
|
||||
for (index = MAX_ARG_PAGES - 1; index >= stop; index--) {
|
||||
unsigned int offset = index == stop ? bprm->p & ~PAGE_MASK : 0;
|
||||
char *src = kmap(bprm->page[index]) + offset;
|
||||
char *src = kmap_local_page(bprm->page[index]) + offset;
|
||||
sp -= PAGE_SIZE - offset;
|
||||
if (copy_to_user((void *) sp, src, PAGE_SIZE - offset) != 0)
|
||||
ret = -EFAULT;
|
||||
kunmap(bprm->page[index]);
|
||||
kunmap_local(src);
|
||||
if (ret)
|
||||
goto out;
|
||||
}
|
||||
@ -1686,13 +1686,13 @@ int remove_arg_zero(struct linux_binprm *bprm)
|
||||
ret = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
kaddr = kmap_atomic(page);
|
||||
kaddr = kmap_local_page(page);
|
||||
|
||||
for (; offset < PAGE_SIZE && kaddr[offset];
|
||||
offset++, bprm->p++)
|
||||
;
|
||||
|
||||
kunmap_atomic(kaddr);
|
||||
kunmap_local(kaddr);
|
||||
put_arg_page(page);
|
||||
} while (offset == PAGE_SIZE);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user