2007-09-12 09:30:00

by Andre Haupt

[permalink] [raw]
Subject: hci_sock.c build failure

Hi,

I did a make randconfig and then make C=1.

hci_sock.c fails to build because it doesnt know compat_timeval (i
guess).

find the error message and the config attached.

regards,

Andre


Attachments:
(No filename) (190.00 B)
error.log (896.00 B)
.config (29.58 kB)
Download all attachments

2007-09-12 12:03:20

by Greg KH

[permalink] [raw]
Subject: Re: hci_sock.c build failure

On Wed, Sep 12, 2007 at 11:29:29AM +0200, Andre Haupt wrote:
> Hi,
>
> I did a make randconfig and then make C=1.
>
> hci_sock.c fails to build because it doesnt know compat_timeval (i
> guess).
>
> find the error message and the config attached.

It's not even a randconfig issue, my build dies too (this is Linus's
current tree.)

Time to poke through the 10 bluetooth patches that were just added...

thanks,

greg k-h

2007-09-12 12:07:48

by Greg KH

[permalink] [raw]
Subject: Re: hci_sock.c build failure

On Wed, Sep 12, 2007 at 05:02:53AM -0700, Greg KH wrote:
> On Wed, Sep 12, 2007 at 11:29:29AM +0200, Andre Haupt wrote:
> > Hi,
> >
> > I did a make randconfig and then make C=1.
> >
> > hci_sock.c fails to build because it doesnt know compat_timeval (i
> > guess).
> >
> > find the error message and the config attached.
>
> It's not even a randconfig issue, my build dies too (this is Linus's
> current tree.)
>
> Time to poke through the 10 bluetooth patches that were just added...

It was 767c5eb5d35aeb85987143f0a730bc21d3ecfb3d that caused it. It
needs a .h file added to the file, patch forthcoming...

greg k-h

2007-09-12 12:08:07

by Greg KH

[permalink] [raw]
Subject: Re: hci_sock.c build failure

On Wed, Sep 12, 2007 at 05:04:07AM -0700, Greg KH wrote:
> On Wed, Sep 12, 2007 at 05:02:53AM -0700, Greg KH wrote:
> > On Wed, Sep 12, 2007 at 11:29:29AM +0200, Andre Haupt wrote:
> > > Hi,
> > >
> > > I did a make randconfig and then make C=1.
> > >
> > > hci_sock.c fails to build because it doesnt know compat_timeval (i
> > > guess).
> > >
> > > find the error message and the config attached.
> >
> > It's not even a randconfig issue, my build dies too (this is Linus's
> > current tree.)
> >
> > Time to poke through the 10 bluetooth patches that were just added...
>
> It was 767c5eb5d35aeb85987143f0a730bc21d3ecfb3d that caused it. It
> needs a .h file added to the file, patch forthcoming...

No, this is worse, i386 doesn't have a compat_timeval structure defined,
nor does any other 32 bit platform.

Marcel, I think you need to use a different structure, care to fix this
up?

thanks,

greg k-h

2007-09-12 12:10:53

by S.Çağlar Onur

[permalink] [raw]
Subject: Re: hci_sock.c build failure

12 Eyl 2007 Çar tarihinde, Greg KH şunları yazmıştı:
> No, this is worse, i386 doesn't have a compat_timeval structure defined,
> nor does any other 32 bit platform.
>
> Marcel, I think you need to use a different structure, care to fix this
> up?

I sent a patch for this problem about ~4 hours ago :), see "[PATCH] Fix hci_sock build with CONFIG_COMPAT=n"

Cheers
--
S.Çağlar Onur <[email protected]>
http://cekirdek.pardus.org.tr/~caglar/

Linux is like living in a teepee. No Windows, no Gates and an Apache in house!

2007-09-12 12:12:37

by David Miller

[permalink] [raw]
Subject: Re: hci_sock.c build failure

From: Greg KH <[email protected]>
Date: Wed, 12 Sep 2007 05:02:53 -0700

> It's not even a randconfig issue, my build dies too (this is Linus's
> current tree.)
>
> Time to poke through the 10 bluetooth patches that were just added...

I'll push the following fix to Linus.

>From 1da97f83a843f92678b614fcaebdb3e4ebd6c9dd Mon Sep 17 00:00:00 2001
From: David S. Miller <davem@kimchee.(none)>
Date: Wed, 12 Sep 2007 14:10:58 +0200
Subject: [PATCH] [BLUETOOTH]: Fix non-COMPAT build of hci_sock.c

Signed-off-by: David S. Miller <[email protected]>
---
net/bluetooth/hci_sock.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index d16ca8e..5ccea5f 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -348,16 +348,17 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_

skb_get_timestamp(skb, &tv);

