Storage Performance Development Kit (SPDK)
 help / color / mirror / Atom feed
From: Walker, Benjamin <benjamin.walker at intel.com>
To: spdk@lists.01.org
Subject: Re: [SPDK] Running SPDK As Non-root User
Date: Tue, 05 Dec 2017 20:04:30 +0000	[thread overview]
Message-ID: <1512504268.2692.147.camel@intel.com> (raw)
In-Reply-To: MWHPR19MB00644384ED5B1968AFAB67DCDB3D0@MWHPR19MB0064.namprd19.prod.outlook.com

[-- Attachment #1: Type: text/plain, Size: 1581 bytes --]

On Tue, 2017-12-05 at 16:55 +0000, Dave Boutcher wrote:
> There was some discussion back in 2016 about running SPDK (and DPDK)
> applications as non-root users.  I finally got annoyed enough about this to
> figure it out.
> 
> You can run SPDK applications as non-root if you set the following
> capabilities:
> 
>  $ sudo setcap "cap_dac_read_search,cap_sys_admin+ep" myapplication
> 
> Note that this is a fairly big hammer...by the time you give the application
> sys_admin and dac_read_search, it is fairly powerful, but it is a smaller
> hammer than running as root :-)

Fortunately, it is totally possible to run SPDK and DPDK without granting your
user any additional permissions (except for one catch). If you just run the SPDK
scripts/setup.sh under sudo, it automatically sets up whatever user invoked the
sudo command to be able to run as an entirely unprivileged user. The only
requirement is that you have VT-d and your IOMMU enabled. You'll know you have
it right if you see scripts/setup.sh binding your devices to vfio-pci instead of
uio.

The catch is that we accidentally broke this a few months ago on some
distributions because they don't allow unprivileged users to call shm_open with
the O_CREAT flag. To make it work again, you need to grant your user permission
to write to /dev/shm. I just tried it and it works, at least on Fedora 26. We'll
try to come up with a better strategy here.

> _______________________________________________
> SPDK mailing list
> SPDK(a)lists.01.org
> https://lists.01.org/mailman/listinfo/spdk

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3274 bytes --]

             reply	other threads:[~2017-12-05 20:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-05 20:04 Walker, Benjamin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-12-05 16:55 [SPDK] Running SPDK As Non-root User Dave Boutcher
2016-12-27 21:19 Walker, Benjamin
2016-12-26 11:49 Kariuki, John K
2016-12-24 14:26 Andrey Kuzmin
2016-12-24  4:04 Karthi M
2016-12-23 16:50 Andrey Kuzmin
2016-12-23 16:00 Kariuki, John K
2016-12-23 11:16 karthi

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=1512504268.2692.147.camel@intel.com \
    --to=spdk@lists.01.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