Skip to contentSkip to conversation

3.0.1 compile error on Fedora 15

DISCUSSION Ben Greear 2 participants 5 messages Aug 8, 2011 Library code

lore
Share & tools
lore

Ben Greear

author
#0 lore raw

[greearb@t60-ben linux-3.0.p4s]$ make
make -C /home/greearb/git/linux-3.0.dev.y O=/home/greearb/kernel/2.6/linux-3.0.p4s/.
Using /home/greearb/git/linux-3.0.dev.y as source for kernel

  GEN     /home/greearb/kernel/2.6/linux-3.0.p4s/Makefile
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CALL    /home/greearb/git/linux-3.0.dev.y/scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  CC      fs/binfmt_misc.o
In file included from /home/greearb/git/linux-3.0.dev.y/arch/x86/include/asm/uaccess.h:570:0,
                 from /home/greearb/git/linux-3.0.dev.y/include/linux/uaccess.h:5,
                 from /home/greearb/git/linux-3.0.dev.y/include/linux/highmem.h:7,
                 from /home/greearb/git/linux-3.0.dev.y/include/linux/pagemap.h:10,
                 from /home/greearb/git/linux-3.0.dev.y/fs/binfmt_misc.c:26:

/home/greearb/git/linux-3.0.dev.y/arch/x86/include/asm/uaccess_32.h: In function ‘parse_command.part.0’:
/home/greearb/git/linux-3.0.dev.y/arch/x86/include/asm/uaccess_32.h:211:26: error: call to ‘copy_from_user_overflow’ declared with attribute error: copy_from_user() buffer size is not provably correct make[3]: *** [fs/binfmt_misc.o] Error 1
make[2]: *** [fs] Error 2
make[1]: *** [sub-make] Error 2
make: *** [all] Error 2
[greearb@t60-ben linux-3.0.p4s]$

The code in question is below. Is this missing an assignment to n in the else branch?

static inline unsigned long __must_check copy_from_user(void *to,
const void __user *from, unsigned long n)

{
        int sz = __compiletime_object_size(to);

        if (likely(sz == -1 || sz >= n))
                n = _copy_from_user(to, from, n);
        else
                copy_from_user_overflow();

        return n;
}
Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#1 lore raw
Quoted 30 lines · On Mon, 08 Aug 2011 11:43:43 -0700 Ben Greear wrote:

[greearb@t60-ben linux-3.0.p4s]$ make
make -C /home/greearb/git/linux-3.0.dev.y O=/home/greearb/kernel/2.6/linux-3.0.p4s/.
Using /home/greearb/git/linux-3.0.dev.y as source for kernel

   GEN     /home/greearb/kernel/2.6/linux-3.0.p4s/Makefile
   CHK     include/linux/version.h
   CHK     include/generated/utsrelease.h
   CALL    /home/greearb/git/linux-3.0.dev.y/scripts/checksyscalls.sh
   CHK     include/generated/compile.h
   CC      fs/binfmt_misc.o
In file included from /home/greearb/git/linux-3.0.dev.y/arch/x86/include/asm/uaccess.h:570:0,
                  from /home/greearb/git/linux-3.0.dev.y/include/linux/uaccess.h:5,
                  from /home/greearb/git/linux-3.0.dev.y/include/linux/highmem.h:7,
                  from /home/greearb/git/linux-3.0.dev.y/include/linux/pagemap.h:10,
                  from /home/greearb/git/linux-3.0.dev.y/fs/binfmt_misc.c:26:

/home/greearb/git/linux-3.0.dev.y/arch/x86/include/asm/uaccess_32.h: In function ‘parse_command.part.0’:
/home/greearb/git/linux-3.0.dev.y/arch/x86/include/asm/uaccess_32.h:211:26: error: call to ‘copy_from_user_overflow’ declared with attribute error:
copy_from_user() buffer size is not provably correct
make[3]: *** [fs/binfmt_misc.o] Error 1
make[2]: *** [fs] Error 2
make[1]: *** [sub-make] Error 2
make: *** [all] Error 2
[greearb@t60-ben linux-3.0.p4s]$

The code in question is below. Is this missing an assignment to n in the else branch?

