All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher@gmail.com>
To: Kees Cook <keescook@chromium.org>
Cc: "Alex Deucher" <alexander.deucher@amd.com>,
	"Martin Tsai" <martin.tsai@amd.com>,
	"Leo Li" <sunpeng.li@amd.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"Wenjing Liu" <wenjing.liu@amd.com>,
	"Anson Jacob" <Anson.Jacob@amd.com>,
	"amd-gfx list" <amd-gfx@lists.freedesktop.org>,
	"Nicholas Kazlauskas" <nicholas.kazlauskas@amd.com>,
	"David Airlie" <airlied@linux.ie>,
	"Daniel Wheeler" <daniel.wheeler@amd.com>,
	"Maling list - DRI developers" <dri-devel@lists.freedesktop.org>,
	"Christian König" <christian.koenig@amd.com>,
	"Bindu Ramamurthy" <bindu.r@amd.com>
Subject: Re: [PATCH] drm/amd/display: Avoid HDCP over-read and corruption
Date: Tue, 1 Jun 2021 22:06:11 -0400	[thread overview]
Message-ID: <CADnq5_PsvOqBW4-WDvR7BqaZgq3R8vYRPz2=c+87Dokk-zWz_A@mail.gmail.com> (raw)
In-Reply-To: <20210528175354.790719-1-keescook@chromium.org>

On Fri, May 28, 2021 at 1:54 PM Kees Cook <keescook@chromium.org> wrote:
>
> Instead of reading the desired 5 bytes of the actual target field,
> the code was reading 8. This could result in a corrupted value if the
> trailing 3 bytes were non-zero, so instead use an appropriately sized
> and zero-initialized bounce buffer, and read only 5 bytes before casting
> to u64.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>

Applied.  Thanks!

