Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1577821 > unrolled thread

Sed-opal fixups

Started byScott Bauer <scott.bauer@intel.com>
First post2017-02-09 18:40 +0100
Last post2017-02-09 19:10 +0100
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  Sed-opal fixups  Scott Bauer <scott.bauer@intel.com> - 2017-02-09 18:40 +0100
    Re: Sed-opal fixups Scott Bauer <scott.bauer@intel.com> - 2017-02-09 19:00 +0100
      Re: Sed-opal fixups Scott Bauer <scott.bauer@intel.com> - 2017-02-09 21:20 +0100
    RE: Sed-opal fixups  David Laight <David.Laight@ACULAB.COM> - 2017-02-09 19:10 +0100

#1577821 — Sed-opal fixups

FromScott Bauer <scott.bauer@intel.com>
Date2017-02-09 18:40 +0100
SubjectSed-opal fixups
Message-ID<t90Rj-BX-7@gated-at.bofh.it>
It may be too late to change anyhting in the uapi header. When we
switched over to using IOC_SIZE I found a bug where I had switched
up a structure in one of the series from v4 to v5 but never changed
the structure in the IOW. The structure that was in there was to small
so when we kzalloc on it we don't request enough space. It worked before
because we were using the cmd strictly as a command #, not using the IOC
and friends.

If it's too late to modify that IOW, I can work around it by reallocing
on the correct size for that command only. I verified the rest of the
commands and the structures are the same.

Let me know what you think, please.

[toc] | [next] | [standalone]


#1577825

FromScott Bauer <scott.bauer@intel.com>
Date2017-02-09 19:00 +0100
Message-ID<t91aG-J1-7@gated-at.bofh.it>
In reply to#1577821
On Thu, Feb 09, 2017 at 05:43:20PM +0000, David Laight wrote:
> From: Scott Bauer
> > Sent: 09 February 2017 17:20
> > It may be too late to change anyhting in the uapi header. When we
> > switched over to using IOC_SIZE I found a bug where I had switched
> > up a structure in one of the series from v4 to v5 but never changed
> > the structure in the IOW. The structure that was in there was to small
> > so when we kzalloc on it we don't request enough space. It worked before
> > because we were using the cmd strictly as a command #, not using the IOC
> > and friends.
> > 
> > If it's too late to modify that IOW, I can work around it by reallocing
> > on the correct size for that command only. I verified the rest of the
> > commands and the structures are the same.
> > 
> > Let me know what you think, please.
> 
> Maybe define IOC_OPAL_ACTIVATE_LSP_OLD to the incorrect value and
> IOC_OPAL_ACTIVATE_LSP to the correct one.
> But that relies on any users specifying the correct structure.
> I wouldn't guarantee that.

I think I'm the only userspace user right now, this went in on monday,
so I can can change my tooling easily. I just wasnt sure if there was a
set time where the user ABI cannot be changed.

> 
> At the top of the driver's ioctl path add:
> 	if (cmd == IOC_OPAL_ACTIVATE_LSP_OLD) cmd = IOC_OPAL_ACTIVATE_LSP;
>

I think it would have to be the other way around the correct sized one would
be IOC_OPAL_ACTIAVE_LSP_NEW so the check would be:
if (cmd == IOC_OPAL_ACTIVATE_LSP) cmd = IOC_OPAL_ACTIVATE_LSP_NEW. If we're
allowed to change it (the bad sized one) from LSP to LSP_OLD then we should
just change the structure. If we have to leave it we need to introduce a _NEW
with the correct size.


> For some code I added a userspace wrapper on ioctl() to check the
> size of the supplied arg matched that required by the 'cmd'.
> I've also done the same in the kernel.
> (all as compile time checks).
> 
> 	David
> 
> 

[toc] | [prev] | [next] | [standalone]


#1577922

FromScott Bauer <scott.bauer@intel.com>
Date2017-02-09 21:20 +0100
Message-ID<t93ma-2fX-15@gated-at.bofh.it>
In reply to#1577825
e0;136;0csOn Thu, Feb 09, 2017 at 11:24:58AM -0700, Jens Axboe wrote:
> On 02/09/2017 10:45 AM, Scott Bauer wrote:
> > On Thu, Feb 09, 2017 at 05:43:20PM +0000, David Laight wrote:
> >> From: Scott Bauer
> >>> Sent: 09 February 2017 17:20
> >>> It may be too late to change anyhting in the uapi header. When we
> >>> switched over to using IOC_SIZE I found a bug where I had switched
> >>> up a structure in one of the series from v4 to v5 but never changed
> >>> the structure in the IOW. The structure that was in there was to small
> >>> so when we kzalloc on it we don't request enough space. It worked before
> >>> because we were using the cmd strictly as a command #, not using the IOC
> >>> and friends.
> >>>
> >>> If it's too late to modify that IOW, I can work around it by reallocing
> >>> on the correct size for that command only. I verified the rest of the
> >>> commands and the structures are the same.
> >>>
> >>> Let me know what you think, please.
> >>
> >> Maybe define IOC_OPAL_ACTIVATE_LSP_OLD to the incorrect value and
> >> IOC_OPAL_ACTIVATE_LSP to the correct one.
> >> But that relies on any users specifying the correct structure.
> >> I wouldn't guarantee that.
> > 
> > I think I'm the only userspace user right now, this went in on monday,
> > so I can can change my tooling easily. I just wasnt sure if there was a
> > set time where the user ABI cannot be changed.
> 
> We can still change it, and we definitely should if it improves the
> interface. It's not a ABI until it's in a released, final kernel.
>

Thanks for the clarification, Jens.
In that case I'd like to keep the ABI fixup in patch one and the dynamic allocation
in patch 2.
I'd like to wait for Christoph's blessing as well before you take it.

Thanks

[toc] | [prev] | [next] | [standalone]


#1577831

FromDavid Laight <David.Laight@ACULAB.COM>
Date2017-02-09 19:10 +0100
Message-ID<t91aG-J1-9@gated-at.bofh.it>
In reply to#1577821
From: Scott Bauer
> Sent: 09 February 2017 17:20
> It may be too late to change anyhting in the uapi header. When we
> switched over to using IOC_SIZE I found a bug where I had switched
> up a structure in one of the series from v4 to v5 but never changed
> the structure in the IOW. The structure that was in there was to small
> so when we kzalloc on it we don't request enough space. It worked before
> because we were using the cmd strictly as a command #, not using the IOC
> and friends.
> 
> If it's too late to modify that IOW, I can work around it by reallocing
> on the correct size for that command only. I verified the rest of the
> commands and the structures are the same.
> 
> Let me know what you think, please.

Maybe define IOC_OPAL_ACTIVATE_LSP_OLD to the incorrect value and
IOC_OPAL_ACTIVATE_LSP to the correct one.
But that relies on any users specifying the correct structure.
I wouldn't guarantee that.

At the top of the driver's ioctl path add:
	if (cmd == IOC_OPAL_ACTIVATE_LSP_OLD) cmd = IOC_OPAL_ACTIVATE_LSP;

For some code I added a userspace wrapper on ioctl() to check the
size of the supplied arg matched that required by the 'cmd'.
I've also done the same in the kernel.
(all as compile time checks).

	David

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web