Received: by 10.213.65.68 with SMTP id h4csp1169813imn; Wed, 21 Mar 2018 04:32:27 -0700 (PDT) X-Google-Smtp-Source: AG47ELsRa+vsYX6gYIVG1tG6CDM6yMenFebOCkwg1483/E+MFoV/zJfwmwCwzzopMpw7LenXCtgH X-Received: by 10.98.246.16 with SMTP id x16mr16578313pfh.81.1521631947709; Wed, 21 Mar 2018 04:32:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521631947; cv=none; d=google.com; s=arc-20160816; b=GMVkG9kBdLS1dMXPGbbP6H6zsmhP4QKnN/z5Rg4S5YD8S0sAHXTsoPHXIlp0E+oOLT ZpgxC5CmJ5Xjw18bf4Sj/5oKbEi7Y0fOY8744/ujs/Z4lR0WpsmEoe8DMSqPD+qN9b93 o7F3VV/Ial9O8f24mZXdVkHlZEg5vVZCgjJ5/ZplWLMacvUJuV5h5Wsp9Tq25h9CN7Fk lDEW1sHle6v12CqUEF+S1jnSg+MO7GjAdWtzpIXQfPxfIVKDLfRVwsje9Gjmq1zqCXAG +cutJvRG/xqDbpHG7z24THL5W693MSWkgACiCG2OUZw2tGco4OjGGwTuqF7IvuCVGr/G Y5Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:date:subject:cc:to:from:arc-authentication-results; bh=utpnuNvmh4ZqQH3N9mWpmALrz8x9xd9I9pEamdzRObw=; b=ArQXjJXgtZmjp2VFvPRXJ/h8mK3X9BhMlESTmHqLbftXCtyGp5u/SbII88rxBRnRdb FIhH9E3rb/YkpzdkC5P6avfIiQmM1+gT8UI/5E02OVUxcBZjDZcgd/HmrU63Xb962PdP CUS0SCed0f8z/edxoYNRGIOchjItAqndVN9eaoKcl/e0xnAYQ0K7n4C4XLr8QnI3XYyU KL+MlBPGCUaePPf/OfmSh12nedMuDa7Y6NopozB1zDtMBssdFUQVSWzkaTBXUpYFSwx4 u/EnGcgBtml3D1xDnBDS1EeFFjN5dyPAij7wC3Sf46+X6fZl3oZt6Ovo/Nm4+DPNhi9f Sw6g== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s4si2908517pfm.223.2018.03.21.04.32.13; Wed, 21 Mar 2018 04:32:27 -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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751815AbeCUL2D (ORCPT + 99 others); Wed, 21 Mar 2018 07:28:03 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52094 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751545AbeCUL2A (ORCPT ); Wed, 21 Mar 2018 07:28:00 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2LBOgJt010365 for ; Wed, 21 Mar 2018 07:27:59 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0b-001b2d01.pphosted.com with ESMTP id 2gup8mrt9x-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Wed, 21 Mar 2018 07:27:59 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 21 Mar 2018 11:27:57 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 21 Mar 2018 11:27:52 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w2LBRqDh60489910; Wed, 21 Mar 2018 11:27:52 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B75264C040; Wed, 21 Mar 2018 11:20:59 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 51D1E4C044; Wed, 21 Mar 2018 11:20:59 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 21 Mar 2018 11:20:59 +0000 (GMT) From: Philipp Rudo To: kexec@lists.infradead.org, linux-s390@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Eric Biederman , Vivek Goyal , Michael Ellerman , Thiago Jung Bauermann , Martin Schwidefsky , Heiko Carstens , Andrew Morton , x86@kernel.org, Dave Young , AKASHI Takahiro , Ingo Molnar Subject: [PATCH v2 00/11] kexec_file: Clean up purgatory load Date: Wed, 21 Mar 2018 12:27:40 +0100 X-Mailer: git-send-email 2.13.5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 18032111-0020-0000-0000-00000407BAD9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18032111-0021-0000-0000-0000429BD8EE Message-Id: <20180321112751.22196-1-prudo@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-21_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803210139 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi everybody here is the updated patch set including Dave's comments. Changes v1 -> v2: * Fix missing memcpy and memset definition in x86 purgatory introduced by moving the sha256 implementation to common code. * Update subject of patches #7-9 to be more precise. * Add missing semicolon in patch #7 found by kbuild bot. * Fix compile warnings found by kbuild bot by moving all kexec_file specific function declarations into a 'ifdef CONFIG_KEXEC_FILE' block (patch #5 and #10). Thanks Philipp --- Hi everybody following the discussion with Dave and AKASHI, here are the common code patches extracted from my recent patch set (Add kexec_file_load support to s390) [1]. The patches were extracted to allow upstream integration together with AKASHI's common code patches before the arch code gets adjusted to the new base. The reason for this series is to prepare common code for adding kexec_file_load to s390 as well as cleaning up the mis-use of the sh_offset field during purgatory load. In detail this series contains: Patch #1&2: Minor cleanups/fixes. Patch #3-9: Clean up the purgatory load/relocation code. Especially remove the mis-use of the purgatory_info->sechdrs->sh_offset field, currently holding a pointer into either kexec_purgatory (ro) or purgatory_buf (rw) depending on the section. With these patches the section address will be calculated verbosely and sh_offset will contain the offset of the section in the stripped purgatory binary (purgatory_buf). Patch #10: Allows architectures to set the purgatory load address. This patch is important for s390 as the kernel and purgatory have to be loaded to fixed addresses. In current code this is impossible as the purgatory load is opaque to the architecture. Patch #11: Moves x86 purgatories sha implementation to common lib/ directory to allow reuse in other architectures. The patches apply to v4.16-rc3. There are no changes compared to [1] (all requested changes only affected s390 code). Please note that I had to touch arch code for x86 and power a little. In theory this should not change the behavior but I don't have a way to test it. Cross-compiling with defconfig [2] works fine for both. Thanks Philipp [1] http://lists.infradead.org/pipermail/kexec/2018-February/019926.html [2] On x86 with the orc unwinder and stack validation turned off. objtool SEGFAULTs on s390... Philipp Rudo (11): kexec_file: Silence compile warnings kexec_file: Remove checks in kexec_purgatory_load kexec_file: Make purgatory_info->ehdr const kexec_file: Search symbols in read-only kexec_purgatory kexec_file: Use read-only sections in arch_kexec_apply_relocations* kexec_file: Split up __kexec_load_puragory kexec_file: Remove unneeded for-loop in kexec_purgatory_setup_sechdrs kexec_file: Remove unneeded variables in kexec_purgatory_setup_sechdrs kexec_file: Remove mis-use of sh_offset field during purgatory load kexec_file: Allow archs to set purgatory load address kexec_file: Move purgatories sha256 to common code arch/powerpc/kernel/kexec_elf_64.c | 9 +- arch/x86/kernel/kexec-bzimage64.c | 8 +- arch/x86/kernel/machine_kexec_64.c | 66 ++--- arch/x86/purgatory/Makefile | 3 + arch/x86/purgatory/purgatory.c | 2 +- arch/x86/purgatory/string.c | 12 + include/linux/kexec.h | 49 ++-- {arch/x86/purgatory => include/linux}/sha256.h | 11 +- kernel/kexec_file.c | 379 ++++++++++++------------- {arch/x86/purgatory => lib}/sha256.c | 4 +- 10 files changed, 267 insertions(+), 276 deletions(-) rename {arch/x86/purgatory => include/linux}/sha256.h (62%) rename {arch/x86/purgatory => lib}/sha256.c (99%) -- 2.13.5