All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: David Herrmann <dh.herrmann-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
Cc: "Kirill A. Shutemov"
	<kirill.shutemov-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Jiri Kosina <jkosina-AlSwsSmVLrQ@public.gmane.org>,
	RavindranathX Doddi
	<ravindranathx.doddi-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Greg Kroah-Hartman
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
	Linus Torvalds
	<torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Marcel Holtmann <marcel-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
Subject: Re: uhid: broken interface: 32/64-bit compatibility
Date: Fri, 15 Feb 2013 14:00:22 +0200	[thread overview]
Message-ID: <20130215120022.GA23694@x220> (raw)
In-Reply-To: <CANq1E4T1QzOUOwWPpV6_55hVTXzXF4baShxpYaM0HNAgF0ffAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Hi David,

On Fri, Feb 15, 2013, David Herrmann wrote:
> On Fri, Feb 15, 2013 at 12:29 PM, Kirill A. Shutemov
> <kirill.shutemov-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> wrote:
> > Hi David and all,
> >
> > There's claim in uhid.h that the interface is "compatible even between
> > architectures". But it obviously is not true: struct uhid_create_req
> > contains pointer which breaks everything.
> >
> > The easy way to demonstrate the issue is compile uhid-example.c with -m32
> > and try to run it on 64 bit kernel. Creating of the device will fail.
> 
> Indeed, we missed that. We should probably also notify the HIDP
> developers as "struct hidp_connadd_req" suffers from the same
> problems. (CC'ed)
> 
> > I don't see an easy way to fix this. Few options:
> >
> > 1. Replace the pointer with u64. It will fix the issue, but it breaks ABI
> >    which is never a good idea. Not sure how many users interface already
> >    has.
> 
> The only users I am aware of is an HID debugging tool and experimental
> HoG Bluetooth support (bluez). Maybe Marcel or Johan can comment
> whether this is already used by bluez-5? If it is, then we shouldn't
> break ABI and go with #2+#3. Otherwise, I think changing to u64 should
> be ok.
> On the other hand, it would break any future build for older stable
> kernels so not breaking ABI is probably the best idea. Any comments? I
> can add a COMPAT fix and a comment to fix this in the next version of
> UHID_CREATE.

The HoG code in BlueZ 5 does indeed use this API and it's also not
anymore behind any kind of experimental flag (i.e. it is an officially
supported feature).

Johan

WARNING: multiple messages have this Message-ID (diff)
From: Johan Hedberg <johan.hedberg@gmail.com>
To: David Herrmann <dh.herrmann@googlemail.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	linux-api@vger.kernel.org, linux-input@vger.kernel.org,
	Jiri Kosina <jkosina@suse.cz>,
	RavindranathX Doddi <ravindranathx.doddi@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Marcel Holtmann <marcel@holtmann.org>
Subject: Re: uhid: broken interface: 32/64-bit compatibility
Date: Fri, 15 Feb 2013 14:00:22 +0200	[thread overview]
Message-ID: <20130215120022.GA23694@x220> (raw)
In-Reply-To: <CANq1E4T1QzOUOwWPpV6_55hVTXzXF4baShxpYaM0HNAgF0ffAg@mail.gmail.com>

Hi David,

On Fri, Feb 15, 2013, David Herrmann wrote:
> On Fri, Feb 15, 2013 at 12:29 PM, Kirill A. Shutemov
> <kirill.shutemov@linux.intel.com> wrote:
> > Hi David and all,
> >
> > There's claim in uhid.h that the interface is "compatible even between
> > architectures". But it obviously is not true: struct uhid_create_req
> > contains pointer which breaks everything.
> >
> > The easy way to demonstrate the issue is compile uhid-example.c with -m32
> > and try to run it on 64 bit kernel. Creating of the device will fail.
> 
> Indeed, we missed that. We should probably also notify the HIDP
> developers as "struct hidp_connadd_req" suffers from the same
> problems. (CC'ed)
> 
> > I don't see an easy way to fix this. Few options:
> >
> > 1. Replace the pointer with u64. It will fix the issue, but it breaks ABI
> >    which is never a good idea. Not sure how many users interface already
> >    has.
> 
> The only users I am aware of is an HID debugging tool and experimental
> HoG Bluetooth support (bluez). Maybe Marcel or Johan can comment
> whether this is already used by bluez-5? If it is, then we shouldn't
> break ABI and go with #2+#3. Otherwise, I think changing to u64 should
> be ok.
> On the other hand, it would break any future build for older stable
> kernels so not breaking ABI is probably the best idea. Any comments? I
> can add a COMPAT fix and a comment to fix this in the next version of
> UHID_CREATE.

The HoG code in BlueZ 5 does indeed use this API and it's also not
anymore behind any kind of experimental flag (i.e. it is an officially
supported feature).

Johan

  parent reply	other threads:[~2013-02-15 12:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20130215112911.68A98E0085@blue.fi.intel.com>
2013-02-15 11:46 ` uhid: broken interface: 32/64-bit compatibility David Herrmann
     [not found]   ` <CANq1E4T1QzOUOwWPpV6_55hVTXzXF4baShxpYaM0HNAgF0ffAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-15 12:00     ` Johan Hedberg [this message]
2013-02-15 12:00       ` Johan Hedberg
2013-02-15 13:51       ` Kirill A. Shutemov
2013-02-15 13:51         ` Kirill A. Shutemov
2013-02-15 16:40         ` Andy Shevchenko
2013-02-15 20:05         ` Dmitry Torokhov
2013-02-18 10:18           ` Kirill A. Shutemov
2013-02-18 10:28           ` Jiri Kosina
     [not found]             ` <alpine.LNX.2.00.1302181121460.17024-ztGlSCb7Y1iN3ZZ/Hiejyg@public.gmane.org>
2013-02-18 18:40               ` Dmitry Torokhov
2013-02-18 18:40                 ` Dmitry Torokhov
2013-02-18 18:39     ` Dmitry Torokhov
2013-02-18 18:39       ` Dmitry Torokhov

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=20130215120022.GA23694@x220 \
    --to=johan.hedberg-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=dh.herrmann-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=jkosina-AlSwsSmVLrQ@public.gmane.org \
    --cc=kirill.shutemov-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=marcel-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org \
    --cc=ravindranathx.doddi-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.