Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp901729yba; Thu, 9 May 2019 07:41:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqxpa3X6pE331zXiBi/LaHjK2DSnmOmlaS2qFdc9V77aUqkg+f5+3tjvu1rPT0EPGE0I94f+ X-Received: by 2002:a62:ed09:: with SMTP id u9mr5876498pfh.23.1557412905065; Thu, 09 May 2019 07:41:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557412905; cv=none; d=google.com; s=arc-20160816; b=kk/llXjhxPhr1XEfbXoJVJy8bktotwEImoGEYhBy0buuXB0D7T45GXMrO9y2FjZw0o ClRZck52i43PjGgcLkOLSh6LBcTM18gRM5oboIxVIPygsq6gavwKgqaId5zwfKfiRIdT uV5iofsLSE777gylqbG6DW7KcDMN4KntLKmPqewFnjr7XEtSLznvEd+Blgap2DQiLJOr hTSpOdsBhrt6jRmDbz/LUPrqItT+wx/BE45d2hJG8tivVVV8oIGFDAp4sjEU+Zdxm5+H ze9bzdqg/GAVrgkKZtq2YZYfxXyXirJKEufLS17CgkpnMn3UFjkRKH9P0XeyHJel6VVf Enew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from; bh=h3Zm4PGuAoOy4x6aZ68MgYSdc/UFzynwRE7zd/3VL9Y=; b=v0JL5qKrl0IvtyA+mVmP2NsGP4UaaKlEDQqBr07lsACycjM5Nr2+OOkFjvO99Ceol8 Tkpwq++B0W5bIcPOu7Rt01LfVQ+Vo2myhLsK6Srqw6iKXNNwfOqiwTAPLQcQaRgw6p7V kxTTbUCI/mRtsmLxYynJpwwOfgIxJTr+jJ31m+IMsC82mf8MhtypITI8B8b4V55bZCUS hvyJwODr9oSFcU5LOQCrEP70c46wnYD2ICf2YWPCQeQXlCUbJJj+c34gkFf3CR7jmVHa 5a9dknh+PDjgt59oVpA0IBhW3xO4FYIArRuYyrB7jgNCScyWwjpd1qXqFQrTV/SIBjaf AJ0Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 y20si3294037pgj.578.2019.05.09.07.41.29; Thu, 09 May 2019 07:41:45 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726806AbfEIOjK (ORCPT + 99 others); Thu, 9 May 2019 10:39:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48852 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726743AbfEIOjJ (ORCPT ); Thu, 9 May 2019 10:39:09 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B0E56308FF32; Thu, 9 May 2019 14:39:08 +0000 (UTC) Received: from jlaw-desktop.redhat.com (ovpn-123-90.rdu2.redhat.com [10.10.123.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id F24AC17AEA; Thu, 9 May 2019 14:39:07 +0000 (UTC) From: Joe Lawrence To: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, linux-kbuild@vger.kernel.org Subject: [PATCH v4 01/10] livepatch: Create and include UAPI headers Date: Thu, 9 May 2019 10:38:50 -0400 Message-Id: <20190509143859.9050-2-joe.lawrence@redhat.com> In-Reply-To: <20190509143859.9050-1-joe.lawrence@redhat.com> References: <20190509143859.9050-1-joe.lawrence@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Thu, 09 May 2019 14:39:08 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Josh Poimboeuf Define klp prefixes in include/uapi/linux/livepatch.h, and use them for replacing hard-coded values in kernel/livepatch/core.c. Update MAINTAINERS. Note: Add defines to uapi as these are also to be used by a newly introduced klp-convert script. Signed-off-by: Josh Poimboeuf Signed-off-by: Joao Moreira Signed-off-by: Joe Lawrence --- MAINTAINERS | 1 + include/linux/livepatch.h | 1 + include/uapi/linux/livepatch.h | 15 +++++++++++++++ kernel/livepatch/core.c | 4 ++-- 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 include/uapi/linux/livepatch.h diff --git a/MAINTAINERS b/MAINTAINERS index 09f43f1bdd15..52842fa37261 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9016,6 +9016,7 @@ R: Joe Lawrence S: Maintained F: kernel/livepatch/ F: include/linux/livepatch.h +F: include/uapi/linux/livepatch.h F: arch/x86/include/asm/livepatch.h F: arch/x86/kernel/livepatch.c F: Documentation/livepatch/ diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h index 53551f470722..16b48e8b29a2 100644 --- a/include/linux/livepatch.h +++ b/include/linux/livepatch.h @@ -25,6 +25,7 @@ #include #include #include +#include #if IS_ENABLED(CONFIG_LIVEPATCH) diff --git a/include/uapi/linux/livepatch.h b/include/uapi/linux/livepatch.h new file mode 100644 index 000000000000..e19430918a07 --- /dev/null +++ b/include/uapi/linux/livepatch.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ + +/* + * livepatch.h - Kernel Live Patching Core + * + * Copyright (C) 2016 Josh Poimboeuf + */ + +#ifndef _UAPI_LIVEPATCH_H +#define _UAPI_LIVEPATCH_H + +#define KLP_RELA_PREFIX ".klp.rela." +#define KLP_SYM_PREFIX ".klp.sym." + +#endif /* _UAPI_LIVEPATCH_H */ diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c index eb0ee10a1981..3d9ed895b252 100644 --- a/kernel/livepatch/core.c +++ b/kernel/livepatch/core.c @@ -235,7 +235,7 @@ static int klp_resolve_symbols(Elf_Shdr *relasec, struct module *pmod) /* Format: .klp.sym.objname.symname,sympos */ cnt = sscanf(strtab + sym->st_name, - ".klp.sym.%55[^.].%127[^,],%lu", + KLP_SYM_PREFIX "%55[^.].%127[^,],%lu", objname, symname, &sympos); if (cnt != 3) { pr_err("symbol %s has an incorrectly formatted name\n", @@ -281,7 +281,7 @@ static int klp_write_object_relocations(struct module *pmod, * See comment in klp_resolve_symbols() for an explanation * of the selected field width value. */ - cnt = sscanf(secname, ".klp.rela.%55[^.]", sec_objname); + cnt = sscanf(secname, KLP_RELA_PREFIX "%55[^.]", sec_objname); if (cnt != 1) { pr_err("section %s has an incorrectly formatted name\n", secname); -- 2.20.1