lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191209193822.GB19243@linux.intel.com>
Date:   Mon, 9 Dec 2019 21:38:22 +0200
From:   Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
To:     Sean Christopherson <sean.j.christopherson@...el.com>
Cc:     Haitao Huang <haitao.huang@...ux.intel.com>,
        linux-kernel@...r.kernel.org, x86@...nel.org,
        linux-sgx@...r.kernel.org, akpm@...ux-foundation.org,
        dave.hansen@...el.com, nhorman@...hat.com, npmccallum@...hat.com,
        serge.ayoun@...el.com, shay.katz-zamir@...el.com,
        haitao.huang@...el.com, andriy.shevchenko@...ux.intel.com,
        tglx@...utronix.de, kai.svahn@...el.com, bp@...en8.de,
        josh@...htriplett.org, luto@...nel.org, kai.huang@...el.com,
        rientjes@...gle.com, cedric.xing@...el.com, puiterwijk@...hat.com,
        linux-security-module@...r.kernel.org,
        Suresh Siddha <suresh.b.siddha@...el.com>
Subject: Re: [PATCH v24 12/24] x86/sgx: Linux Enclave Driver

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@...ux.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