Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1478572
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened usercopy feature |
| Date | 2016-09-07 21:30 +0200 |
| Message-ID | <seQHM-3XU-23@gated-at.bofh.it> (permalink) |
| References | (2 earlier) <sdXLk-1lQ-5@gated-at.bofh.it> <sesPd-55p-11@gated-at.bofh.it> <seFCF-59y-17@gated-at.bofh.it> <seO3g-298-31@gated-at.bofh.it> <seOmC-2g5-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Sep 07, 2016 at 09:58:01AM -0700, Linus Torvalds wrote: > On Wed, Sep 7, 2016 at 9:38 AM, Andi Kleen <andi@firstfloor.org> wrote: > >> > >> - n = copy_to_user(buffer, (char *)start, tsz); > >> + buf = kzalloc(tsz, GFP_KERNEL); > > > > You have to add some limit and a loop, otherwise a user can eat all kernel memory, > > or copies > KMALLOC_MAX wouldn't work. Probably only get a single page. > > 'start' and 'tsz' is already chunked to be aligned pages (well, as > aligned as they can be: the beginning and end obviously won't be). > Above the loop: > > if ((tsz = (PAGE_SIZE - (start & ~PAGE_MASK))) > buflen) > tsz = buflen; > > and then inside the loop: > > tsz = (buflen > PAGE_SIZE ? PAGE_SIZE : buflen); > > so it's already limited to one page. > > That said, it *might* be worth moving the temporary allocation to the > top, or even to move it to open_kcore(). It used to be a special case > for just the vmalloc region, now it's always done. > > So instead of having two different copies of the same special case for > the two different cases, why not try to unify them and just have one > common (page-sized) buffer allocation? ook, sounds good.. will repost soon jirka
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] fs/proc/kcore.c: Omit kernel text area for hardened usercopy feature Jiri Olsa <jolsa@kernel.org> - 2016-09-02 14:30 +0200
Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened usercopy feature Andi Kleen <andi@firstfloor.org> - 2016-09-02 17:20 +0200
Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened usercopy feature Jiri Olsa <jolsa@redhat.com> - 2016-09-02 18:20 +0200
Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened usercopy feature Jiri Olsa <jolsa@redhat.com> - 2016-09-05 10:50 +0200
Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened usercopy feature Andi Kleen <andi@firstfloor.org> - 2016-09-05 18:30 +0200
Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened usercopy feature Kees Cook <keescook@chromium.org> - 2016-09-06 20:00 +0200
Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened usercopy feature Linus Torvalds <torvalds@linux-foundation.org> - 2016-09-06 20:40 +0200
Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened usercopy feature Andi Kleen <andi@firstfloor.org> - 2016-09-06 21:50 +0200
Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened usercopy feature Linus Torvalds <torvalds@linux-foundation.org> - 2016-09-06 21:50 +0200
Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened usercopy feature Kees Cook <keescook@chromium.org> - 2016-09-07 19:20 +0200
Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened usercopy feature Linus Torvalds <torvalds@linux-foundation.org> - 2016-09-07 19:30 +0200
Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened usercopy feature Jiri Olsa <jolsa@redhat.com> - 2016-09-07 09:40 +0200
Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened usercopy feature Andi Kleen <andi@firstfloor.org> - 2016-09-07 18:40 +0200
Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened usercopy feature Linus Torvalds <torvalds@linux-foundation.org> - 2016-09-07 19:00 +0200
Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened usercopy feature Jiri Olsa <jolsa@redhat.com> - 2016-09-07 21:30 +0200
Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened usercopy feature Jiri Olsa <jolsa@redhat.com> - 2016-09-07 23:30 +0200
Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened usercopy feature Linus Torvalds <torvalds@linux-foundation.org> - 2016-09-08 01:00 +0200
csiph-web