Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162169AbbKTRZb (ORCPT ); Fri, 20 Nov 2015 12:25:31 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:39697 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163248AbbKTRZ1 (ORCPT ); Fri, 20 Nov 2015 12:25:27 -0500 From: Chris J Arges To: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, jpoimboe@redhat.com, jikos@kernel.org, pmladek@suse.com, mbenes@suse.cz Cc: jeyu@redhat.com, Chris J Arges Subject: [PATCH 0/3 v8] livepatch: disambiguate symbols with the same name Date: Fri, 20 Nov 2015 11:25:10 -0600 Message-Id: <1448040325-32498-1-git-send-email-chris.j.arges@canonical.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1447693391-10065-1-git-send-email-chris.j.arges@canonical.com> References: <1447693391-10065-1-git-send-email-chris.j.arges@canonical.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2842 Lines: 63 Currently, patching objects with duplicate symbol names fail because the creation of the sysfs function directory collides with the previous attempt. Appending old_addr to the function name is problematic as it reveals the address of the function being patch to a normal user. Using the symbol's occurrence in kallsyms to postfix the function name in the sysfs directory solves the issue of having consistent unique names and ensuring that the address is not exposed to a normal user. In addition, using the symbol position as the user's method to disambiguate symbols instead of addr allows for disambiguating symbols in modules as well for both function addresses and for relocs. This also simplifies much of the code. Special handling for kASLR is no longer needed and can be removed. The klp_find_verify_func_addr function can be replaced by klp_find_object_symbol, and klp_verify_vmlinux_symbol and its callback can be removed completely. The following set of patches use symbol positioning instead of old addresses to disambiguate symbols that have the same name in a given object. This is necessary in order to be able to patch symbols with the same name within the same object. This requires modifications to the klp_func and klp_reloc structures to add an additional element. In addition the scheme used for the func directory in sysfs is modified to append the symbols occurrence in kallsyms. v8: - explain motivation and necessity in initial patch - don't support sympos for external relocations v7: - make count/pos checking in klp_find_callback more readable - fix klp_write_object_relocations sympos/external checking v6: - move sympos arg before addr in klp_find_object_symbol - make comments more accurate, remove unnecessary whitespace - improve cover letter v5: - remove val from klp_reloc struct - klp_write_object_relocations doesn't use sympos with external relocs - add Petr Mladek's patch to simplify relocated external symbol code - add optimization in klp_find_callback in unique case - remove klp_find_verify_func_addr - amend/remove commit messages/comments to be more precise Chris J Arges (3): livepatch: add old_sympos as disambiguator field to klp_func livepatch: add sympos as disambiguator field to klp_reloc livepatch: function,sympos scheme in livepatch sysfs directory Documentation/ABI/testing/sysfs-kernel-livepatch | 6 +- include/linux/livepatch.h | 24 ++-- kernel/livepatch/core.c | 157 ++++++++--------------- 3 files changed, 73 insertions(+), 114 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/