From: Greg KH <gregkh@linuxfoundation.org>
To: Young Xiao <92siuyang@gmail.com>
Cc: airlied@linux.ie, arnd@arndb.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] amd64-agp: fix arbitrary kernel memory writes
Date: Wed, 29 May 2019 01:34:59 -0700 [thread overview]
Message-ID: <20190529083459.GA1936@kroah.com> (raw)
In-Reply-To: <1559105521-27053-1-git-send-email-92siuyang@gmail.com>
On Wed, May 29, 2019 at 12:52:01PM +0800, Young Xiao wrote:
> pg_start is copied from userspace on AGPIOC_BIND and AGPIOC_UNBIND ioctl
> cmds of agp_ioctl() and passed to agpioc_bind_wrap(). As said in the
> comment, (pg_start + mem->page_count) may wrap in case of AGPIOC_BIND,
> and it is not checked at all in case of AGPIOC_UNBIND. As a result, user
> with sufficient privileges (usually "video" group) may generate either
> local DoS or privilege escalation.
>
> See commit 194b3da873fd ("agp: fix arbitrary kernel memory writes")
> for details.
>
> Signed-off-by: Young Xiao <92siuyang@gmail.com>
> ---
> drivers/char/agp/amd64-agp.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
> index c69e39f..5daa0e3 100644
> --- a/drivers/char/agp/amd64-agp.c
> +++ b/drivers/char/agp/amd64-agp.c
> @@ -60,7 +60,8 @@ static int amd64_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
>
> /* Make sure we can fit the range in the gatt table. */
> /* FIXME: could wrap */
> - if (((unsigned long)pg_start + mem->page_count) > num_entries)
> + if (((pg_start + mem->page_count) > num_entries) ||
> + ((pg_start + mem->page_count) < pg_start))
Why did you take off the cast for the first test?
And if this really does fix this issue, should you remove the FIXME
line?
thanks,
greg k-h
next prev parent reply other threads:[~2019-05-29 8:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-29 4:52 [PATCH] amd64-agp: fix arbitrary kernel memory writes Young Xiao
2019-05-29 8:34 ` Greg KH [this message]
2019-05-29 15:14 ` Yang Xiao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190529083459.GA1936@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=92siuyang@gmail.com \
--cc=airlied@linux.ie \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox