linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Scott Bauer <scott.bauer@intel.com>
To: catchall@ghostav.ddnss.de
Cc: Jonas Rabenstein <jonas.rabenstein@studium.uni-erlangen.de>,
	Christoph Hellwig <hch@lst.de>,
	Jonathan Derrick <jonathan.derrick@intel.com>,
	Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 08/11] block: sed-opal: ioctl for writing to shadow mbr
Date: Thu, 5 Apr 2018 14:34:43 -0600	[thread overview]
Message-ID: <20180405203443.ye4gnw5aey2exlkn@sbauer-Z170X-UD5> (raw)
In-Reply-To: <20180329182730.nrdfgdye5jbark4g@ghostav.ddnss.de>

On Thu, Mar 29, 2018 at 08:27:30PM +0200, catchall@ghostav.ddnss.de wrote:
> On Thu, Mar 29, 2018 at 11:16:42AM -0600, Scott Bauer wrote:
> > Yeah, having to autheticate to write the MBR is a real bummer. Theoretically
> > you could dd a the pw struct + the shador MBR into sysfs. But that's
> > a pretty disgusting hack just to use sysfs. The other method I thought of
> > was to authenticate via ioctl then write via sysfs. We already save the PW
> > in-kernel for unlocks, so perhaps we can re-use the save-for-unlock to
> > do shadow MBR writes via sysfs?
> > 
> > Re-using an already exposed ioctl for another purpose seems somewhat dangerous?
> > In the sense that what if the user wants to write the smbr but doesn't want to
> > unlock on suspends, or does not want their PW hanging around in the kernel.
> Well. If we would force the user to a two-step interaction, why not stay
> completely in sysfs? So instead of using the save-for-unlock ioctl, we
> could export each security provider( (AdminSP, UserSPX, ...) as a sysfs

The Problem with this is Single user mode, where you can assign users to locking ranges.
There would have to be a lot of dynamic changes of sysfs as users get added/removed,
or added to LRs etc. It seems like we're trying mold something that already
works fine into something that doesnt really work as we dig into the details. 



> directory with appropriate files (e.g. mbr for AdminSP) as well as a
> 'unlock' file to store a users password for the specific locking space
> and a 'lock' file to remove the stored password on write to it.
> Of course, while this will prevent from reuse of the ioctl and
> stays within the same configuration method, the PW will still hang
> around in the kernel between 'lock' and 'unlock'.
> 
> Another idea I just came across while writing this down:
> Instead of storing/releasing the password permanently with the 'unlock' and
> 'lock' files, those may be used to start/stop an authenticated session.
> To make it more clear what I mean: Each ioctl that requires
> authentication has a similar pattern:
> discovery0, start_session, <do_work>, end_session
> Instead of having the combination determined by the ioctl, the 'unlock'
> would do discovery0 and start_session while the 'lock' would do the
> end_session. The user is free to issue further commands with the
> appropriate write/reads to other files of the sysfs-directory.
> While this removes the requirement to store the key within kernel space,
> the open session handle may be used from everybody with permissions for
> read/write access to the sysfs-directory files. So this is not optimal
> as not only the user who provided the password will finally be able to use
> it.

I generally like the idea of being able to run your abritrary opal commands, but:

that's probably not going to work for the final reason you outlined.
Even though it's root only access(to sysfs) we're breaking the authentication
lower down by essentially allowing any opal command to be ran if you've somehow
become root.

The other issue with this is the session time out in opal. When we dispatch the commands
in-kernel we're hammering them out 1-by-1. If the user needs to do an activatelsp,
setuplr, etc. They do that with a new session.

If someone starts the session and it times out it may be hard to figure out how to not
get an SP_BUSY back from the controller. I've in the past just had to wipe my damn
fw to get out of SP_BUSYs, but that could be due to the early implementations I was
dealing with.



> I already did some basic work to split of the session-information from
> the opal_dev struct (initially to reduce the memory-footprint of devices with
> currently no active opal-interaction). So I think, I could get a
> proof-of-concept of this approach within the next one or two weeks if
> there are no objections to the base idea.

Sorry to ocme back a week later, but if you do have anything it would be at least
interesting to see. I would still prefer the ioctl route, but will review and test
any implementation people deem acceptable. 

  reply	other threads:[~2018-04-05 21:01 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-13 13:08 [PATCH 0/8] block: sed-opal: support write to shadow mbr Jonas Rabenstein
2018-03-13 13:08 ` [PATCH 1/8] block: sed-opal: use correct macro for method length Jonas Rabenstein
2018-03-13 13:08 ` [PATCH 2/8] block: sed-opal: unify space check in add_token_* Jonas Rabenstein
2018-03-13 13:08 ` [PATCH 3/8] block: sed-opal: unify cmd start and finalize Jonas Rabenstein
2018-03-13 15:01   ` Scott Bauer
2018-03-14  6:26   ` [PATCH v2 " Jonas Rabenstein
2018-03-13 13:08 ` [PATCH 4/8] block: sed-opal: unify error handling of responses Jonas Rabenstein
2018-03-13 13:08 ` [PATCH 5/8] block: sed-opal: print failed function address Jonas Rabenstein
2018-03-13 13:08 ` [PATCH 6/8] block: sed-opal: split generation of bytestring header and content Jonas Rabenstein
2018-03-13 13:09 ` [PATCH 7/8] block: sed-opal: add ioctl for done-mark of shadow mbr Jonas Rabenstein
2018-03-13 13:09 ` [PATCH 8/8] block: sed-opal: ioctl for writing to " Jonas Rabenstein
2018-03-13 15:44   ` Scott Bauer
2018-03-14  6:15   ` [PATCH v2 8.0/8.4] block: sed-opal: check size of " Jonas Rabenstein
2018-03-14  6:15   ` [PATCH v2 8.1/8.4] block: sed-opal: ioctl for writing to " Jonas Rabenstein
2018-03-14  6:15   ` [PATCH v2 8.2/8.4] block: sed-opal: unify retrieval of table columns Jonas Rabenstein
2018-03-14  6:15   ` [PATCH v2 8.3/8.4] block: sed-opal: get metadata about opal-sed tables Jonas Rabenstein
2018-03-14  6:15   ` [PATCH v2 8.4/8.4] block: sed-opal: check size of shadow mbr Jonas Rabenstein
2018-03-14 19:39   ` [PATCH 8/8] block: sed-opal: ioctl for writing to " kbuild test robot
2018-03-13 15:53 ` [PATCH 0/8] block: sed-opal: support write " Scott Bauer
2018-03-19 18:36 ` [PATCH v2 00/11] block: sed-opal " Jonas Rabenstein
2018-03-19 19:53   ` Christoph Hellwig
2018-03-19 19:33     ` Scott Bauer
2018-03-19 18:36 ` [PATCH v2 01/11] block: sed-opal: use correct macro for method length Jonas Rabenstein
2018-03-19 19:53   ` Christoph Hellwig
2018-03-19 18:36 ` [PATCH v2 02/11] block: sed-opal: unify space check in add_token_* Jonas Rabenstein
2018-03-19 19:54   ` Christoph Hellwig
2018-03-19 18:36 ` [PATCH v2 03/11] block: sed-opal: unify cmd start and finalize Jonas Rabenstein
2018-03-19 19:57   ` Christoph Hellwig
2018-03-19 18:36 ` [PATCH v2 04/11] block: sed-opal: unify error handling of responses Jonas Rabenstein
2018-03-19 19:58   ` Christoph Hellwig
2018-03-19 18:36 ` [PATCH v2 05/11] block: sed-opal: print failed function address Jonas Rabenstein
2018-03-19 19:58   ` Christoph Hellwig
2018-03-19 18:36 ` [PATCH v2 06/11] block: sed-opal: split generation of bytestring header and content Jonas Rabenstein
2018-03-19 19:59   ` Christoph Hellwig
2018-03-19 19:41     ` Scott Bauer
2018-03-19 18:36 ` [PATCH v2 07/11] block: sed-opal: add ioctl for done-mark of shadow mbr Jonas Rabenstein
2018-03-19 20:00   ` Christoph Hellwig
2018-03-19 18:36 ` [PATCH v2 08/11] block: sed-opal: ioctl for writing to " Jonas Rabenstein
2018-03-19 19:52   ` Christoph Hellwig
2018-03-20  9:36     ` Jonas Rabenstein
2018-03-20 22:09       ` Scott Bauer
2018-03-21  1:43         ` Jonas Rabenstein
2018-03-29 17:30           ` Jonas Rabenstein
2018-03-29 17:16             ` Scott Bauer
2018-03-29 18:27               ` catchall
2018-04-05 20:34                 ` Scott Bauer [this message]
2018-03-19 18:36 ` [PATCH v2 09/11] block: sed-opal: unify retrieval of table columns Jonas Rabenstein
2018-03-19 18:36 ` [PATCH v2 10/11] block: sed-opal: get metadata about opal-sed tables Jonas Rabenstein
2018-03-19 20:01   ` Christoph Hellwig
2018-03-19 18:36 ` [PATCH v2 11/11] block: sed-opal: check size of shadow mbr Jonas Rabenstein
2018-03-19 20:01   ` Christoph Hellwig
2018-03-20 10:02     ` Jonas Rabenstein

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=20180405203443.ye4gnw5aey2exlkn@sbauer-Z170X-UD5 \
    --to=scott.bauer@intel.com \
    --cc=axboe@kernel.dk \
    --cc=catchall@ghostav.ddnss.de \
    --cc=hch@lst.de \
    --cc=jonas.rabenstein@studium.uni-erlangen.de \
    --cc=jonathan.derrick@intel.com \
    --cc=linux-block@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).