From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: Haitao Huang <haitao.huang@linux.intel.com>,
linux-kernel@vger.kernel.org, x86@kernel.org,
linux-sgx@vger.kernel.org, akpm@linux-foundation.org,
dave.hansen@intel.com, nhorman@redhat.com, npmccallum@redhat.com,
serge.ayoun@intel.com, shay.katz-zamir@intel.com,
haitao.huang@intel.com, andriy.shevchenko@linux.intel.com,
tglx@linutronix.de, kai.svahn@intel.com, bp@alien8.de,
josh@joshtriplett.org, luto@kernel.org, kai.huang@intel.com,
rientjes@google.com, cedric.xing@intel.com,
puiterwijk@redhat.com, linux-security-module@vger.kernel.org,
Suresh Siddha <suresh.b.siddha@intel.com>
Subject: Re: [PATCH v24 12/24] x86/sgx: Linux Enclave Driver
Date: Mon, 9 Dec 2019 21:38:22 +0200 [thread overview]
Message-ID: <20191209193822.GB19243@linux.intel.com> (raw)
In-Reply-To: <20191202182102.GF4063@linux.intel.com>
On Mon, Dec 02, 2019 at 10:21:03AM -0800, Sean Christopherson wrote:
> On Mon, Dec 02, 2019 at 09:48:43AM -0600, Haitao Huang wrote:
> > On Fri, 29 Nov 2019 17:13:14 -0600, Jarkko Sakkinen
> > <jarkko.sakkinen@linux.intel.com> wrote:
> >
> >
> > >+
> > >+ for (c = 0 ; c < addp.length; c += PAGE_SIZE) {
> > >+ if (signal_pending(current)) {
> > >+ ret = -ERESTARTSYS;
> > >+ break;
> > >+ }
> >
> > This IOC is not idempotent as pages EADDed at this point can not be
> > re-EADDed again. So we can't return ERESTARTSYS
>
> Ah, and now I remember why I opted for modifying the parameters directly
> instead of including a "number processed" field. Andy pointed out the
> ERESTARTSYS thing in the original multi-page add RFC[*], so presumably
> updating the params and returning ERESTARTSYS is legal/acceptable.
>
> [*] https://lkml.kernel.org/r/CALCETrUb4X9_L9RXKhmyNpfSCsbNodP=BfbfO8Fz_efq24jp8w@mail.gmail.com
There are exactly two primary options to pick from given the
non-idempotent nature:
A. Return zero (since we support partial operation with the changes I
did in v24).
B. Return -EINTR.
If we wanted to follow common syscall semantics in IO operations, then
the semantics would be a mix of these:
1. Return -EINTR if signals are pending before any pages got added.
2. Return 0 if at least one page got added.
This is how write() works for example according to the documentation
[1]. As far as the user code goes [2] I think for that it is best
idea to rely on semantics that developers are used to instead of
being clever here.
[1] http://man7.org/linux/man-pages/man2/write.2.html
[2] https://lkml.kernel.org/r/CALCETrUb4X9_L9RXKhmyNpfSCsbNodP=BfbfO8Fz_efq24jp8w@mail.gmail.com
/Jarkko
next prev parent reply other threads:[~2019-12-09 19:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20191129231326.18076-1-jarkko.sakkinen@linux.intel.com>
2019-11-29 23:13 ` [PATCH v24 12/24] x86/sgx: Linux Enclave Driver Jarkko Sakkinen
2019-12-02 15:48 ` Haitao Huang
2019-12-02 18:21 ` Sean Christopherson
2019-12-09 19:38 ` Jarkko Sakkinen [this message]
2019-12-09 19:08 ` Jarkko Sakkinen
2020-01-14 16:12 ` Haitao Huang
2020-01-23 12:31 ` Jarkko Sakkinen
2019-11-29 23:13 ` [PATCH v24 15/24] x86/sgx: Add provisioning 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=20191209193822.GB19243@linux.intel.com \
--to=jarkko.sakkinen@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bp@alien8.de \
--cc=cedric.xing@intel.com \
--cc=dave.hansen@intel.com \
--cc=haitao.huang@intel.com \
--cc=haitao.huang@linux.intel.com \
--cc=josh@joshtriplett.org \
--cc=kai.huang@intel.com \
--cc=kai.svahn@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linux-sgx@vger.kernel.org \
--cc=luto@kernel.org \
--cc=nhorman@redhat.com \
--cc=npmccallum@redhat.com \
--cc=puiterwijk@redhat.com \
--cc=rientjes@google.com \
--cc=sean.j.christopherson@intel.com \
--cc=serge.ayoun@intel.com \
--cc=shay.katz-zamir@intel.com \
--cc=suresh.b.siddha@intel.com \
--cc=tglx@linutronix.de \
--cc=x86@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).