Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3637312pxb; Mon, 24 Jan 2022 14:06:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJw/7qtj+rmaPTr3r/t5WkOWB214iNzu7LT5JeUMebU1cy0U/JwzYhG4n8tH6IR45Nx2uMB+ X-Received: by 2002:a17:90a:9291:: with SMTP id n17mr347138pjo.187.1643061999190; Mon, 24 Jan 2022 14:06:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643061999; cv=none; d=google.com; s=arc-20160816; b=xx9llK1eF2Y8EfC6lBNTjIW98Pb/Jhz+0JAPkpl4zCGaxteiUXpK/NRp8ol0hQOiRj Fw9ul94AEPVUL8sbMyoIefNPtML6xq0g8s+NQA5xuRueKQAi7+agjuPX/aQkLGqiwo5D qW9+HwYZz+chWOmlEYxXMhrmOVSXZjhkWz/1HRZroFqV0cZkaGLq0kcxLdNs/vxghDc5 fkLAfbOJuuszenf+cKCOJkpfQgguutOq6qSIUglfVIgxH6E7sQI28EIdrnd+g1JGhTxm 6KGxEoAJ4osyIzYNRLpDRcMvYNe1TrnaQvo1c4tF8oGkRFkznFyYrjLj+MNjlJ9LE775 n2zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wcBFz96n2TxXLeILhrhf0CwYJ1B5TvvMFKnOQVagLV8=; b=CmOCCgQmR0hH8UR+ybaf5pK8lJaJGXWaWX2ShhiJATump70aQ8r5NP4cVQj3jr9gnm eXj1Urm0E2ZbFbMaERz3WFOAFkAPEhd3KxScVi9YqT8M+yyD4wJwCy+kMIu8n/Ogz6yV XjSEDRYcvXM+5gDCRU+HGkujdifsAC5Nv9wJA/qi9D8VGb6H639yM1LOZ0OTez3Q65MX fTNP3JsIm/2JX3EseVBvD1qAabNPe77krLHDv7X6ALORktfX56hnLrDeKNtuGdtu5fsj HhbPpSeXjs1g6eUz1U01utF1d4M5aQla6Midn5ZmDDjRFpW8wMdI7Gxn2+EFWRaIQszx Kn3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="f/nczKtQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u31si16264222pgk.546.2022.01.24.14.06.26; Mon, 24 Jan 2022 14:06:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="f/nczKtQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575428AbiAXVvm (ORCPT + 99 others); Mon, 24 Jan 2022 16:51:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449919AbiAXVRb (ORCPT ); Mon, 24 Jan 2022 16:17:31 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E042C067A60; Mon, 24 Jan 2022 12:12:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C15046130A; Mon, 24 Jan 2022 20:12:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6C5AC340E5; Mon, 24 Jan 2022 20:12:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055147; bh=kL6LzLw+oTORP83YCmczMg/dp0X5Xod6kpxH5jq3mtE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f/nczKtQKoUFjhjskY8jft6351lJMmTRaWERO3vckwQxbk5c5D6DMe4f0b+wxKnBz +6VFPtP0FdGiT00GcZU78cWUCkcLKTTqumnNKk6dyKVeZAkmuxkPva4BfWN+nyLfO8 qPSoeMFxKwIodpyRzDyGlXUSTNpZ31D4YjSAdVQY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , Arnd Bergmann , Nick Desaulniers , Nathan Chancellor , Christophe Leroy Subject: [PATCH 5.15 057/846] lkdtm: Fix content of section containing lkdtm_rodata_do_nothing() Date: Mon, 24 Jan 2022 19:32:54 +0100 Message-Id: <20220124184102.935932827@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe Leroy commit bc93a22a19eb2b68a16ecf04cdf4b2ed65aaf398 upstream. On a kernel without CONFIG_STRICT_KERNEL_RWX, running EXEC_RODATA test leads to "Illegal instruction" failure. Looking at the content of rodata_objcopy.o, we see that the function content zeroes only: Disassembly of section .rodata: 0000000000000000 <.lkdtm_rodata_do_nothing>: 0: 00 00 00 00 .long 0x0 Add the contents flag in order to keep the content of the section while renaming it. Disassembly of section .rodata: 0000000000000000 <.lkdtm_rodata_do_nothing>: 0: 4e 80 00 20 blr Fixes: e9e08a07385e ("lkdtm: support llvm-objcopy") Cc: stable@vger.kernel.org Cc: Kees Cook Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: Nick Desaulniers Cc: Nathan Chancellor Signed-off-by: Christophe Leroy Reviewed-by: Nick Desaulniers Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/8900731fbc05fb8b0de18af7133a8fc07c3c53a1.1633712176.git.christophe.leroy@csgroup.eu Signed-off-by: Greg Kroah-Hartman --- drivers/misc/lkdtm/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/misc/lkdtm/Makefile +++ b/drivers/misc/lkdtm/Makefile @@ -20,7 +20,7 @@ CFLAGS_REMOVE_rodata.o += $(CC_FLAGS_LT OBJCOPYFLAGS := OBJCOPYFLAGS_rodata_objcopy.o := \ - --rename-section .noinstr.text=.rodata,alloc,readonly,load + --rename-section .noinstr.text=.rodata,alloc,readonly,load,contents targets += rodata.o rodata_objcopy.o $(obj)/rodata_objcopy.o: $(obj)/rodata.o FORCE $(call if_changed,objcopy)