Bug 216389 - net/bluetooth/l2cap_core.c fails bounds check with GCC 12.2
Summary: net/bluetooth/l2cap_core.c fails bounds check with GCC 12.2
Status: RESOLVED ANSWERED
Alias: None
Product: Drivers
Classification: Unclassified
Component: Bluetooth (show other bugs)
Hardware: PPC-64 Linux
: P1 normal
Assignee: linux-bluetooth@vger.kernel.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-21 11:50 UTC by Erhard F.
Modified: 2022-08-24 12:36 UTC (History)
2 users (show)

See Also:
Kernel Version: 5.19.2
Subsystem:
Regression: No
Bisected commit-id:


Attachments
kernel .config (5.19.2, Talos II Secure Workstation) (112.10 KB, text/plain)
2022-08-21 11:50 UTC, Erhard F.
Details

Description Erhard F. 2022-08-21 11:50:14 UTC
Created attachment 301616 [details]
kernel .config (5.19.2, Talos II Secure Workstation)

I get this on my Talos II when building v5.19.2. Does not happen with GCC 11.3.

 # make
  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  CHK     include/generated/compile.h
  CC [M]  net/bluetooth/l2cap_core.o
In file included from ./include/linux/string.h:253,
                 from ./include/linux/bitmap.h:11,
                 from ./include/linux/cpumask.h:12,
                 from ./include/linux/mm_types_task.h:14,
                 from ./include/linux/mm_types.h:5,
                 from ./include/linux/buildid.h:5,
                 from ./include/linux/module.h:14,
                 from net/bluetooth/l2cap_core.c:31:
In function 'memcmp',
    inlined from 'bacmp' at ./include/net/bluetooth/bluetooth.h:302:9,
    inlined from 'l2cap_global_chan_by_psm' at net/bluetooth/l2cap_core.c:2002:15:
./include/linux/fortify-string.h:44:33: error: '__builtin_memcmp' specified bound 6 exceeds source size 0 [-Werror=stringop-overread]
   44 | #define __underlying_memcmp     __builtin_memcmp
      |                                 ^
./include/linux/fortify-string.h:420:16: note: in expansion of macro '__underlying_memcmp'
  420 |         return __underlying_memcmp(p, q, size);
      |                ^~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [scripts/Makefile.build:249: net/bluetooth/l2cap_core.o] Fehler 1
make[1]: *** [scripts/Makefile.build:466: net/bluetooth] Fehler 2
make: *** [Makefile:1849: net] Fehler 2
Comment 1 Artem S. Tashkinov 2022-08-22 02:01:34 UTC
This will be fixed eventually, might have already been fixed in 6.0-rc2.

Removing -Werror will fix it as well.
Comment 2 Erhard F. 2022-08-23 10:45:26 UTC
6.0-rc2 still affected. But of course removing -Werror 'fixes' it.
Comment 4 Erhard F. 2022-08-24 12:36:25 UTC
(In reply to Luiz Von Dentz from comment #3)
> The following patch should fix it:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git/
> commit/?id=1d71d9223e4143d3638f60c7bb291844c237556c
Correct. Thanks!

I'll close here as 'fixed' when the patch makes it into -rc.

Note You need to log in before you can comment on or make changes to this bug.