From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D97191519B8; Mon, 12 May 2025 18:00:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747072858; cv=none; b=sDsNrJILGywFrvH/hcDQP/9EG92bwp6MknYlg4kAuHDrq/qo/TAEco0nczR8gyxGLtknWOadjHI53/k0Xy0mbY5DdI1o9049CWZHfhdvK1RDtAtc30L5rGPQxFrCim50MMPpUnaSlkdOFwWSQdAOBw6Rcy9l5yg7+RIG0HnBFOo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747072858; c=relaxed/simple; bh=dohXAWee1aQOPWJ3Dw7ZmsBLSJ7It0+Ajyp7ee36VxE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ynm4wrk59XHnFBvawHX9AjbF0A9iSttg04HSlJLZmAZYCvPzG4C4JA2PmNPc1VesLak9nxnJwLXs/eE+ERuwTenQpvpDcJtuoTT4v7YrAI3m7d8DkPIe0VLr5domrUvZdm9tVwYAF3AGO3f8CDWOcajDGz/mdKpY10pT+kGjqO0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yIKoRRIq; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="yIKoRRIq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57089C4CEE7; Mon, 12 May 2025 18:00:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1747072858; bh=dohXAWee1aQOPWJ3Dw7ZmsBLSJ7It0+Ajyp7ee36VxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yIKoRRIqPr1R5ZIQ00ggdwv8S0NC7dlshg969Q9bTdP5JQqTHx90QW8VLtjydSjMt k3lz/OYpSLcseSl/rJqUh4xDyRQGRIcZguE/YvQnKzvwF3UdYDTVx+IgL9OO2gUPSm ZH8RzHHjJItZ2BoU38Vgfrre/NOjNYLoXL5U+pZU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Madhavan Srinivasan , "Nysal Jan K.A." , Venkat Rao Bagalkote , Donet Tom , Andrew Morton Subject: [PATCH 6.12 078/184] selftests/mm: fix a build failure on powerpc Date: Mon, 12 May 2025 19:44:39 +0200 Message-ID: <20250512172044.999572424@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250512172041.624042835@linuxfoundation.org> References: <20250512172041.624042835@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nysal Jan K.A. commit 8cf6ecb18baac867585fe1cba5dde6dbf3b6d29a upstream. The compiler is unaware of the size of code generated by the ".rept" assembler directive. This results in the compiler emitting branch instructions where the offset to branch to exceeds the maximum allowed value, resulting in build failures like the following: CC protection_keys /tmp/ccypKWAE.s: Assembler messages: /tmp/ccypKWAE.s:2073: Error: operand out of range (0x0000000000020158 is not between 0xffffffffffff8000 and 0x0000000000007ffc) /tmp/ccypKWAE.s:2509: Error: operand out of range (0x0000000000020130 is not between 0xffffffffffff8000 and 0x0000000000007ffc) Fix the issue by manually adding nop instructions using the preprocessor. Link: https://lkml.kernel.org/r/20250428131937.641989-2-nysal@linux.ibm.com Fixes: 46036188ea1f ("selftests/mm: build with -O2") Reported-by: Madhavan Srinivasan Signed-off-by: Nysal Jan K.A. Tested-by: Venkat Rao Bagalkote Reviewed-by: Donet Tom Tested-by: Donet Tom Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/mm/pkey-powerpc.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) --- a/tools/testing/selftests/mm/pkey-powerpc.h +++ b/tools/testing/selftests/mm/pkey-powerpc.h @@ -102,8 +102,18 @@ void expect_fault_on_read_execonly_key(v return; } +#define REPEAT_8(s) s s s s s s s s +#define REPEAT_64(s) REPEAT_8(s) REPEAT_8(s) REPEAT_8(s) REPEAT_8(s) \ + REPEAT_8(s) REPEAT_8(s) REPEAT_8(s) REPEAT_8(s) +#define REPEAT_512(s) REPEAT_64(s) REPEAT_64(s) REPEAT_64(s) REPEAT_64(s) \ + REPEAT_64(s) REPEAT_64(s) REPEAT_64(s) REPEAT_64(s) +#define REPEAT_4096(s) REPEAT_512(s) REPEAT_512(s) REPEAT_512(s) REPEAT_512(s) \ + REPEAT_512(s) REPEAT_512(s) REPEAT_512(s) REPEAT_512(s) +#define REPEAT_16384(s) REPEAT_4096(s) REPEAT_4096(s) \ + REPEAT_4096(s) REPEAT_4096(s) + /* 4-byte instructions * 16384 = 64K page */ -#define __page_o_noops() asm(".rept 16384 ; nop; .endr") +#define __page_o_noops() asm(REPEAT_16384("nop\n")) void *malloc_pkey_with_mprotect_subpage(long size, int prot, u16 pkey) {