Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5127015yba; Wed, 10 Apr 2019 11:57:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqySWS2UowAl60/WddpU99I7JuU64xr676sKHr6m/v/1PX+BQmYX2iSAPpH5tZDDszPqj3wW X-Received: by 2002:a62:6fc6:: with SMTP id k189mr27228434pfc.154.1554922672553; Wed, 10 Apr 2019 11:57:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554922672; cv=none; d=google.com; s=arc-20160816; b=jZMXVkkqsVQ6Zi0juoNMLFAvPfcVNc2vibVdZcpc3BfUOrXbuAXpSICEFSlCUzkuO7 hBjkUFH/fzjLiKCxK0sMjQoTJm21Gz2we2r+BanU4kWiwJ4wg4n9vSF/LaX06Lhspv4b 84jgSXger6xAQg/9rIsg76kehMAyqAWU9QvecoClFl7fThRoADufGEYvHpZzIbRb91Yt OHaox1UWNEOpiws3bkahbaZdHswVOZQh6gtFZub+lvqZbn3BP5V3trWhaDGbTlvUpgMq OEb9O6tUOsayqoprmXg7DMOX4AxWj48kAYDU+99SicwBAvEpNozLkvLpOpZYFbsIDzwd +zag== 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:cc:to:from; bh=Z/k6z9hRY8afKyrcM/7k3CH5zG0lJWR5zns8fjqFAmM=; b=OJoU95/99+VghaNKMgdx/1/YjA4VvQZH9WXSn+P8jarw7tDk4NUfhFYKrVu+kzjNyG TV2iMcRO/oXrCGRb6+PLpCF5w6Jwrh1eBc/j94N5cyHTNaUEcAQ8iJ4gtcQ5qGZK2Gyq BLIcVYlJcLdRS1GI3FjJmqMvcXnFESbVvUxDG8IFTHnoWTVwMHBw746xRhVbvwmlnmqN vLI+A7BDe6alX+eRFhippMHwyCqfQTWjCGL1V13kWF67cvQxru8biGRGm+DxXYZYh34J G3tWcJAI86TWwkuO6Cncgz4ba3aGKHOckswOeWB93EozcM6fZqHy1FAWBFUrRc4amhvp vb8g== 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 h4si27936362pgc.298.2019.04.10.11.57.36; Wed, 10 Apr 2019 11:57:52 -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 S2387594AbfDJPvy (ORCPT + 99 others); Wed, 10 Apr 2019 11:51:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45081 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387476AbfDJPvH (ORCPT ); Wed, 10 Apr 2019 11:51:07 -0400 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 mx1.redhat.com (Postfix) with ESMTPS id 13E6E6DDD6; Wed, 10 Apr 2019 15:51:06 +0000 (UTC) Received: from jlaw-desktop.bos.redhat.com (dhcp-17-208.bos.redhat.com [10.18.17.208]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8045D1017B2E; Wed, 10 Apr 2019 15:51:04 +0000 (UTC) From: Joe Lawrence To: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, linux-kbuild@vger.kernel.org Cc: Jessica Yu , Jiri Kosina , Joao Moreira , Joe Lawrence , Josh Poimboeuf , Konstantin Khlebnikov , Masahiro Yamada , Michael Matz , Miroslav Benes , Nicolai Stange , Petr Mladek Subject: [PATCH v3 1/9] livepatch: Create and include UAPI headers Date: Wed, 10 Apr 2019 11:50:50 -0400 Message-Id: <20190410155058.9437-2-joe.lawrence@redhat.com> In-Reply-To: <20190410155058.9437-1-joe.lawrence@redhat.com> References: <20190410155058.9437-1-joe.lawrence@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 10 Apr 2019 15:51:06 +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 | 17 +++++++++++++++++ kernel/livepatch/core.c | 4 ++-- 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 include/uapi/linux/livepatch.h diff --git a/MAINTAINERS b/MAINTAINERS index 2359e12e4c41..65b4e8f481f0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9017,6 +9017,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..bb86243de805 --- /dev/null +++ b/include/uapi/linux/livepatch.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +/* + * livepatch.h - Kernel Live Patching Core + * + * Copyright (C) 2016 Josh Poimboeuf + */ + +#ifndef _UAPI_LIVEPATCH_H +#define _UAPI_LIVEPATCH_H + +#include + +#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