Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'kbuild-fixes-v6.13-3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild fixes from Masahiro Yamada:

- Fix escaping of '$' in scripts/mksysmap

- Fix a modpost crash observed with the latest binutils

- Fix 'provides' in the linux-api-headers pacman package

* tag 'kbuild-fixes-v6.13-3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
kbuild: pacman-pkg: provide versioned linux-api-headers package
modpost: work around unaligned data access error
modpost: refactor do_vmbus_entry()
modpost: fix the missed iteration for the max bit in do_input()
scripts/mksysmap: Fix escape chars '$'

+46 -34
+2 -2
scripts/mksysmap
··· 26 26 # (do not forget a space before each pattern) 27 27 28 28 # local symbols for ARM, MIPS, etc. 29 - / \\$/d 29 + / \$/d 30 30 31 31 # local labels, .LBB, .Ltmpxxx, .L__unnamed_xx, .LASANPC, etc. 32 32 / \.L/d ··· 39 39 / __pi_\.L/d 40 40 41 41 # arm64 local symbols in non-VHE KVM namespace 42 - / __kvm_nvhe_\\$/d 42 + / __kvm_nvhe_\$/d 43 43 / __kvm_nvhe_\.L/d 44 44 45 45 # lld arm/aarch64/mips thunks
+17 -19
scripts/mod/file2alias.c
··· 132 132 * based at address m. 133 133 */ 134 134 #define DEF_FIELD(m, devid, f) \ 135 - typeof(((struct devid *)0)->f) f = TO_NATIVE(*(typeof(f) *)((m) + OFF_##devid##_##f)) 135 + typeof(((struct devid *)0)->f) f = \ 136 + get_unaligned_native((typeof(f) *)((m) + OFF_##devid##_##f)) 136 137 137 138 /* Define a variable f that holds the address of field f of struct devid 138 139 * based at address m. Due to the way typeof works, for a field of type ··· 601 600 static void do_pcmcia_entry(struct module *mod, void *symval) 602 601 { 603 602 char alias[256] = {}; 604 - unsigned int i; 603 + 605 604 DEF_FIELD(symval, pcmcia_device_id, match_flags); 606 605 DEF_FIELD(symval, pcmcia_device_id, manf_id); 607 606 DEF_FIELD(symval, pcmcia_device_id, card_id); ··· 609 608 DEF_FIELD(symval, pcmcia_device_id, function); 610 609 DEF_FIELD(symval, pcmcia_device_id, device_no); 611 610 DEF_FIELD_ADDR(symval, pcmcia_device_id, prod_id_hash); 612 - 613 - for (i=0; i<4; i++) { 614 - (*prod_id_hash)[i] = TO_NATIVE((*prod_id_hash)[i]); 615 - } 616 611 617 612 ADD(alias, "m", match_flags & PCMCIA_DEV_ID_MATCH_MANF_ID, 618 613 manf_id); ··· 620 623 function); 621 624 ADD(alias, "pfn", match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO, 622 625 device_no); 623 - ADD(alias, "pa", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID1, (*prod_id_hash)[0]); 624 - ADD(alias, "pb", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID2, (*prod_id_hash)[1]); 625 - ADD(alias, "pc", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID3, (*prod_id_hash)[2]); 626 - ADD(alias, "pd", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID4, (*prod_id_hash)[3]); 626 + ADD(alias, "pa", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID1, 627 + get_unaligned_native(*prod_id_hash + 0)); 628 + ADD(alias, "pb", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID2, 629 + get_unaligned_native(*prod_id_hash + 1)); 630 + ADD(alias, "pc", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID3, 631 + get_unaligned_native(*prod_id_hash + 2)); 632 + ADD(alias, "pd", match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID4, 633 + get_unaligned_native(*prod_id_hash + 3)); 627 634 628 635 module_alias_printf(mod, true, "pcmcia:%s", alias); 629 636 } ··· 655 654 { 656 655 unsigned int i; 657 656 658 - for (i = min / BITS_PER_LONG; i < max / BITS_PER_LONG + 1; i++) 659 - arr[i] = TO_NATIVE(arr[i]); 660 - for (i = min; i < max; i++) 661 - if (arr[i / BITS_PER_LONG] & (1ULL << (i%BITS_PER_LONG))) 657 + for (i = min; i <= max; i++) 658 + if (get_unaligned_native(arr + i / BITS_PER_LONG) & 659 + (1ULL << (i % BITS_PER_LONG))) 662 660 sprintf(alias + strlen(alias), "%X,*", i); 663 661 } 664 662 ··· 812 812 * Each byte of the guid will be represented by two hex characters 813 813 * in the name. 814 814 */ 815 - 816 815 static void do_vmbus_entry(struct module *mod, void *symval) 817 816 { 818 - int i; 819 817 DEF_FIELD_ADDR(symval, hv_vmbus_device_id, guid); 820 - char guid_name[(sizeof(*guid) + 1) * 2]; 818 + char guid_name[sizeof(*guid) * 2 + 1]; 821 819 822 - for (i = 0; i < (sizeof(*guid) * 2); i += 2) 823 - sprintf(&guid_name[i], "%02x", TO_NATIVE((guid->b)[i/2])); 820 + for (int i = 0; i < sizeof(*guid); i++) 821 + sprintf(&guid_name[i * 2], "%02x", guid->b[i]); 824 822 825 823 module_alias_printf(mod, false, "vmbus:%s", guid_name); 826 824 }
+12 -12
scripts/mod/modpost.c
··· 1138 1138 { 1139 1139 switch (r_type) { 1140 1140 case R_386_32: 1141 - return TO_NATIVE(*location); 1141 + return get_unaligned_native(location); 1142 1142 case R_386_PC32: 1143 - return TO_NATIVE(*location) + 4; 1143 + return get_unaligned_native(location) + 4; 1144 1144 } 1145 1145 1146 1146 return (Elf_Addr)(-1); ··· 1161 1161 switch (r_type) { 1162 1162 case R_ARM_ABS32: 1163 1163 case R_ARM_REL32: 1164 - inst = TO_NATIVE(*(uint32_t *)loc); 1164 + inst = get_unaligned_native((uint32_t *)loc); 1165 1165 return inst + sym->st_value; 1166 1166 case R_ARM_MOVW_ABS_NC: 1167 1167 case R_ARM_MOVT_ABS: 1168 - inst = TO_NATIVE(*(uint32_t *)loc); 1168 + inst = get_unaligned_native((uint32_t *)loc); 1169 1169 offset = sign_extend32(((inst & 0xf0000) >> 4) | (inst & 0xfff), 1170 1170 15); 1171 1171 return offset + sym->st_value; 1172 1172 case R_ARM_PC24: 1173 1173 case R_ARM_CALL: 1174 1174 case R_ARM_JUMP24: 1175 - inst = TO_NATIVE(*(uint32_t *)loc); 1175 + inst = get_unaligned_native((uint32_t *)loc); 1176 1176 offset = sign_extend32((inst & 0x00ffffff) << 2, 25); 1177 1177 return offset + sym->st_value + 8; 1178 1178 case R_ARM_THM_MOVW_ABS_NC: 1179 1179 case R_ARM_THM_MOVT_ABS: 1180 - upper = TO_NATIVE(*(uint16_t *)loc); 1181 - lower = TO_NATIVE(*((uint16_t *)loc + 1)); 1180 + upper = get_unaligned_native((uint16_t *)loc); 1181 + lower = get_unaligned_native((uint16_t *)loc + 1); 1182 1182 offset = sign_extend32(((upper & 0x000f) << 12) | 1183 1183 ((upper & 0x0400) << 1) | 1184 1184 ((lower & 0x7000) >> 4) | ··· 1195 1195 * imm11 = lower[10:0] 1196 1196 * imm32 = SignExtend(S:J2:J1:imm6:imm11:'0') 1197 1197 */ 1198 - upper = TO_NATIVE(*(uint16_t *)loc); 1199 - lower = TO_NATIVE(*((uint16_t *)loc + 1)); 1198 + upper = get_unaligned_native((uint16_t *)loc); 1199 + lower = get_unaligned_native((uint16_t *)loc + 1); 1200 1200 1201 1201 sign = (upper >> 10) & 1; 1202 1202 j1 = (lower >> 13) & 1; ··· 1219 1219 * I2 = NOT(J2 XOR S) 1220 1220 * imm32 = SignExtend(S:I1:I2:imm10:imm11:'0') 1221 1221 */ 1222 - upper = TO_NATIVE(*(uint16_t *)loc); 1223 - lower = TO_NATIVE(*((uint16_t *)loc + 1)); 1222 + upper = get_unaligned_native((uint16_t *)loc); 1223 + lower = get_unaligned_native((uint16_t *)loc + 1); 1224 1224 1225 1225 sign = (upper >> 10) & 1; 1226 1226 j1 = (lower >> 13) & 1; ··· 1241 1241 { 1242 1242 uint32_t inst; 1243 1243 1244 - inst = TO_NATIVE(*location); 1244 + inst = get_unaligned_native(location); 1245 1245 switch (r_type) { 1246 1246 case R_MIPS_LO16: 1247 1247 return inst & 0xffff;
+14
scripts/mod/modpost.h
··· 65 65 #define TO_NATIVE(x) \ 66 66 (target_is_big_endian == host_is_big_endian ? x : bswap(x)) 67 67 68 + #define __get_unaligned_t(type, ptr) ({ \ 69 + const struct { type x; } __attribute__((__packed__)) *__pptr = \ 70 + (typeof(__pptr))(ptr); \ 71 + __pptr->x; \ 72 + }) 73 + 74 + #define get_unaligned(ptr) __get_unaligned_t(typeof(*(ptr)), (ptr)) 75 + 76 + #define get_unaligned_native(ptr) \ 77 + ({ \ 78 + typeof(*(ptr)) _val = get_unaligned(ptr); \ 79 + TO_NATIVE(_val); \ 80 + }) 81 + 68 82 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) 69 83 70 84 #define strstarts(str, prefix) (strncmp(str, prefix, strlen(prefix)) == 0)
+1 -1
scripts/package/PKGBUILD
··· 103 103 104 104 _package-api-headers() { 105 105 pkgdesc="Kernel headers sanitized for use in userspace" 106 - provides=(linux-api-headers) 106 + provides=(linux-api-headers="${pkgver}") 107 107 conflicts=(linux-api-headers) 108 108 109 109 _prologue