File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -265,8 +265,24 @@ def module_build_id(mod: Object) -> str:
265265 """
266266 prog = mod .prog_
267267 notes_attrs = mod .notes_attrs
268- for i in range (notes_attrs .notes .value_ ()):
269- attr = notes_attrs .attrs [i ]
268+
269+ if hasattr (notes_attrs , "grp" ):
270+ # In 6.14, 4723f16de64e1 ("module: sysfs: Add notes attributes through
271+ # attribute_group") changes the storage to use an attribute, and the
272+ # array here is null-terminated.
273+ def attrs ():
274+ attr = notes_attrs .grp .bin_attrs [0 ]
275+ while attr :
276+ yield attr
277+ attr += 1
278+
279+ else :
280+ # Pre-6.14, there was an array with an explicit length.
281+ def attrs ():
282+ for i in range (notes_attrs .notes .value_ ()):
283+ yield notes_attrs .attrs [i ]
284+
285+ for attr in attrs ():
270286 if attr .attr .name .string_ () == b".note.gnu.build-id" :
271287 data = prog .read (attr .private , attr .size .value_ ())
272288 # Hack / simplification: note data comes at the end of the ELF note
You can’t perform that action at this time.
0 commit comments