* [tip:timers/vdso 12/15] include/vdso/unaligned.h:23:9: warning: '__builtin_memcpy' reading 4 bytes from a region of size 1
@ 2025-09-05 2:43 kernel test robot
2025-09-05 4:40 ` Ian Rogers
0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2025-09-05 2:43 UTC (permalink / raw)
To: Ian Rogers; +Cc: oe-kbuild-all, linux-kernel, x86, Thomas Gleixner
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/vdso
head: e994a4197086cd5df809277b3b96c88f75e1e860
commit: 34a1cbf21227f1327ead30dcf2a52aac79bf4f15 [12/15] vdso: Switch get/put_unaligned() from packed struct to memcpy()
config: parisc-allnoconfig (https://download.01.org/0day-ci/archive/20250905/202509051042.7KOze0fZ-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250905/202509051042.7KOze0fZ-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202509051042.7KOze0fZ-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from include/linux/swab.h:5,
from include/uapi/linux/byteorder/big_endian.h:14,
from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:67,
from include/linux/kernel.h:23,
from arch/parisc/include/asm/bug.h:5,
from include/linux/bug.h:5,
from include/linux/thread_info.h:13,
from include/linux/sched.h:14,
from include/linux/uaccess.h:9,
from arch/parisc/boot/compressed/misc.c:7:
In function 'get_unaligned_le32',
inlined from 'decompress_kernel' at arch/parisc/boot/compressed/misc.c:312:16:
>> include/vdso/unaligned.h:23:9: warning: '__builtin_memcpy' reading 4 bytes from a region of size 1 [-Wstringop-overread]
23 | __builtin_memcpy(&__get_unaligned_val, (void *)(ptr), \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24 | sizeof(__get_unaligned_val)); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/uapi/linux/swab.h:120:19: note: in definition of macro '__swab32'
120 | __fswab32(x))
| ^
include/linux/byteorder/generic.h:89:21: note: in expansion of macro '__le32_to_cpu'
89 | #define le32_to_cpu __le32_to_cpu
| ^~~~~~~~~~~~~
include/linux/unaligned.h:23:28: note: in expansion of macro '__get_unaligned_t'
23 | return le32_to_cpu(__get_unaligned_t(__le32, p));
| ^~~~~~~~~~~~~~~~~
arch/parisc/boot/compressed/misc.c: In function 'decompress_kernel':
arch/parisc/boot/compressed/misc.c:29:13: note: source object 'output_len' of size 1
29 | extern char output_len;
| ^~~~~~~~~~
vim +/__builtin_memcpy +23 include/vdso/unaligned.h
6
7 /**
8 * __get_unaligned_t - read an unaligned value from memory.
9 * @type: the type to load from the pointer.
10 * @ptr: the pointer to load from.
11 *
12 * Use memcpy to affect an unaligned type sized load avoiding undefined behavior
13 * from approaches like type punning that require -fno-strict-aliasing in order
14 * to be correct. As type may be const, use __unqual_scalar_typeof to map to a
15 * non-const type - you can't memcpy into a const type. The
16 * __get_unaligned_ctrl_type gives __unqual_scalar_typeof its required
17 * expression rather than type, a pointer is used to avoid warnings about mixing
18 * the use of 0 and NULL. The void* cast silences ubsan warnings.
19 */
20 #define __get_unaligned_t(type, ptr) ({ \
21 type *__get_unaligned_ctrl_type __always_unused = NULL; \
22 __unqual_scalar_typeof(*__get_unaligned_ctrl_type) __get_unaligned_val; \
> 23 __builtin_memcpy(&__get_unaligned_val, (void *)(ptr), \
24 sizeof(__get_unaligned_val)); \
25 __get_unaligned_val; \
26 })
27
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [tip:timers/vdso 12/15] include/vdso/unaligned.h:23:9: warning: '__builtin_memcpy' reading 4 bytes from a region of size 1
2025-09-05 2:43 [tip:timers/vdso 12/15] include/vdso/unaligned.h:23:9: warning: '__builtin_memcpy' reading 4 bytes from a region of size 1 kernel test robot
@ 2025-09-05 4:40 ` Ian Rogers
0 siblings, 0 replies; 2+ messages in thread
From: Ian Rogers @ 2025-09-05 4:40 UTC (permalink / raw)
To: kernel test robot, Helge Deller
Cc: oe-kbuild-all, linux-kernel, x86, Thomas Gleixner, linux-parisc
On Thu, Sep 4, 2025 at 7:44 PM kernel test robot <lkp@intel.com> wrote:
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/vdso
> head: e994a4197086cd5df809277b3b96c88f75e1e860
> commit: 34a1cbf21227f1327ead30dcf2a52aac79bf4f15 [12/15] vdso: Switch get/put_unaligned() from packed struct to memcpy()
> config: parisc-allnoconfig (https://download.01.org/0day-ci/archive/20250905/202509051042.7KOze0fZ-lkp@intel.com/config)
> compiler: hppa-linux-gcc (GCC) 15.1.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250905/202509051042.7KOze0fZ-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202509051042.7KOze0fZ-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> In file included from include/linux/swab.h:5,
> from include/uapi/linux/byteorder/big_endian.h:14,
> from include/linux/byteorder/big_endian.h:5,
> from arch/parisc/include/uapi/asm/byteorder.h:5,
> from arch/parisc/include/asm/bitops.h:11,
> from include/linux/bitops.h:67,
> from include/linux/kernel.h:23,
> from arch/parisc/include/asm/bug.h:5,
> from include/linux/bug.h:5,
> from include/linux/thread_info.h:13,
> from include/linux/sched.h:14,
> from include/linux/uaccess.h:9,
> from arch/parisc/boot/compressed/misc.c:7:
> In function 'get_unaligned_le32',
> inlined from 'decompress_kernel' at arch/parisc/boot/compressed/misc.c:312:16:
> >> include/vdso/unaligned.h:23:9: warning: '__builtin_memcpy' reading 4 bytes from a region of size 1 [-Wstringop-overread]
> 23 | __builtin_memcpy(&__get_unaligned_val, (void *)(ptr), \
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 24 | sizeof(__get_unaligned_val)); \
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/uapi/linux/swab.h:120:19: note: in definition of macro '__swab32'
> 120 | __fswab32(x))
> | ^
> include/linux/byteorder/generic.h:89:21: note: in expansion of macro '__le32_to_cpu'
> 89 | #define le32_to_cpu __le32_to_cpu
> | ^~~~~~~~~~~~~
> include/linux/unaligned.h:23:28: note: in expansion of macro '__get_unaligned_t'
> 23 | return le32_to_cpu(__get_unaligned_t(__le32, p));
> | ^~~~~~~~~~~~~~~~~
> arch/parisc/boot/compressed/misc.c: In function 'decompress_kernel':
> arch/parisc/boot/compressed/misc.c:29:13: note: source object 'output_len' of size 1
> 29 | extern char output_len;
> | ^~~~~~~~~~
>
>
> vim +/__builtin_memcpy +23 include/vdso/unaligned.h
>
> 6
> 7 /**
> 8 * __get_unaligned_t - read an unaligned value from memory.
> 9 * @type: the type to load from the pointer.
> 10 * @ptr: the pointer to load from.
> 11 *
> 12 * Use memcpy to affect an unaligned type sized load avoiding undefined behavior
> 13 * from approaches like type punning that require -fno-strict-aliasing in order
> 14 * to be correct. As type may be const, use __unqual_scalar_typeof to map to a
> 15 * non-const type - you can't memcpy into a const type. The
> 16 * __get_unaligned_ctrl_type gives __unqual_scalar_typeof its required
> 17 * expression rather than type, a pointer is used to avoid warnings about mixing
> 18 * the use of 0 and NULL. The void* cast silences ubsan warnings.
> 19 */
> 20 #define __get_unaligned_t(type, ptr) ({ \
> 21 type *__get_unaligned_ctrl_type __always_unused = NULL; \
> 22 __unqual_scalar_typeof(*__get_unaligned_ctrl_type) __get_unaligned_val; \
> > 23 __builtin_memcpy(&__get_unaligned_val, (void *)(ptr), \
> 24 sizeof(__get_unaligned_val)); \
> 25 __get_unaligned_val; \
> 26 })
> 27
Ugh. This is the same issue as discussed here:
https://lore.kernel.org/linux-parisc/CAP-5=fWXcGiWXeb8=165tCVtEAYX7qkVUpanbpmg=Db=kwEP0g@mail.gmail.com/
I was failing to find the e-mail thread and thought maybe the issue
had been resolved. Anyway, I also came across commit f6b5f1a56987
("compiler.h: Introduce absolute_pointer macro")
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/f6b5f1a56987de837f8e25cd560847106b8632a8?id=f6b5f1a56987de837f8e25cd560847106b8632a8
which solves a similar -Werror=stringop-overread. Could somebody on
the parisc side take a look?
Thanks,
Ian
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-09-05 4:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-05 2:43 [tip:timers/vdso 12/15] include/vdso/unaligned.h:23:9: warning: '__builtin_memcpy' reading 4 bytes from a region of size 1 kernel test robot
2025-09-05 4:40 ` Ian Rogers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®