[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [livepatch-build-tools part3 v2 2/3] create-diff-object: Extend patchability verification: STN_UNDEF



On 8/8/19 1:48 PM, Pawel Wieczorkiewicz wrote:
During verification check if all sections do not contain any entries
with undefined symbols (STN_UNDEF). This situation can happen when a
section is copied over from its original object to a patched object,
but various symbols related to the section are not copied along.
This scenario happens typically during stacked hotpatches creation
(between 2 different hotpatch modules).

Signed-off-by: Pawel Wieczorkiewicz <wipawel@xxxxxxxxx>
Reviewed-by: Martin Pohlack <mpohlack@xxxxxxxxx>
Reviewed-by: Bjoern Doebel <doebel@xxxxxxxxx>
Reviewed-by: Norbert Manthey <nmanthey@xxxxxxxxx>
Reviewed-by: Andra-Irina Paraschiv <andraprs@xxxxxxxxxx>
... snip
+static int kpatch_section_has_undef_symbols(struct kpatch_elf *kelf,
+                                           const struct section *sec)
+{
+       int offset, entry_size;
+       struct rela *rela;
+       size_t d_size;
+
+       entry_size = get_section_entry_size(sec, kelf);
+       if (entry_size == 0)
+               return false;
+
+       d_size = sec->base->data->d_size;
+       for ( offset = 0; offset < d_size; offset += entry_size ) {

The coding style doesn't use spaces inside the for loop parentheses.

+               list_for_each_entry(rela, &sec->relas, list) {
+                       if (rela->offset < offset ||
+                           rela->offset >= offset + entry_size) {
+                               continue;
+                       }
+
+                       if ((GELF_R_SYM(rela->rela.r_info) == STN_UNDEF) ||
+                           (!rela->sym->include && rela->sym->status == SAME)) 
{
+                               log_normal("section %s has an entry with a STN_UNDEF 
symbol: %s\n",
+                                          sec->name, rela->sym->name ?: 
"none");

Perhaps this log message is a bit misleading if only the second condition is true? Maybe something slightly more general like "has an entry with an undefined symbol".

Otherwise looks OK to me.

Thanks,
--
Ross Lagerwall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.