Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp747370ybb; Fri, 3 Apr 2020 11:04:14 -0700 (PDT) X-Google-Smtp-Source: APiQypJhuhYcQiufHB2zvtvUBPmuodPnx2E9AX0c9aKhu4aT8NuRpmUzHHkUTsoY9uo9hDFUlvON X-Received: by 2002:a4a:874f:: with SMTP id a15mr7697799ooi.8.1585937054468; Fri, 03 Apr 2020 11:04:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585937054; cv=none; d=google.com; s=arc-20160816; b=lmMIj/i7468hhXV/vof1MrY295+ELFqhD+0DoeAnt4d045vPL8J9p6QV2nH1BKzZAv BK7U1E/KqL8zF/Crw/xzfQd7J3JSvcGfTSqZ6pPoxFlRdAwu/T9SNyYl/+tODDi/ua4K CLBxB/BqNRoVnea/wJW9jLQgZ4L2oVZ+Jdug19/ArB2g06gx6OnBArVQeO3vtFvn99F2 rYnOHjfo8CQGjHgQtsAqGDlrhqpKR5y+LkdVFT0gqbLa327/xV20dOLtXDlv+e7IDUa7 /Y48VV9jUwWwrwoBxonHkl1o+gpcn/QwyeCLoBLuvH5jiIyaPAa/86/ny5dy5HZy2Axy DUcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=CgXbM5tM4nWTswrQ/RgYu+O+1APq3VPj1+jTCpISTXI=; b=TB61f7Y74ht6svkcaxgEM1p1Ev/Qag7aOhOTSsaUvWix0QPd1/JpZW9DrLCJj3u4kq X58i0LwdqwKJg7GNqGBH3Z8Tqy7HIKeQqhO+p3sMI0zJ9s9MvmuOQQyrzXLnaxSA9Wa4 vTM+GPqXSSAMM/sDX36m8XE8M2MErNhVudch7RcqsiXcChTujGCvwQ/YSuYdOrK9ejgx 8oMR0NxFdsOkudWNcoyJSRHyCDRMY6qXd2F7nKL9WN12gfukHvaZUJDGslwQUKX5c3Lg iGkklnAqfPTj1RzzEIZTi+xpyDxLUzhscNZ8MWBgTxe6LyPhm3/uh+XnOgWDOUHIUOyD 5saw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XWypiIdB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c20si4051415otf.37.2020.04.03.11.04.01; Fri, 03 Apr 2020 11:04:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XWypiIdB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728513AbgDCSDi (ORCPT + 99 others); Fri, 3 Apr 2020 14:03:38 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:48648 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728219AbgDCSDi (ORCPT ); Fri, 3 Apr 2020 14:03:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585937016; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CgXbM5tM4nWTswrQ/RgYu+O+1APq3VPj1+jTCpISTXI=; b=XWypiIdBePENrnQSCoyRvvT7nBdjpwFCt8FKNbSsipN0Kt+SREpvOzX/F9qiao3FdtWkvZ 6NRESfLZRW17gIxFNopDtONPQd/mGaPPtcIjLFXxo0cwLcJqoFoqJxc0ZjIXfF/IllnFlS xyNapmD8KTEqpvVw825r+cHBqjZr2tQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-145-V9u6mrzrMACNC1HS3NOGKQ-1; Fri, 03 Apr 2020 14:03:33 -0400 X-MC-Unique: V9u6mrzrMACNC1HS3NOGKQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 42DA88017F6; Fri, 3 Apr 2020 18:03:31 +0000 (UTC) Received: from redhat.com (ovpn-114-27.phx2.redhat.com [10.3.114.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 58F7510002CD; Fri, 3 Apr 2020 18:03:30 +0000 (UTC) Date: Fri, 3 Apr 2020 14:03:28 -0400 From: Joe Lawrence To: Petr Mladek Cc: Jiri Kosina , Josh Poimboeuf , Miroslav Benes , Kamalesh Babulal , Nicolai Stange , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [POC 22/23] livepatch/module: Remove obsolete copy_module_elf() Message-ID: <20200403180328.GC30284@redhat.com> References: <20200117150323.21801-1-pmladek@suse.com> <20200117150323.21801-23-pmladek@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200117150323.21801-23-pmladek@suse.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 17, 2020 at 04:03:22PM +0100, Petr Mladek wrote: > The split livepatch modules can be relocated immedidately when they > are loaded. There is no longer needed to preserve the elf sections. > > Signed-off-by: Petr Mladek > --- > Documentation/livepatch/module-elf-format.rst | 18 ++++++ > include/linux/module.h | 3 - > kernel/module.c | 87 --------------------------- > 3 files changed, 18 insertions(+), 90 deletions(-) > > diff --git a/Documentation/livepatch/module-elf-format.rst b/Documentation/livepatch/module-elf-format.rst > index 9f0c997d4940..8c6b894c4661 100644 > --- a/Documentation/livepatch/module-elf-format.rst > +++ b/Documentation/livepatch/module-elf-format.rst > @@ -14,6 +14,7 @@ This document outlines the Elf format requirements that livepatch modules must f > 4. Livepatch symbols > 4.1 A livepatch module's symbol table > 4.2 Livepatch symbol format > + 5. Symbol table and Elf section access > > 1. Background and motivation > ============================ > @@ -295,3 +296,20 @@ See include/uapi/linux/elf.h for the actual definitions. > [*] > Note that the 'Ndx' (Section index) for these symbols is SHN_LIVEPATCH (0xff20). > "OS" means OS-specific. > + > +5. Symbol table and Elf section access > +====================================== > +A livepatch module's symbol table is accessible through module->symtab. > + > +Since apply_relocate_add() requires access to a module's section headers, > +symbol table, and relocation section indices, Elf information is preserved for > +livepatch modules and is made accessible by the module loader through > +module->klp_info, which is a klp_modinfo struct. When a livepatch module loads, > +this struct is filled in by the module loader. Its fields are documented below:: > + > + struct klp_modinfo { > + Elf_Ehdr hdr; /* Elf header */ > + Elf_Shdr *sechdrs; /* Section header table */ > + char *secstrings; /* String table for the section headers */ > + unsigned int symndx; /* The symbol table section index */ > + }; I think this file was inadvertently reverted, or at least the Symbol table and Elf section access section was supposed to stay gone, right? -- Joe