[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <02874ECE860811409154E81DA85FBB588D562196@ORSMSX121.amr.corp.intel.com>
Date: Tue, 8 Jan 2019 20:45:55 +0000
From: "Keller, Jacob E" <jacob.e.keller@...el.com>
To: Eugene Syromiatnikov <esyr@...hat.com>,
Richard Cochran <richardcochran@...il.com>
CC: David Miller <davem@...emloft.net>,
"mlichvar@...hat.com" <mlichvar@...hat.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"mtosatti@...hat.com" <mtosatti@...hat.com>
Subject: RE: [PATCH net 1/2] ptp: check that rsv field is zero in struct
ptp_sys_offset_extended
> -----Original Message-----
> From: netdev-owner@...r.kernel.org [mailto:netdev-owner@...r.kernel.org] On
> Behalf Of Eugene Syromiatnikov
> Sent: Tuesday, January 08, 2019 6:38 AM
> To: Richard Cochran <richardcochran@...il.com>
> Cc: David Miller <davem@...emloft.net>; mlichvar@...hat.com;
> netdev@...r.kernel.org; Keller, Jacob E <jacob.e.keller@...el.com>;
> mtosatti@...hat.com
> Subject: Re: [PATCH net 1/2] ptp: check that rsv field is zero in struct
> ptp_sys_offset_extended
>
> On Mon, Jan 07, 2019 at 09:19:23PM -0800, Richard Cochran wrote:
> > On Mon, Jan 07, 2019 at 08:29:38AM -0800, David Miller wrote:
> > > From: Eugene Syromiatnikov <esyr@...hat.com>
> > > Date: Mon, 7 Jan 2019 16:22:29 +0100
> > >
> > > > Otherwise it is impossible to use it for something else, as it will break
> > > > userspace that puts garbage there.
> > > >
> > > > The same check should be done in other structures, but the fact that
> > > > data in reserved fields is ignored is already part of the kernel ABI.
> > > >
> > > > Signed-off-by: Eugene Syromiatnikov <esyr@...hat.com>
> > >
> > > I think the opportunity to enforce this has passed and you will break
> > > userspace by doing this.
> >
> > Does this seriously mean that the 'rsv' field in
> >
> > struct ptp_extts_request {
> > unsigned int index; /* Which channel to configure. */
> > unsigned int flags; /* Bit field for PTP_xxx flags. */
> > unsigned int rsv[2]; /* Reserved for future use. */
> > };
> >
> > can never be extended with some semantics?
>
> Yes[*], since there's no check for garbage in both unused flags bits and rsv
> values. The same for ptp_perout_request, ptp_sys_offset, ptp_pin_desc in
> PTP_PIN_SETFUNC, and to some extent for ptp_sys_offset_precise, ptp_clock_caps,
> and ptp_pin_desc in PTP_PIN_GETFUNC (all newly added data has to be
> non-zero there). See also [1][2].
>
> It can be worked around by adding new ioctl commands that operate on the
> same structures, but also perform proper checks, though.
>
So if/when we want to use these fields, this is what we'd have to do...
Is it worth doing that sooner rather than later? i.e. so that the new ioctl command is available for userspace to update to?
Thanks,
Jake
Powered by blists - more mailing lists