Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752049AbbKZDEr (ORCPT ); Wed, 25 Nov 2015 22:04:47 -0500 Received: from ozlabs.org ([103.22.144.67]:57678 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751680AbbKZDEo (ORCPT ); Wed, 25 Nov 2015 22:04:44 -0500 From: Rusty Russell To: Miroslav Benes Cc: linux-kernel@vger.kernel.org, Miroslav Benes Subject: Re: [PATCH v2] module: keep percpu symbols in module's symtab In-Reply-To: <1448458422-10973-1-git-send-email-mbenes@suse.cz> References: <1448458422-10973-1-git-send-email-mbenes@suse.cz> User-Agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Thu, 26 Nov 2015 13:19:07 +1030 Message-ID: <87bnahv5jw.fsf@rustcorp.com.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1471 Lines: 32 Miroslav Benes writes: > Currently, percpu symbols from .data..percpu ELF section of a module are > not copied over and stored in final symtab array of struct module. > Consequently such symbol cannot be returned via kallsyms API (for > example kallsyms_lookup_name). This can be especially confusing when the > percpu symbol is exported. Only its __ksymtab et al. are present in its > symtab. > > The culprit is in layout_and_allocate() function where SHF_ALLOC flag is > dropped for .data..percpu section. There is in fact no need to copy the > section to final struct module, because kernel module loader allocates > extra percpu section by itself. Unfortunately only symbols from > SHF_ALLOC sections are copied due to a check in is_core_symbol(). > > The patch changes is_core_symbol() function to copy over also percpu > symbols (their st_shndx points to .data..percpu ELF section). We do it > only if CONFIG_KALLSYMS_ALL is set to be consistent with the rest of the > function (ELF section is SHF_ALLOC but !SHF_EXECINSTR). Finally > elf_type() returns type 'a' for a percpu symbol because its address is > absolute. > > Signed-off-by: Miroslav Benes Thanks, applied! Cheers, Rusty. -- 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/