From: David Laight <David.Laight@ACULAB.COM>
To: dccp@vger.kernel.org
Subject: RE: [PATCH 03/24] net: add a new sockptr_t type
Date: Tue, 21 Jul 2020 09:55:20 +0000 [thread overview]
Message-ID: <9b7ae3245bad474db2a3889bc1c1a329@AcuMS.aculab.com> (raw)
In-Reply-To: <20200720124737.118617-4-hch@lst.de>
From: Eric Biggers
> Sent: 20 July 2020 17:38
...
> How does this not introduce a massive security hole when
> CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE?
>
> AFAICS, userspace can pass in a pointer >= TASK_SIZE,
> and this code makes it be treated as a kernel pointer.
One thought I've had is that on 64-bit architectures there
is almost always some part of the KVA that can never be valid
and is larger than the maximum size of a user VA.
If the user address is offset into this invalid area
then it can always be distinguished from a kernel address.
Indeed it may be worth considering offsetting kernel
addresses as well.
This forces code to use the correct accessors.
It doesn't solve the problem for 32bit systems with
CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE since
they are likely to have all 32bit addresses available
to both use and kernel.
If you end up with a 'fat pointer' then it may be worth
adding the length and making it a 'buffer descriptor'.
This can then be passed by address and the reduced
number of parameters will probably offset the cost
of the extra indirection.
The read/write functions could then take the 'buffer descriptor',
offset and length as parameters.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2020-07-21 9:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-20 12:47 [PATCH 03/24] net: add a new sockptr_t type Christoph Hellwig
2020-07-20 16:37 ` Eric Biggers
2020-07-20 17:43 ` Christoph Hellwig
2020-07-20 17:55 ` Eric Biggers
2020-07-21 9:55 ` David Laight [this message]
2020-07-21 10:14 ` David Laight
2020-07-22 7:56 ` Christoph Hellwig
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=9b7ae3245bad474db2a3889bc1c1a329@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=dccp@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