From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753077AbbKMHQA (ORCPT ); Fri, 13 Nov 2015 02:16:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36207 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750779AbbKMHP6 (ORCPT ); Fri, 13 Nov 2015 02:15:58 -0500 Date: Fri, 13 Nov 2015 02:15:54 -0500 From: Jessica Yu To: Josh Poimboeuf Cc: Miroslav Benes , Rusty Russell , Seth Jennings , Jiri Kosina , Vojtech Pavlik , linux-api@vger.kernel.org, live-patching@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: livepatch: reuse module loader code to write relocations Message-ID: <20151113071553.GE13513@packer-debian-8-amd64.digitalocean.com> References: <1447130755-17383-1-git-send-email-jeyu@redhat.com> <1447130755-17383-4-git-send-email-jeyu@redhat.com> <20151111200732.GB30025@packer-debian-8-amd64.digitalocean.com> <20151112174032.GG4038@treble.hsd1.ky.comcast.net> <20151112202243.GC5841@packer-debian-8-amd64.digitalocean.com> <20151112203221.GM4038@treble.hsd1.ky.comcast.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20151112203221.GM4038@treble.hsd1.ky.comcast.net> X-OS: Linux eisen.io 3.16.0-4-amd64 x86_64 User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +++ Josh Poimboeuf [12/11/15 14:32 -0600]: >On Thu, Nov 12, 2015 at 03:22:44PM -0500, Jessica Yu wrote: >> Looking into this more, I think we do need one __klp_rela section per >> function being patched. Each rela section is linked to the section to >> which the relocations apply via the rela section's sh_info field. In >> SHT_RELA sections, the sh_info field contains the section index to >> which the relocs apply. We cannot have one single combined rela >> section per object as the call to apply_relocate_add() simply won't >> work, because we would have relocs that apply to different functions >> (and hence different sections). >> >> So I guess instead of a single field in klp_object specifying the >> __klp_rela section index, we could probably just have an array of >> section indices. > >Ok, makes sense, sounds like we need multiple klp relas per object. > >I still don't quite understand the benefit of caching the klp_rela >section indices. What problem does it solve? It seems simpler to just >iterate over all the sections in klp_write_object_relocations(). I was trying to accomodate Miroslav's dislike of klp_reloc_sec :-) But now that we are sure that we need multiple __klp_rela sections per object, I think an array of indices might still be somewhat complicated (we need to figure out its size and everything, a list here would be easier). I think it might be fine to leave things the way they are here. Jessica From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jessica Yu Subject: Re: livepatch: reuse module loader code to write relocations Date: Fri, 13 Nov 2015 02:15:54 -0500 Message-ID: <20151113071553.GE13513@packer-debian-8-amd64.digitalocean.com> References: <1447130755-17383-1-git-send-email-jeyu@redhat.com> <1447130755-17383-4-git-send-email-jeyu@redhat.com> <20151111200732.GB30025@packer-debian-8-amd64.digitalocean.com> <20151112174032.GG4038@treble.hsd1.ky.comcast.net> <20151112202243.GC5841@packer-debian-8-amd64.digitalocean.com> <20151112203221.GM4038@treble.hsd1.ky.comcast.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Return-path: Content-Disposition: inline In-Reply-To: <20151112203221.GM4038-M1RQNqTfbHcHO9+bouH2LOBSVt8DKT+lrE5yTffgRl4@public.gmane.org> Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Josh Poimboeuf Cc: Miroslav Benes , Rusty Russell , Seth Jennings , Jiri Kosina , Vojtech Pavlik , linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, live-patching-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-api@vger.kernel.org +++ Josh Poimboeuf [12/11/15 14:32 -0600]: >On Thu, Nov 12, 2015 at 03:22:44PM -0500, Jessica Yu wrote: >> Looking into this more, I think we do need one __klp_rela section per >> function being patched. Each rela section is linked to the section to >> which the relocations apply via the rela section's sh_info field. In >> SHT_RELA sections, the sh_info field contains the section index to >> which the relocs apply. We cannot have one single combined rela >> section per object as the call to apply_relocate_add() simply won't >> work, because we would have relocs that apply to different functions >> (and hence different sections). >> >> So I guess instead of a single field in klp_object specifying the >> __klp_rela section index, we could probably just have an array of >> section indices. > >Ok, makes sense, sounds like we need multiple klp relas per object. > >I still don't quite understand the benefit of caching the klp_rela >section indices. What problem does it solve? It seems simpler to just >iterate over all the sections in klp_write_object_relocations(). I was trying to accomodate Miroslav's dislike of klp_reloc_sec :-) But now that we are sure that we need multiple __klp_rela sections per object, I think an array of indices might still be somewhat complicated (we need to figure out its size and everything, a list here would be easier). I think it might be fine to leave things the way they are here. Jessica