Bug ID: 77964
           Summary: [7 Regression] Linux kernel firmware loader
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot
          Reporter: trippels at gcc dot
  Target Milestone: ---

Created attachment 39803
unreduced testcase

A Linux kernel build with gcc trunk crashes early during boot.
It happens during loading of builtin firmware.

RIP points to strcmp() in fw_get_builtin_firmware() on a bogus address.

markus@x4 linux % scripts/faddr2line ./vmlinux _request_firmware+0xa8
fw_get_builtin_firmware at drivers/base/firmware_class.c:55
 (inlined by) _request_firmware_prepare at drivers/base/firmware_class.c:1066
 (inlined by) _request_firmware at drivers/base/firmware_class.c:1149

  49 static bool fw_get_builtin_firmware(struct firmware *fw, const char *name, 
  50                                     void *buf, size_t size)                
  51 {                                                                          
  52         struct builtin_fw *b_fw;                                           
  54         for (b_fw = __start_builtin_fw; b_fw != __end_builtin_fw; b_fw++)
  55                 if (strcmp(name, b_fw->name) == 0) {                       
  56                         fw->size = b_fw->size;                             
  57                         fw->data = b_fw->data;                             
  59                         if (buf && fw->size <= size)                       
  60                                 memcpy(buf, fw->data, fw->size);           
  61                         return true;                                       
  62                 }                                                          
  63         }                                                                  
  65         return false;                                                      
  66 }

I have attached the firmware_class.i file.
The kernel crashes for -O1 -O2 and -Os. Strangely -O3 is fine.

Haven't looked deeper yet, but maybe someone sees what is going on?

Reply via email to