+ data = &tv;
+ len = sizeof(tv);
+#ifdef CONFIG_COMPAT
if (msg->msg_flags & MSG_CMSG_COMPAT) {
struct compat_timeval ctv;
ctv.tv_sec = tv.tv_sec;
ctv.tv_usec = tv.tv_usec;
data = &ctv;
len = sizeof(ctv);
- } else {
- data = &tv;
- len = sizeof(tv);
}
+#endif

put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, len, data);
}
--
1.5.2.4

2007-09-12 12:13:49

by David Miller

[permalink] [raw]
Subject: Re: hci_sock.c build failure

From: Greg KH <[email protected]>
Date: Wed, 12 Sep 2007 05:04:07 -0700

> It was 767c5eb5d35aeb85987143f0a730bc21d3ecfb3d that caused it. It
> needs a .h file added to the file, patch forthcoming...

Ok, I though it was a CONFIG_COMPAT ifdef issue, feel
free to push the header include fix.

2007-09-12 12:14:38

by David Miller

[permalink] [raw]
Subject: Re: hci_sock.c build failure

From: Greg KH <[email protected]>
Date: Wed, 12 Sep 2007 05:07:26 -0700

> No, this is worse, i386 doesn't have a compat_timeval structure defined,
> nor does any other 32 bit platform.
>
> Marcel, I think you need to use a different structure, care to fix this
> up?

Ok, then see the patch I posted which will do the trick.

I'll push it around.

2007-09-12 12:19:00

by Robert P. J. Day

[permalink] [raw]
Subject: Re: hci_sock.c build failure

On Wed, 12 Sep 2007, Greg KH wrote:

> On Wed, Sep 12, 2007 at 11:29:29AM +0200, Andre Haupt wrote:
> > Hi,
> >
> > I did a make randconfig and then make C=1.
> >
> > hci_sock.c fails to build because it doesnt know compat_timeval (i
> > guess).
> >
> > find the error message and the config attached.
>
> It's not even a randconfig issue, my build dies too (this is Linus's
> current tree.)
>
> Time to poke through the 10 bluetooth patches that were just added...
>
> thanks,
>
> greg k-h

that structure is undefined because that source file includes
<linux/compat.h>, which turns around and includes <asm/compat.h>
which, for i386, doesn't exist:

$ find include -name compat.h
include/asm-ia64/compat.h
include/config/video/v4l1/compat.h
include/config/sonypi/compat.h
include/asm-s390/compat.h
include/asm-mips/compat.h
include/linux/compat.h
include/asm-parisc/compat.h
include/asm-sparc64/compat.h
include/asm-x86_64/compat.h
include/asm-powerpc/compat.h
include/net/compat.h

rday

--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://crashcourse.ca
========================================================================

2007-09-12 14:19:24

by Coly Li

[permalink] [raw]
Subject: Re: hci_sock.c build failure

David Miller 写道:
> From: Greg KH <[email protected]>
> Date: Wed, 12 Sep 2007 05:02:53 -0700
>
>> It's not even a randconfig issue, my build dies too (this is Linus's
>> current tree.)
>>
>> Time to poke through the 10 bluetooth patches that were just added...
>
> I'll push the following fix to Linus.
>
> From 1da97f83a843f92678b614fcaebdb3e4ebd6c9dd Mon Sep 17 00:00:00 2001
> From: David S. Miller <davem@kimchee.(none)>
> Date: Wed, 12 Sep 2007 14:10:58 +0200
> Subject: [PATCH] [BLUETOOTH]: Fix non-COMPAT build of hci_sock.c
>
> Signed-off-by: David S. Miller <[email protected]>
> ---
> net/bluetooth/hci_sock.c | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
> index d16ca8e..5ccea5f 100644
> --- a/net/bluetooth/hci_sock.c
> +++ b/net/bluetooth/hci_sock.c
> @@ -348,16 +348,17 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_
>
> skb_get_timestamp(skb, &tv);
>
> + data = &tv;
> + len = sizeof(tv);
> +#ifdef CONFIG_COMPAT
> if (msg->msg_flags & MSG_CMSG_COMPAT) {
> struct compat_timeval ctv;
> ctv.tv_sec = tv.tv_sec;
> ctv.tv_usec = tv.tv_usec;
> data = &ctv;
> len = sizeof(ctv);
should we consider the condition that msg->msg_flags & MSG_CMSG_COMPAT comes to true when
CONFIG_COMPAT is not defined ?

> - } else {
> - data = &tv;
> - len = sizeof(tv);
> }
> +#endif
>
> put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, len, data);
> }

2007-09-12 14:25:53

by Coly Li

[permalink] [raw]
Subject: Re: hci_sock.c build failure

