Skip to contentSkip to conversation

New: Kernel won't compile with KASAN

Bug 216905 Andrew Morton 3 participants 3 messages Jan 10, 2023 1 message not in the archive Memory management

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]/

Andrew Morton

author maintainer
#1 lore raw

(switched to email. Please respond via emailed reply-to-all, not via the bugzilla web interface).

Quoted 22 lines · On Mon, 09 Jan 2023 23:42:40 +0000 [email protected] wrote:

https://bugzilla.kernel.org/show_bug.cgi?id=216905

            Bug ID: 216905
           Summary: Kernel won't compile with KASAN
           Product: Memory Management
           Version: 2.5
    Kernel Version: 6.1.4
          Hardware: All
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Other
          Assignee: [email protected]
          Reporter: [email protected]
        Regression: No

Created attachment 303563
--> https://bugzilla.kernel.org/attachment.cgi?id=303563&action=edit
These are errors when trying to compile KASAN inline

Quoted 5 lines

Using GCC 12.2, can not compile a kernel with KASAN enabled, either inline or outline.
The hardware is an i7-6700k based home brew machine, Asus motherboard. running Ubuntu 22.10 32GB of RAM but using gcc 12.2 rather than the Ubuntu compiler.

crypto/ecc.c: In function ‘ecc_point_mult_shamir’:
crypto/ecc.c:1414:1: warning: the frame size of 1168 bytes is larger than 1024 bytes [-Wframe-larger-than=]
1414 | }

      | ^
lib/crypto/curve25519-hacl64.c: In function ‘ladder_cmult.constprop’:
lib/crypto/curve25519-hacl64.c:601:1: warning: the frame size of 1376 bytes is larger than 1024 bytes [-Wframe-larger-than=]
  601 | }
      | ^
lib/zstd/common/entropy_common.c: In function ‘HUF_readStats’:
lib/zstd/common/entropy_common.c:258:1: warning: the frame size of 1088 bytes is larger than 1024 bytes [-Wframe-larger-than=]
  258 | }
      | ^

(etcetera)

Increasing CONFIG_FRAME_WARN should fix this. Try 2048.

Perhaps KASAN could increase it somehow to prevent others from tripping over this.

#2 lore raw

     Increasing to 2048 did allow kernels to compile with KASAN enabled.  I am curious why e-mail only?  It would seem bugzilla, a public forum would make this fix available to others who may be experiencing the same or related problems.  Interestingly, I could not locate the symbol with xconfig, had to hand edit the .config file in deference to the fact that it tells you not to.

Quoted 51 lines · Andrew Morton

(switched to email. Please respond via emailed reply-to-all, not via the bugzilla web interface).

Quoted 22 lines · On Mon, 09 Jan 2023 23:42:40 +0000 [email protected] wrote:

https://bugzilla.kernel.org/show_bug.cgi?id=216905

             Bug ID: 216905
            Summary: Kernel won't compile with KASAN
            Product: Memory Management
            Version: 2.5
     Kernel Version: 6.1.4
           Hardware: All
                 OS: Linux
               Tree: Mainline
             Status: NEW
           Severity: normal
           Priority: P1
          Component: Other
           Assignee: [email protected]
           Reporter: [email protected]
         Regression: No

Created attachment 303563
--> https://bugzilla.kernel.org/attachment.cgi?id=303563&action=edit
These are errors when trying to compile KASAN inline

Quoted 5 lines

Using GCC 12.2, can not compile a kernel with KASAN enabled, either inline or outline.
The hardware is an i7-6700k based home brew machine, Asus motherboard. running Ubuntu 22.10 32GB of RAM but using gcc 12.2 rather than the Ubuntu compiler.

crypto/ecc.c: In function ‘ecc_point_mult_shamir’:
crypto/ecc.c:1414:1: warning: the frame size of 1168 bytes is larger than 1024 bytes [-Wframe-larger-than=]
1414 | }

       | ^
lib/crypto/curve25519-hacl64.c: In function ‘ladder_cmult.constprop’:
lib/crypto/curve25519-hacl64.c:601:1: warning: the frame size of 1376 bytes is larger than 1024 bytes [-Wframe-larger-than=]
   601 | }
       | ^
lib/zstd/common/entropy_common.c: In function ‘HUF_readStats’:
lib/zstd/common/entropy_common.c:258:1: warning: the frame size of 1088 bytes is larger than 1024 bytes [-Wframe-larger-than=]
   258 | }
       | ^

(etcetera)

Increasing CONFIG_FRAME_WARN should fix this. Try 2048.

Perhaps KASAN could increase it somehow to prevent others from tripping over this.

#3 lore raw
Quoted 5 lines · Robert Dinse

Increasing to 2048 did allow kernels to compile with KASAN enabled. I
am curious why e-mail only? It would seem bugzilla, a public forum would make this fix available to others who may be experiencing the same or related problems.

Not all kernel developers pay attention to bugzilla. (In fact, most kernel developers do not.)

Quoted 3 lines

  Interestingly, I could not locate the symbol with
xconfig, had to hand edit the .config file in deference to the fact that it tells you not to.

If you search for FRAME_WARN in menuconfig ('/', followed by "FRAME_WARN", followed by return), it will report:

Symbol: FRAME_WARN [=2048]
Type : integer
Range : [0 8192]
Defined at lib/Kconfig.debug:395
Prompt: Warn for stack frames larger than
Locationf

     -> Kernel hacking
       -> Compile-time checks and compiler options

(1) -> Warn for stack frames larger than (FRAME_WARN [=2048])

That being said, you can edit the .config file if you know what you are doing. But if it breaks, you get to keep both pieces, since there aren't the safety checks and guardrails of the supported paths. For novices, I recommend saving a copy of .config before editing the .config, and then afterwards, run "make oldconfig", and then diff the resulting .config with the saved copy to make sure there aren't any unexpected changes.

Cheers,

- Ted