2017-06-01 12:12:27

by Waldemar Brodkorb

[permalink] [raw]
Subject: Re: sparc gcc 7.1 compile issue

Hi David,

thank you very much.

best regards
Waldemar


2017-06-01 12:46:08

by Anatoly Pugachev

[permalink] [raw]
Subject: Re: sparc gcc 7.1 compile issue

on the same topic , latest git does not compile for me with gcc-7.0.1
gcc version 7.0.1 20170407 (experimental) [trunk revision 246759]
(Debian 7-20170407-1)

$ make
...
CC arch/sparc/kernel/ds.o
arch/sparc/kernel/ds.c: In function ‘register_services’:
arch/sparc/kernel/ds.c:912:3: error: ‘strcpy’: writing at least 1 byte
into a region of size 0 overflows the destination
[-Werror=stringop-overflow ]
strcpy(pbuf.req.svc_id, cp->service_id);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
scripts/Makefile.build:302: recipe for target 'arch/sparc/kernel/ds.o' failed
make[2]: *** [arch/sparc/kernel/ds.o] Error 1
scripts/Makefile.build:561: recipe for target 'arch/sparc/kernel' failed
make[1]: *** [arch/sparc/kernel] Error 2
Makefile:1016: recipe for target 'arch/sparc' failed
make: *** [arch/sparc] Error 2

I'm able to pass arch/sparc/kernel/ compilation, if I change/add to
arch/sparc/kernel/Makefile :

-ccflags-y := -Werror
+ccflags-y := -Werror -Wno-error=stringop-overflow

but even with that hack, i'm unable to compile kernel, getting in the
end of make:
...
LD init/built-in.o
LD vmlinux.o
MODPOST vmlinux.o
ipc/built-in.o: In function `mq_attr_ok.isra.0':
mqueue.c:(.text+0xc490): undefined reference to `__multi3'
drivers/built-in.o: In function `dm_vcalloc':
(.text+0xc9e98): undefined reference to `__multi3'
Makefile:997: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1

Subject: Re: sparc gcc 7.1 compile issue

On Thu, Jun 01, 2017 at 03:46:04PM +0300, Anatoly Pugachev wrote:
> on the same topic , latest git does not compile for me with gcc-7.0.1
> gcc version 7.0.1 20170407 (experimental) [trunk revision 246759]
> (Debian 7-20170407-1)

Let's first try this again once the 7.1.0-6 gcc-7 package has built
successfully in Debian experimental. It's been uploaded for a while
now but we have the usual issues with the gcc testsuite crashing the
kernel.

Adrian

--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer - [email protected]
`. `' Freie Universitaet Berlin - [email protected]
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913

2017-06-01 16:46:22

by David Miller

[permalink] [raw]
Subject: Re: sparc gcc 7.1 compile issue

From: Anatoly Pugachev <[email protected]>
Date: Thu, 1 Jun 2017 15:46:04 +0300

> on the same topic , latest git does not compile for me with gcc-7.0.1
> gcc version 7.0.1 20170407 (experimental) [trunk revision 246759]
> (Debian 7-20170407-1)
>
> $ make
> ...
> CC arch/sparc/kernel/ds.o
> arch/sparc/kernel/ds.c: In function ?register_services?:
> arch/sparc/kernel/ds.c:912:3: error: ?strcpy?: writing at least 1 byte
> into a region of size 0 overflows the destination
> [-Werror=stringop-overflow ]
> strcpy(pbuf.req.svc_id, cp->service_id);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

That's easy enough to fix, I've pushed the patch below to 'sparc' GIT.

> MODPOST vmlinux.o
> ipc/built-in.o: In function `mq_attr_ok.isra.0':
> mqueue.c:(.text+0xc490): undefined reference to `__multi3'
> drivers/built-in.o: In function `dm_vcalloc':
> (.text+0xc9e98): undefined reference to `__multi3'
> Makefile:997: recipe for target 'vmlinux' failed
> make: *** [vmlinux] Error 1

This, on the other hand.... wonder why it wants to do a 128-bit multiply
when the MQ attribute struct is just 64-bit values...

====================
>From 0fde7ad71ee371ede73b3f326e58f9e8d102feb6 Mon Sep 17 00:00:00 2001
From: "David S. Miller" <[email protected]>
Date: Thu, 1 Jun 2017 09:42:46 -0700
Subject: [PATCH] sparc64: Fix build warnings with gcc 7.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

arch/sparc/kernel/ds.c: In function ?register_services?:
arch/sparc/kernel/ds.c:912:3: error: ?strcpy?: writing at least 1 byte
into a region of size 0 overflows the destination

Reported-by: Anatoly Pugachev <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
---
arch/sparc/kernel/ds.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c
index b542cc7..f87265a 100644
--- a/arch/sparc/kernel/ds.c
+++ b/arch/sparc/kernel/ds.c
@@ -909,7 +909,7 @@ static int register_services(struct ds_info *dp)
pbuf.req.handle = cp->handle;
pbuf.req.major = 1;
pbuf.req.minor = 0;
- strcpy(pbuf.req.svc_id, cp->service_id);
+ strcpy(pbuf.id_buf, cp->service_id);

err = __ds_send(lp, &pbuf, msg_len);
if (err > 0)
--
2.1.2.532.g19b5d50