Coly Li 写道:
> David Miller 写道:
>> From: Greg KH <[email protected]>
>> Date: Wed, 12 Sep 2007 05:02:53 -0700
>>
>>> It's not even a randconfig issue, my build dies too (this is Linus's
>>> current tree.)
>>>
>>> Time to poke through the 10 bluetooth patches that were just added...
>> I'll push the following fix to Linus.
>>
>> From 1da97f83a843f92678b614fcaebdb3e4ebd6c9dd Mon Sep 17 00:00:00 2001
>> From: David S. Miller <davem@kimchee.(none)>
>> Date: Wed, 12 Sep 2007 14:10:58 +0200
>> Subject: [PATCH] [BLUETOOTH]: Fix non-COMPAT build of hci_sock.c
>>
>> Signed-off-by: David S. Miller <[email protected]>
>> ---
>> net/bluetooth/hci_sock.c | 7 ++++---
>> 1 files changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
>> index d16ca8e..5ccea5f 100644
>> --- a/net/bluetooth/hci_sock.c
>> +++ b/net/bluetooth/hci_sock.c
>> @@ -348,16 +348,17 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_
>>
>> skb_get_timestamp(skb, &tv);
>>
>> + data = &tv;
>> + len = sizeof(tv);
>> +#ifdef CONFIG_COMPAT
>> if (msg->msg_flags & MSG_CMSG_COMPAT) {
>> struct compat_timeval ctv;
>> ctv.tv_sec = tv.tv_sec;
>> ctv.tv_usec = tv.tv_usec;
>> data = &ctv;
>> len = sizeof(ctv);
> should we consider the condition that msg->msg_flags & MSG_CMSG_COMPAT comes to true when
> CONFIG_COMPAT is not defined ?
Sorry, once CONFIG_COMPAT is not defined, msg->msg_flags & MSG_CMSG_COMPAT will never come to true.
forget my comments.

>
>> - } else {
>> - data = &tv;
>> - len = sizeof(tv);
>> }
>> +#endif
>>
>> put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, len, data);
>> }
>

2007-09-12 16:21:41

by Marcel Holtmann

[permalink] [raw]
Subject: Re: hci_sock.c build failure

Hi Dave,

> > It's not even a randconfig issue, my build dies too (this is Linus's
> > current tree.)
> >
> > Time to poke through the 10 bluetooth patches that were just added...
>
> I'll push the following fix to Linus.

the patch looks absolutely fine to me. You can put an Acked-by line to
it. Sorry for breaking the build. I tested it on so many architectures,
but it seems I always had CONFIG_COMPAT enabled. Seems I am running out
of i386/32-bit only systems.

Regards

Marcel


2007-09-13 10:11:22

by Toralf Förster

[permalink] [raw]
Subject: Re: hci_sock.c build failure

Hello,

I'm wondering why the build failure wasn't fixed by a patch like this:


diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 5ccea5f..85416bb 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -348,8 +348,6 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_

skb_get_timestamp(skb, &tv);

- data = &tv;
- len = sizeof(tv);
#ifdef CONFIG_COMPAT
if (msg->msg_flags & MSG_CMSG_COMPAT) {
struct compat_timeval ctv;
@@ -358,6 +356,9 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_
data = &ctv;
len = sizeof(ctv);
}
+#else
+ data = &tv;
+ len = sizeof(tv);
#endif

put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, len, data);


--
MfG/Sincerely

Toralf F?rster
pgp finger print: 7B1A 07F4 EC82 0F90 D4C2 8936 872A E508 7DB6 9DA3


Attachments:
(No filename) (1.00 kB)
signature.asc (189.00 B)
This is a digitally signed message part.
Download all attachments

2007-09-13 12:30:34

by Marcel Holtmann

[permalink] [raw]
Subject: Re: hci_sock.c build failure

Hi Toralf,

> I'm wondering why the build failure wasn't fixed by a patch like this:
>
>
> diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
> index 5ccea5f..85416bb 100644
> --- a/net/bluetooth/hci_sock.c
> +++ b/net/bluetooth/hci_sock.c
> @@ -348,8 +348,6 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_
>
> skb_get_timestamp(skb, &tv);
>
> - data = &tv;
> - len = sizeof(tv);
> #ifdef CONFIG_COMPAT
> if (msg->msg_flags & MSG_CMSG_COMPAT) {
> struct compat_timeval ctv;
> @@ -358,6 +356,9 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_
> data = &ctv;
> len = sizeof(ctv);
> }
> +#else
> + data = &tv;
> + len = sizeof(tv);
> #endif
>
> put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, len, data);

because that is wrong and will give you a different issue (the other way
around actually) that the change to use compat_timeval actually tried to
fix. Your patch actually will allow to return arbitrary kernel memory in
case of 64-bit applications since data and len might not be initialized.

In case of 64-bit kernels you can have 64-bit or 32-bit applications. In
case of 32-bit application you have to return compat_timeval and in cas
of 64-bit application you have to return timeval. It is checked by
MSG_CMSG_COMPAT runtime flag and not the CONFIG_COMPAT compile option.

Regards

Marcel