static inline unsigned long __must_check copy_from_user(void *to,
const void __user *from, unsigned long n)

Quoted 10 lines
{
         int sz = __compiletime_object_size(to);

         if (likely(sz == -1 || sz >= n))
                 n = _copy_from_user(to, from, n);
         else
                 copy_from_user_overflow();

         return n;
}

Do you have this kconfig option enabled?
CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y

If so, you should get the error that you reported.
If not, then you need a patch like the one below (which has been posted by other people several times -- might need to be added to -stable):

---
 lib/Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/Makefile +1 -1
@@ -14,7 +14,7 @@ lib-y := ctype.o string.o vsprintf.o cmd
 	 proportions.o prio_heap.o ratelimit.o show_mem.o \
 	 is_single_threaded.o plist.o decompress.o find_next_bit.o
 
-lib-$(CONFIG_ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS) += usercopy.o
+obj-$(CONFIG_ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS) += usercopy.o
 lib-$(CONFIG_MMU) += ioremap.o
 lib-$(CONFIG_SMP) += cpumask.o
 
author
#2 lore raw
Quoted 44 lines · Randy Dunlap
Quoted 30 lines · On Mon, 08 Aug 2011 11:43:43 -0700 Ben Greear wrote:

[greearb@t60-ben linux-3.0.p4s]$ make
make -C /home/greearb/git/linux-3.0.dev.y O=/home/greearb/kernel/2.6/linux-3.0.p4s/.
Using /home/greearb/git/linux-3.0.dev.y as source for kernel
GEN /home/greearb/kernel/2.6/linux-3.0.p4s/Makefile
CHK include/linux/version.h
CHK include/generated/utsrelease.h
CALL /home/greearb/git/linux-3.0.dev.y/scripts/checksyscalls.sh
CHK include/generated/compile.h
CC fs/binfmt_misc.o
In file included from /home/greearb/git/linux-3.0.dev.y/arch/x86/include/asm/uaccess.h:570:0,

                   from /home/greearb/git/linux-3.0.dev.y/include/linux/uaccess.h:5,
                   from /home/greearb/git/linux-3.0.dev.y/include/linux/highmem.h:7,
                   from /home/greearb/git/linux-3.0.dev.y/include/linux/pagemap.h:10,
                   from /home/greearb/git/linux-3.0.dev.y/fs/binfmt_misc.c:26:

/home/greearb/git/linux-3.0.dev.y/arch/x86/include/asm/uaccess_32.h: In function ‘parse_command.part.0’:
/home/greearb/git/linux-3.0.dev.y/arch/x86/include/asm/uaccess_32.h:211:26: error: call to ‘copy_from_user_overflow’ declared with attribute error:
copy_from_user() buffer size is not provably correct
make[3]: *** [fs/binfmt_misc.o] Error 1
make[2]: *** [fs] Error 2
make[1]: *** [sub-make] Error 2
make: *** [all] Error 2
[greearb@t60-ben linux-3.0.p4s]$

The code in question is below. Is this missing an assignment to n in the else branch?

static inline unsigned long __must_check copy_from_user(void *to,
const void __user *from, unsigned long n)

Quoted 10 lines
{
          int sz = __compiletime_object_size(to);

          if (likely(sz == -1 || sz>= n))
                  n = _copy_from_user(to, from, n);
          else
                  copy_from_user_overflow();

          return n;
}
Quoted 6 lines

Do you have this kconfig option enabled?
CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y

If so, you should get the error that you reported.
If not, then you need a patch like the one below (which has been posted by other people several times -- might need to be added to -stable):

I do have that enabled. I'm slightly confused by your response above:

Do I need to disable the check AND apply the patch below, or just disable the check, or just apply the patch and leave the check enabled?

Thanks,
Ben

Quoted 17 lines

---
  lib/Makefile |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
lib/Makefile +1 -1
@@ -14,7 +14,7 @@ lib-y := ctype.o string.o vsprintf.o cmd
  	 proportions.o prio_heap.o ratelimit.o show_mem.o \
  	 is_single_threaded.o plist.o decompress.o find_next_bit.o
 
