Linux-Sgx Archive mirror
 help / color / mirror / Atom feed
From: Borys <borysp@invisiblethingslab.com>
To: jarkko@kernel.org, dave.hansen@linux.intel.com,
	linux-sgx@vger.kernel.org
Cc: mkow@invisiblethingslab.com
Subject: sgx_validate_offset_length bug
Date: Mon, 3 Oct 2022 19:19:21 +0200	[thread overview]
Message-ID: <9e1e61cf-39d9-8039-b2e4-f0a3804fe493@invisiblethingslab.com> (raw)

Hi,

I've stumbled upon "sgx_validate_offset_length" function in "arch/x86/kernel/cpu/sgx/ioctl.c" (all of this is based on 6.0-rc7 version), which does not entirely do what it claims. "offset" and "length" parameters are provided by userspace and as such their addition can overflow, which may result in this function approving malicious values. Fortunately this does not result in any exploitable bugs at the moment (or at least I couldn't find any), but this might change if "sgx_validate_offset_length" is used in a new context or current usages are changed, so it might be worth fixing anyway. Simple overflow check `offset + length < offset` should be enough.

Best regards,

Borys


             reply	other threads:[~2022-10-03 17:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-03 17:19 Borys [this message]
2022-10-03 17:33 ` sgx_validate_offset_length bug Reinette Chatre
2022-10-03 17:58   ` Reinette Chatre
2022-10-04 13:22     ` Borys
2022-10-04 15:21       ` Reinette Chatre
2022-10-04 21:50 ` Jarkko Sakkinen
2022-10-04 23:02   ` Borys
2022-10-04 23:13     ` Jarkko Sakkinen

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=9e1e61cf-39d9-8039-b2e4-f0a3804fe493@invisiblethingslab.com \
    --to=borysp@invisiblethingslab.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=jarkko@kernel.org \
    --cc=linux-sgx@vger.kernel.org \
    --cc=mkow@invisiblethingslab.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).