> ---
>  drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c
> index 2cbd931363bd..6d26d9c63ab2 100644
> --- a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c
> +++ b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c
> @@ -29,8 +29,10 @@ static inline enum mod_hdcp_status validate_bksv(struct mod_hdcp *hdcp)
>  {
>         uint64_t n = 0;
>         uint8_t count = 0;
> +       u8 bksv[sizeof(n)] = { };
>
> -       memcpy(&n, hdcp->auth.msg.hdcp1.bksv, sizeof(uint64_t));
> +       memcpy(bksv, hdcp->auth.msg.hdcp1.bksv, sizeof(hdcp->auth.msg.hdcp1.bksv));
> +       n = *(uint64_t *)bksv;
>
>         while (n) {
>                 count++;
> --
> 2.25.1
>

WARNING: multiple messages have this Message-ID (diff)
From: Alex Deucher <alexdeucher@gmail.com>
To: Kees Cook <keescook@chromium.org>
Cc: "Martin Tsai" <martin.tsai@amd.com>,
	"Leo Li" <sunpeng.li@amd.com>, "David Airlie" <airlied@linux.ie>,
	"Wenjing Liu" <wenjing.liu@amd.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"amd-gfx list" <amd-gfx@lists.freedesktop.org>,
	"Christian König" <christian.koenig@amd.com>,
	"Anson Jacob" <Anson.Jacob@amd.com>,
	"Daniel Wheeler" <daniel.wheeler@amd.com>,
	"Maling list - DRI developers" <dri-devel@lists.freedesktop.org>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Nicholas Kazlauskas" <nicholas.kazlauskas@amd.com>,
	"Bindu Ramamurthy" <bindu.r@amd.com>
Subject: Re: [PATCH] drm/amd/display: Avoid HDCP over-read and corruption
Date: Tue, 1 Jun 2021 22:06:11 -0400	[thread overview]
Message-ID: <CADnq5_PsvOqBW4-WDvR7BqaZgq3R8vYRPz2=c+87Dokk-zWz_A@mail.gmail.com> (raw)
In-Reply-To: <20210528175354.790719-1-keescook@chromium.org>

On Fri, May 28, 2021 at 1:54 PM Kees Cook <keescook@chromium.org> wrote:
>
> Instead of reading the desired 5 bytes of the actual target field,
> the code was reading 8. This could result in a corrupted value if the
> trailing 3 bytes were non-zero, so instead use an appropriately sized
> and zero-initialized bounce buffer, and read only 5 bytes before casting
> to u64.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>

Applied.  Thanks!

> ---
>  drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c
> index 2cbd931363bd..6d26d9c63ab2 100644
> --- a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c
> +++ b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c
> @@ -29,8 +29,10 @@ static inline enum mod_hdcp_status validate_bksv(struct mod_hdcp *hdcp)
>  {
>         uint64_t n = 0;
>         uint8_t count = 0;
> +       u8 bksv[sizeof(n)] = { };
>
> -       memcpy(&n, hdcp->auth.msg.hdcp1.bksv, sizeof(uint64_t));
> +       memcpy(bksv, hdcp->auth.msg.hdcp1.bksv, sizeof(hdcp->auth.msg.hdcp1.bksv));
> +       n = *(uint64_t *)bksv;
>
>         while (n) {
>                 count++;
> --
> 2.25.1
>

WARNING: multiple messages have this Message-ID (diff)
From: Alex Deucher <alexdeucher@gmail.com>
To: Kees Cook <keescook@chromium.org>
Cc: "Martin Tsai" <martin.tsai@amd.com>,
	"Leo Li" <sunpeng.li@amd.com>, "David Airlie" <airlied@linux.ie>,
	"Wenjing Liu" <wenjing.liu@amd.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"amd-gfx list" <amd-gfx@lists.freedesktop.org>,
	"Christian König" <christian.koenig@amd.com>,
	"Anson Jacob" <Anson.Jacob@amd.com>,
	"Daniel Wheeler" <daniel.wheeler@amd.com>,
	"Maling list - DRI developers" <dri-devel@lists.freedesktop.org>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Nicholas Kazlauskas" <nicholas.kazlauskas@amd.com>,
	"Bindu Ramamurthy" <bindu.r@amd.com>
Subject: Re: [PATCH] drm/amd/display: Avoid HDCP over-read and corruption
Date: Tue, 1 Jun 2021 22:06:11 -0400	[thread overview]
Message-ID: <CADnq5_PsvOqBW4-WDvR7BqaZgq3R8vYRPz2=c+87Dokk-zWz_A@mail.gmail.com> (raw)
In-Reply-To: <20210528175354.790719-1-keescook@chromium.org>

On Fri, May 28, 2021 at 1:54 PM Kees Cook <keescook@chromium.org> wrote:
>
> Instead of reading the desired 5 bytes of the actual target field,
> the code was reading 8. This could result in a corrupted value if the
> trailing 3 bytes were non-zero, so instead use an appropriately sized
> and zero-initialized bounce buffer, and read only 5 bytes before casting
> to u64.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>

Applied.  Thanks!

> ---
>  drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c
> index 2cbd931363bd..6d26d9c63ab2 100644
> --- a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c
> +++ b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c
> @@ -29,8 +29,10 @@ static inline enum mod_hdcp_status validate_bksv(struct mod_hdcp *hdcp)
>  {
>         uint64_t n = 0;
>         uint8_t count = 0;
> +       u8 bksv[sizeof(n)] = { };
>
> -       memcpy(&n, hdcp->auth.msg.hdcp1.bksv, sizeof(uint64_t));
> +       memcpy(bksv, hdcp->auth.msg.hdcp1.bksv, sizeof(hdcp->auth.msg.hdcp1.bksv));
> +       n = *(uint64_t *)bksv;
>
>         while (n) {
>                 count++;
> --
> 2.25.1
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  reply	other threads:[~2021-06-02  2:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-28 17:53 [PATCH] drm/amd/display: Avoid HDCP over-read and corruption Kees Cook
2021-05-28 17:53 ` Kees Cook
2021-05-28 17:53 ` Kees Cook
2021-06-02  2:06 ` Alex Deucher [this message]
2021-06-02  2:06   ` Alex Deucher
2021-06-02  2:06   ` Alex Deucher

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='CADnq5_PsvOqBW4-WDvR7BqaZgq3R8vYRPz2=c+87Dokk-zWz_A@mail.gmail.com' \
    --to=alexdeucher@gmail.com \
    --cc=Anson.Jacob@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=bindu.r@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel.wheeler@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.tsai@amd.com \
    --cc=nicholas.kazlauskas@amd.com \
    --cc=sunpeng.li@amd.com \
    --cc=wenjing.liu@amd.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.