--- lib/iov_iter.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/iov_iter.c b/lib/iov_iter.c index f9193f952f49..8997272481c3 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -41,6 +41,10 @@ size_t copy_to_user_iter_nofault(void __user *iter_to, size_t progress, return res < 0 ? len : res; } +#ifndef PIN_BUDDY_PAGES_WATERMARK +#define PIN_BUDDY_PAGES_WATERMARK PAGE_SIZE +#endif + static __always_inline size_t copy_from_user_iter(void __user *iter_from, size_t progress, size_t len, void *to, void *priv2) @@ -52,7 +56,15 @@ size_t copy_from_user_iter(void __user *iter_from, size_t progress, if (access_ok(iter_from, len)) { to += progress; instrument_copy_from_user_before(to, iter_from, len); +#ifdef SAFEFETCH_PIN_BUDDY_PAGES + /* #warning "Using Page_pinning for copyin calls" */ + if (len >= PIN_BUDDY_PAGES_WATERMARK) + res = raw_copy_from_user_pinning(to, iter_from, len); + else + res = raw_copy_from_user(to, iter_from, len); +#else res = raw_copy_from_user(to, iter_from, len); +#endif instrument_copy_from_user_after(to, iter_from, len, res); } return res; -- 2.25.1
- [RFC v1 00/17] Add Safefetch double-fetch protection Gatlin Newhouse
- [RFC v1 02/17] x86: syscall: support caching in do_sy... Gatlin Newhouse
- [RFC v1 05/17] uaccess: add non-caching copy_from_use... Gatlin Newhouse
- [RFC v1 04/17] sched: add protection to task_struct Gatlin Newhouse
- [RFC v1 08/17] init: add caching startup and initiali... Gatlin Newhouse
- [RFC v1 11/17] kernel: add SafeFetch cache handling t... Gatlin Newhouse
- [RFC v1 10/17] iov_iter: add SafeFetch pinning call t... Gatlin Newhouse
- [RFC v1 09/17] exit: add destruction of SafeFetch cac... Gatlin Newhouse
- [RFC v1 12/17] bug: add SafeFetch statistics tracking... Gatlin Newhouse
- [RFC v1 07/17] gup: add non-caching get_user call to ... Gatlin Newhouse
- [RFC v1 15/17] kconfig: debug: add SafeFetch to debug... Gatlin Newhouse
- [RFC v1 17/17] vfs: ioctl: add logging to ioctl_file_... Gatlin Newhouse
- [RFC v1 13/17] softirq: add SafeFetch statistics to i... Gatlin Newhouse
- [RFC v1 14/17] makefile: add SafeFetch support to mak... Gatlin Newhouse
- [RFC v1 06/17] futex: add get_user_no_dfcache() funct... Gatlin Newhouse
- [RFC v1 03/17] x86: asm: support caching in do_get_us... Gatlin Newhouse
- [RFC v1 16/17] x86: enable SafeFetch on x86_64 builds Gatlin Newhouse