-lib-$(CONFIG_ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS) += usercopy.o
+obj-$(CONFIG_ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS) += usercopy.o
  lib-$(CONFIG_MMU) += ioremap.o
  lib-$(CONFIG_SMP) += cpumask.o
 
Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#3 lore raw
Quoted 48 lines · On Mon, 08 Aug 2011 11:55:29 -0700 Ben Greear wrote:
Quoted 47 lines · Randy Dunlap
Quoted 30 lines · On Mon, 08 Aug 2011 11:43:43 -0700 Ben Greear wrote:

[greearb@t60-ben linux-3.0.p4s]$ make
make -C /home/greearb/git/linux-3.0.dev.y O=/home/greearb/kernel/2.6/linux-3.0.p4s/.
Using /home/greearb/git/linux-3.0.dev.y as source for kernel
GEN /home/greearb/kernel/2.6/linux-3.0.p4s/Makefile
CHK include/linux/version.h
CHK include/generated/utsrelease.h
CALL /home/greearb/git/linux-3.0.dev.y/scripts/checksyscalls.sh
CHK include/generated/compile.h
CC fs/binfmt_misc.o
In file included from /home/greearb/git/linux-3.0.dev.y/arch/x86/include/asm/uaccess.h:570:0,

                   from /home/greearb/git/linux-3.0.dev.y/include/linux/uaccess.h:5,
                   from /home/greearb/git/linux-3.0.dev.y/include/linux/highmem.h:7,
                   from /home/greearb/git/linux-3.0.dev.y/include/linux/pagemap.h:10,
                   from /home/greearb/git/linux-3.0.dev.y/fs/binfmt_misc.c:26:

/home/greearb/git/linux-3.0.dev.y/arch/x86/include/asm/uaccess_32.h: In function ‘parse_command.part.0’:
/home/greearb/git/linux-3.0.dev.y/arch/x86/include/asm/uaccess_32.h:211:26: error: call to ‘copy_from_user_overflow’ declared with attribute error:
copy_from_user() buffer size is not provably correct
make[3]: *** [fs/binfmt_misc.o] Error 1
make[2]: *** [fs] Error 2
make[1]: *** [sub-make] Error 2
make: *** [all] Error 2
[greearb@t60-ben linux-3.0.p4s]$

The code in question is below. Is this missing an assignment to n in the else branch?

static inline unsigned long __must_check copy_from_user(void *to,
const void __user *from, unsigned long n)

Quoted 10 lines
{
          int sz = __compiletime_object_size(to);

          if (likely(sz == -1 || sz>= n))
                  n = _copy_from_user(to, from, n);
          else
                  copy_from_user_overflow();

          return n;
}

Do you have this kconfig option enabled?
CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y

Quoted 8 lines
Quoted 3 lines

If so, you should get the error that you reported.
If not, then you need a patch like the one below (which has been posted by other people several times -- might need to be added to -stable):

I do have that enabled. I'm slightly confused by your response above:

Do I need to disable the check AND apply the patch below, or just disable the check, or just apply the patch and leave the check enabled?

Hm, I guess I'm confused also. The patch only applies to linux-next, not to 3.0.x.

The patch below is needed (in linux-next) to fix a build error when CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is not enabled.

When you do have CONFIG_DEBUG_STRICT_USER_COPY_CHECKS, the build error is the correct result. AFAIK. So it looks to me like you should either disable the kconfig option or fix the code in fs/binfmt_misc.c. I would do the former -- depending on your use case.

Quoted 15 lines

Thanks,
Ben

Quoted 12 lines

---
  lib/Makefile |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
lib/Makefile +0 -0
@@ -14,7 +14,7 @@ lib-y := ctype.o string.o vsprintf.o cmd
  	 proportions.o prio_heap.o ratelimit.o show_mem.o \
  	 is_single_threaded.o plist.o decompress.o find_next_bit.o
 
Quoted 8 lines
Quoted 5 lines
lib/Makefile +1 -1
-lib-$(CONFIG_ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS) += usercopy.o
+obj-$(CONFIG_ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS) += usercopy.o
  lib-$(CONFIG_MMU) += ioremap.o
  lib-$(CONFIG_SMP) += cpumask.o
 

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

