From: "Koenig, Christian" <Christian.Koenig@amd.com>
To: Wenwen Wang <wang6495@umn.edu>
Cc: Kangjie Lu <kjlu@umn.edu>,
"Deucher, Alexander" <Alexander.Deucher@amd.com>,
"Zhou, David(ChunMing)" <David1.Zhou@amd.com>,
David Airlie <airlied@linux.ie>, "Wang, Ken" <Ken.Wang@amd.com>,
"open list:RADEON and AMDGPU DRM DRIVERS"
<amd-gfx@lists.freedesktop.org>,
"open list:DRM DRIVERS" <dri-devel@lists.freedesktop.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/amdgpu: fix a missing-check bug
Date: Mon, 22 Oct 2018 06:55:04 +0000 [thread overview]
Message-ID: <fbd47fc0-c85c-baad-2e35-83de43d0b405@amd.com> (raw)
In-Reply-To: <1540069075-18358-1-git-send-email-wang6495@umn.edu>
Am 20.10.18 um 22:57 schrieb Wenwen Wang:
> In amdgpu_read_bios_from_rom(), the header of the VBIOS is firstly copied
> to 'header' from an IO memory region through
> amdgpu_asic_read_bios_from_rom(). Then the header is checked to see whether
> it is a valid header. If yes, the whole VBIOS, including the header, is
> then copied to 'adev->bios'. The problem here is that no check is enforced
> on the header after the second copy. Given that the device also has the
> permission to access the IO memory region, it is possible for a malicious
> device controlled by an attacker to modify the header between these two
> copies. By doing so, the attacker can supply compromised VBIOS, which can
> cause undefined behavior of the kernel and introduce potential security
> issues.
>
> This patch rewrites the header in 'adev->bios' using the header acquired in
> the first copy.
As already answered previously this is completely superfluous.
We are not mapping VRAM here, but a flash ROM (Read Only Memory). The
flash rom is not changeable through the mapping.
Additional to that the length check is just to confirm that the rom is
correctly mapped, it doesn't validate the rom in any way.
Regards,
Christian.
>
> Signed-off-by: Wenwen Wang <wang6495@umn.edu>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> index a5df80d..ac701f4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> @@ -181,6 +181,8 @@ static bool amdgpu_read_bios_from_rom(struct amdgpu_device *adev)
> /* read complete BIOS */
> amdgpu_asic_read_bios_from_rom(adev, adev->bios, len);
>
> + memcpy(adev->bios, header, AMD_VBIOS_SIGNATURE_END);
> +
> if (!check_atom_bios(adev->bios, len)) {
> kfree(adev->bios);
> return false;
next prev parent reply other threads:[~2018-10-22 6:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-20 20:57 Wenwen Wang
2018-10-22 6:55 ` Koenig, Christian [this message]
2018-10-22 17:51 ` Kuehling, Felix
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=fbd47fc0-c85c-baad-2e35-83de43d0b405@amd.com \
--to=christian.koenig@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=David1.Zhou@amd.com \
--cc=Ken.Wang@amd.com \
--cc=airlied@linux.ie \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=wang6495@umn.edu \
/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
Powered by JetHome