Bug 103242

Summary: [12 Regression] Many new fortify-string.h:187:25: error: call to '__read_overflow2' kernel build errors since: r12-2591-g2e96b5f14e402569
Product: gcc Reporter: Martin Liška <marxin>
Component: tree-optimizationAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: normal CC: aldyh, amacleod
Priority: P3    
Version: 12.0   
Target Milestone: 12.0   
See Also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101941
Host: Target:
Build: Known to work: 11.2.0
Known to fail: 12.0 Last reconfirmed: 2021-11-15 00:00:00
Attachments: Original unreduced test-case

Description Martin Liška 2021-11-15 09:23:23 UTC
Created attachment 51793 [details]
Original unreduced test-case

One can see it during kernel build. I tried isolating one test-case:

$ cat aesni-intel_glue.i
struct crypto_aes_ctx {
  int key_dec[16];
};

int rfc4106_set_hash_subkey_hash_subkey;

void __write_overflow();
void aes_encrypt();

void fortify_panic() __attribute__((__noreturn__)) __attribute__((__error__("")));

char *rfc4106_set_hash_subkey() {
  struct crypto_aes_ctx ctx;
  unsigned p_size =
      __builtin_object_size(rfc4106_set_hash_subkey_hash_subkey, 0);
  if (p_size < 16)
    __write_overflow();
  if (p_size < 16)
    fortify_panic(__func__);
  aes_encrypt(ctx);
  return (char *)rfc4106_set_hash_subkey;
}

$ gcc aesni-intel_glue.i -O2 -c -fconserve-stack -w
aesni-intel_glue.i: In function ‘rfc4106_set_hash_subkey.part.0’:
aesni-intel_glue.i:19:5: error: call to ‘fortify_panic’ declared with attribute error: 
   19 |     fortify_panic(__func__);
      |     ^~~~~~~~~~~~~~~~~~~~~~~

I'm also attaching the original unreduced test-case.
Comment 1 Drea Pinski 2021-11-15 09:33:48 UTC
I think this is basically a dup of bug 101941.
Comment 2 Drea Pinski 2021-11-15 09:37:42 UTC
Yes this is the same issue as PR 101941.

*** This bug has been marked as a duplicate of bug 101941 ***