* ptrace compile failure with gcc-8.2 on 32-bit powerpc
@ 2018-08-16 7:44 Meelis Roos
2018-08-16 12:06 ` Michael Ellerman
0 siblings, 1 reply; 2+ messages in thread
From: Meelis Roos @ 2018-08-16 7:44 UTC (permalink / raw)
To: linux-powerpc, Linux Kernel list
After upgrading my distro compiler to gcc-8.2, Linux fails to compile on
32-bit powerpc (tested with 4.17, 4.18 and v4.18-7873-gf91e654474d4).
CC arch/powerpc/kernel/ptrace.o
In file included from ./include/linux/bitmap.h:9,
from ./include/linux/cpumask.h:12,
from ./include/linux/rcupdate.h:44,
from ./include/linux/rculist.h:11,
from ./include/linux/pid.h:5,
from ./include/linux/sched.h:14,
from arch/powerpc/kernel/ptrace.c:19:
In function ‘memcpy’,
inlined from ‘user_regset_copyin’ at ./include/linux/regset.h:295:4,
inlined from ‘vr_set’ at arch/powerpc/kernel/ptrace.c:619:9:
./include/linux/string.h:345:9: error: ‘__builtin_memcpy’ offset [-527, -529] is out of the bounds [0, 16] of object ‘vrsave’ with type ‘union <anonymous>’ [-Werror=array-bounds]
return __builtin_memcpy(p, q, size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/kernel/ptrace.c: In function ‘vr_set’:
arch/powerpc/kernel/ptrace.c:614:5: note: ‘vrsave’ declared here
} vrsave;
^~~~~~
In file included from ./include/linux/bitmap.h:9,
from ./include/linux/cpumask.h:12,
from ./include/linux/rcupdate.h:44,
from ./include/linux/rculist.h:11,
from ./include/linux/pid.h:5,
from ./include/linux/sched.h:14,
from arch/powerpc/kernel/ptrace.c:19:
In function ‘memcpy’,
inlined from ‘user_regset_copyout’ at ./include/linux/regset.h:270:4,
inlined from ‘vr_get’ at arch/powerpc/kernel/ptrace.c:572:9:
./include/linux/string.h:345:9: error: ‘__builtin_memcpy’ offset [-527, -529] is out of the bounds [0, 16] of object ‘vrsave’ with type ‘union <anonymous>’ [-Werror=array-bounds]
return __builtin_memcpy(p, q, size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/kernel/ptrace.c: In function ‘vr_get’:
arch/powerpc/kernel/ptrace.c:567:5: note: ‘vrsave’ declared here
} vrsave;
^~~~~~
cc1: all warnings being treated as errors
make[1]: *** [scripts/Makefile.build:311: arch/powerpc/kernel/ptrace.o] Error 1
--
Meelis Roos (mroos@linux.ee)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: ptrace compile failure with gcc-8.2 on 32-bit powerpc
2018-08-16 7:44 ptrace compile failure with gcc-8.2 on 32-bit powerpc Meelis Roos
@ 2018-08-16 12:06 ` Michael Ellerman
0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2018-08-16 12:06 UTC (permalink / raw)
To: Meelis Roos, linux-powerpc, Linux Kernel list
Meelis Roos <mroos@linux.ee> writes:
> After upgrading my distro compiler to gcc-8.2, Linux fails to compile on
> 32-bit powerpc (tested with 4.17, 4.18 and v4.18-7873-gf91e654474d4).
Yeah I noticed this just yesterday.
> CC arch/powerpc/kernel/ptrace.o
> In file included from ./include/linux/bitmap.h:9,
> from ./include/linux/cpumask.h:12,
> from ./include/linux/rcupdate.h:44,
> from ./include/linux/rculist.h:11,
> from ./include/linux/pid.h:5,
> from ./include/linux/sched.h:14,
> from arch/powerpc/kernel/ptrace.c:19:
> In function ‘memcpy’,
> inlined from ‘user_regset_copyin’ at ./include/linux/regset.h:295:4,
> inlined from ‘vr_set’ at arch/powerpc/kernel/ptrace.c:619:9:
> ./include/linux/string.h:345:9: error: ‘__builtin_memcpy’ offset [-527, -529] is out of the bounds [0, 16] of object ‘vrsave’ with type ‘union <anonymous>’ [-Werror=array-bounds]
> return __builtin_memcpy(p, q, size);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> arch/powerpc/kernel/ptrace.c: In function ‘vr_set’:
> arch/powerpc/kernel/ptrace.c:614:5: note: ‘vrsave’ declared here
> } vrsave;
> ^~~~~~
I couldn't actually work out how GCC has decided this is definitely
happening, possibly it just thinks it _could_ happen. I think it's
wrong, but admittedly the code is not easy to follow.
The patch below should fix the build error, but I haven't had time to
test it actually works at runtime:
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 9667666eb18e..607273067d3f 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -570,7 +570,8 @@ static int vr_get(struct task_struct *target, const struct user_regset *regset,
vrsave.word = target->thread.vrsave;
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &vrsave,
- 33 * sizeof(vector128), -1);
+ 33 * sizeof(vector128),
+ 34 * sizeof(vector128));
}
return ret;
@@ -617,7 +618,8 @@ static int vr_set(struct task_struct *target, const struct user_regset *regset,
vrsave.word = target->thread.vrsave;
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &vrsave,
- 33 * sizeof(vector128), -1);
+ 33 * sizeof(vector128),
+ 34 * sizeof(vector128));
if (!ret)
target->thread.vrsave = vrsave.word;
}
cheers
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-08-16 12:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-16 7:44 ptrace compile failure with gcc-8.2 on 32-bit powerpc Meelis Roos
2018-08-16 12:06 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).