On Thu, Mar 17, 2022 at 02:00:19PM +0000, Andrew Cooper wrote: > On 17/03/2022 11:08, Roger Pau Monne wrote: > > A side effect of ignoring such sections is that symbols belonging to > > them won't be resolved, and that could make relocations belonging to > > other sections that reference those symbols fail. > > > > For example it's likely to have an empty .altinstr_replacement with > > symbols pointing to it, and marking the section as ignored will > > prevent the symbols from being resolved, which in turn will cause any > > relocations against them to fail. > > I agree this is a bug in livepatch handling, but it's also an error in > the generated livepatch. We should not have relocations to an empty > altinstr_replacement section in the first place.
Well, the relocation destination is in the .altinstructions section (which is not empty). It happens however to reference a symbol that points to the .altinstr_replacement section that's empty. We could likely avoid generating the altinstr_replacement section in the first place, but I think it's more robust to handle those properly in the elf loading code. > This will probably be from the lfences, where the replacement in a nop > and takes no space. I think I know how to fix this case. Indeed, that's my understanding. Thanks, Roger.