[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+fCnZce9dB9WLXuw+gteoR2+Brq8H6zLo8JaLGuVg=Rfmj78w@mail.gmail.com>
Date: Mon, 23 Jun 2025 01:45:27 +0200
From: Andrey Konovalov <andreyknvl@...il.com>
To: Sabyrzhan Tasbolatov <snovitoll@...il.com>, Andrew Morton <akpm@...ux-foundation.org>
Cc: arnd@...db.de, david@...hat.com, dvyukov@...gle.com, elver@...gle.com,
glider@...gle.com, hch@...radead.org, kasan-dev@...glegroups.com,
linux-kernel@...r.kernel.org, linux-mm@...ck.org, ryabinin.a.a@...il.com,
vincenzo.frascino@....com
Subject: Re: [PATCH v2] mm: unexport globally copy_to_kernel_nofault
On Sun, Jun 22, 2025 at 9:09 PM Sabyrzhan Tasbolatov
<snovitoll@...il.com> wrote:
>
> I haven't verified this, but theoretically, it's a handy
> “write-anywhere-safely” ROP gadget.
> Assume the attacker has already gained an arbitrary RW primitive
> via a UAF/OOB bug. Instead of stitching together
> prepare_kernel_cred() + commit_creds(), which is a common path
> of using exported symbols to achieve privilege escalation.
> This path needs two symbols and register juggling.
> With exported copy_to_kernel_nofault() they can do this:
>
> /* Pseudocode of exploit for a ROP stage running in kernel context */
> struct cred *cred = leaked_pointer;
> rop_call(copy_to_kernel_nofault, &cred->uid, &zero, 4)
>
> copy_to_kernel_nofault() disables page-faults around the write,
> so even if cred corupts a guard-page, the write will not crash.
Attacker can use copy_to_kernel_nofault without it being exported as well.
So I'd say this patch is more of a clean-up of exports.
Powered by blists - more mailing lists