author
#4 lore raw
Quoted 62 lines · Randy Dunlap
Quoted 48 lines · On Mon, 08 Aug 2011 11:55:29 -0700 Ben Greear wrote:
Quoted 47 lines · Randy Dunlap
Quoted 30 lines · On Mon, 08 Aug 2011 11:43:43 -0700 Ben Greear wrote:

[greearb@t60-ben linux-3.0.p4s]$ make
make -C /home/greearb/git/linux-3.0.dev.y O=/home/greearb/kernel/2.6/linux-3.0.p4s/.
Using /home/greearb/git/linux-3.0.dev.y as source for kernel
GEN /home/greearb/kernel/2.6/linux-3.0.p4s/Makefile
CHK include/linux/version.h
CHK include/generated/utsrelease.h
CALL /home/greearb/git/linux-3.0.dev.y/scripts/checksyscalls.sh
CHK include/generated/compile.h
CC fs/binfmt_misc.o
In file included from /home/greearb/git/linux-3.0.dev.y/arch/x86/include/asm/uaccess.h:570:0,

                    from /home/greearb/git/linux-3.0.dev.y/include/linux/uaccess.h:5,
                    from /home/greearb/git/linux-3.0.dev.y/include/linux/highmem.h:7,
                    from /home/greearb/git/linux-3.0.dev.y/include/linux/pagemap.h:10,
                    from /home/greearb/git/linux-3.0.dev.y/fs/binfmt_misc.c:26:

/home/greearb/git/linux-3.0.dev.y/arch/x86/include/asm/uaccess_32.h: In function ‘parse_command.part.0’:
/home/greearb/git/linux-3.0.dev.y/arch/x86/include/asm/uaccess_32.h:211:26: error: call to ‘copy_from_user_overflow’ declared with attribute error:
copy_from_user() buffer size is not provably correct
make[3]: *** [fs/binfmt_misc.o] Error 1
make[2]: *** [fs] Error 2
make[1]: *** [sub-make] Error 2
make: *** [all] Error 2
[greearb@t60-ben linux-3.0.p4s]$

The code in question is below. Is this missing an assignment to n in the else branch?

static inline unsigned long __must_check copy_from_user(void *to,
const void __user *from, unsigned long n)

Quoted 10 lines
{
           int sz = __compiletime_object_size(to);

           if (likely(sz == -1 || sz>= n))
                   n = _copy_from_user(to, from, n);
           else
                   copy_from_user_overflow();

           return n;
}

Do you have this kconfig option enabled?
CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y

Quoted 8 lines
Quoted 3 lines

If so, you should get the error that you reported.
If not, then you need a patch like the one below (which has been posted by other people several times -- might need to be added to -stable):

I do have that enabled. I'm slightly confused by your response above:

Do I need to disable the check AND apply the patch below, or just disable the check, or just apply the patch and leave the check enabled?

Hm, I guess I'm confused also. The patch only applies to linux-next, not to 3.0.x.

Quoted 7 lines

The patch below is needed (in linux-next) to fix a build error when CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is not enabled.

When you do have CONFIG_DEBUG_STRICT_USER_COPY_CHECKS, the build error is the correct result. AFAIK. So it looks to me like you should either disable the kconfig option or fix the code in fs/binfmt_misc.c. I would do the former -- depending on your use case.

I can disable the check, but I hope someone fixes the real problem and sends the patch to stable. Seems a bit lame that we have compile errors in stable series...

Thanks,
Ben

Quoted 35 lines
Quoted 17 lines

Thanks,
Ben

Quoted 12 lines

---
   lib/Makefile |    2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
lib/Makefile +0 -0
@@ -14,7 +14,7 @@ lib-y := ctype.o string.o vsprintf.o cmd
   	 proportions.o prio_heap.o ratelimit.o show_mem.o \
   	 is_single_threaded.o plist.o decompress.o find_next_bit.o
 
Quoted 8 lines

lib/Makefile lib-y := ctype.o string.o vsprintf.o cmd · line 20

Quoted 5 lines
lib/Makefile +1 -1
-lib-$(CONFIG_ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS) += usercopy.o
+obj-$(CONFIG_ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS) += usercopy.o
   lib-$(CONFIG_MMU) += ioremap.o
   lib-$(CONFIG_SMP) += cpumask.o
 

--

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code *** --
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com