From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56B86481243 for ; Wed, 1 Jul 2026 12:51:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782910317; cv=none; b=gSPUKZz1TQu73iZUUv45FXQNRXvJ2N/2A8Ccd9diEaF31NVAF/pwVT9Ir1/1QF9TOpdThbxjJ30IEFv4ieqWZk8IrBJRpD8kmY3D2zQ20C7m72/dfrOvOfbu0WRcEu2R/W2nVIkZdUl75dwvs/8aKysM5xHt7cEo75vQSIEruCk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782910317; c=relaxed/simple; bh=uGPFCFx1FqW9VMNus2a7Thw1P9za6fs0Y7aQfT5w4n8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=FH18sl0LJgfH3xiwWh7TXH72Hvw++2KI5Wx3QRRavK4qGLp7isuT96/BqgUpf4yp+hAKW+9cbOmneflOYrDFbhR05XRUudfgC+SEk4rbJIStv5qYWuQdveqpJOZVf7PDx8uXmJTTHExkYPFKvdit6GJvzZhfH/DeLA6MwLOrFPU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=G0EeFTxD; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="G0EeFTxD" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-474303f3c72so393564f8f.0 for ; Wed, 01 Jul 2026 05:51:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782910315; x=1783515115; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=OmWDh+E3Ix3zFJalnxUFFjV5BfDox2wF4vd/HMlyNyM=; b=G0EeFTxDW9bFX3jtwYKSGw+xIL+57uxn2u+Xhzf1E50UmKglu/Y7yCjU9dgqIQFuYL k9UF4Q/Hl7Z2XxV3TPEMfKQIzkihnVXzr97PUIr56r7sxu3rHTsKBmTdPcweSrCw91WY MA9YHi6JqZLDuCQbvTPEM0OMbR66qFavy6iSM+5zv25TKQUuQRUJdqfjFI0aVDXOK9aN 4+22rocUSEz7m0PoWL1IbHfx6ylW/zfLgP8Yv1N8CKYJwDoP3NVWGzmGZ0/SjfFa6Ooa Ow3ivHvbJ3Lzy2Fq99ajQJn4R5rS1BhnWUbJ515PiGYNcFFHKANLSbsDGUh2BpsPZF79 0NZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782910315; x=1783515115; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=OmWDh+E3Ix3zFJalnxUFFjV5BfDox2wF4vd/HMlyNyM=; b=E/+2riCY5fziOFSi70AgzcA9cq7zBws8q8iFHh7gk9CEAHcmynRVjCK+jed+Jptlnb 8ovJ5IyDKlhlKttPUyxvx+zegg6zmauBITF5rsri3DsXi3I75KxVbV+23okbE7KkMfuQ DjbEJf8VjZF9I5nY+s7RTSw3ErPQ7Pk33ufRsxdXT3vATo6Bq0h7vD1ssPCbDJDUT6sl SUNRMbEtQlhhU8ifttLESKZ7hK30P+YKGteqoapujP5murm0ZfiTO0x1/ld3vUHyEAuP iuXuBb4OBOJTVkACYy57rIMhKe9vRz0xA3KeR3BatgQ/rqZX/FtkLhshRqLleRDOE2mX fhHg== X-Forwarded-Encrypted: i=1; AHgh+RpFlqIlxomgs06BM/xp6+Z0R6oPFzHgTE6lWQKfeC3EVBznVLQ9kS270HwXWO5juI8qPyb9RYBQgS26QQc=@vger.kernel.org X-Gm-Message-State: AOJu0YxaiAbQ4CRtWFeCd+iDGc16wn6iVyf6+6iNzZy+kKoQbQZ2WE81 iBhdoOI/E3E2pm4JERraNbCbUwQ74ptHIk4mY5x6uoHxQ6nFnNsFepAr X-Gm-Gg: AfdE7cl62lC08wHjeG3eAqS4FmWMACh+3pVkrrXeo+mH0kCK0UGiAUBzijMG9s9J6ti FWAtstzCExpD67/fFg48vs4CUXmVXWLVyi1Jzy2+ghEi+xRV6ts0mKbCEUpPJRZoC23OUYjDNks F6vsL8/iRR51clE/DBNBdP8oYp0yLm4zbiBJRrYBS37ci3x/W4Nly0I2PMCu/xvwy1mvKxMTVB7 XVZNZAuJBLNvm8xWUeX60NH6iJVw4rIeTdQ+bDUMMYrR02UIC7UX9PM7mGXP6LLTZJpHyAU1n6j q4jY4w5afHFeot2TNFm6TVg/0SjaBwTfpH9MZ9ycgYfUjfCoQy2UTJoSO0lBdUVD/GY9vwQhnhw jn9vx8udvaVRkFW3t+JSKFGwD808jlxMKjS3hCY9nHvLDIRvmKcxan8aBptEox7PWsZfFzwR8w5 kWlUVbWTFAevvSGuDIsnB1AqWmhY2CXNQmof85YjMeAclfEDRuSZt+NezN5EnE98nqDtfQE7Qdl n7wPrHQ/+uOW/COy5qgAOGU7Vc= X-Received: by 2002:a05:6000:2406:b0:46e:5c5d:b2cc with SMTP id ffacd0b85a97d-47757c6e277mr2873893f8f.23.1782910314659; Wed, 01 Jul 2026 05:51:54 -0700 (PDT) Received: from voyt-laptop-dell.fritz.box ([2001:9e8:bd55:a800:14a4:886c:f7de:bb03]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-475671d0403sm17665051f8f.29.2026.07.01.05.51.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2026 05:51:54 -0700 (PDT) From: Dmitry Voytik To: Alexander Potapenko , Borislav Petkov , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Dave Hansen , Josh Poimboeuf Cc: Dmitry Vyukov , Andrew Morton , Ankur Arora , "H . Peter Anvin" , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Marco Elver , x86@kernel.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, llvm@lists.linux.dev, Dmitry Voytik Subject: [PATCH] x86/mm: fix objtool failure with KMSAN enabled Date: Wed, 1 Jul 2026 14:51:51 +0200 Message-ID: <20260701125151.352632-1-voytikd@gmail.com> X-Mailer: git-send-email 2.54.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This patch fixes broken builds with defconfig + CONFIG_KMSAN + CONFIG_DEBUG_INFO_*. To reproduce the issue before the fix: make mrproper make LLVM=1 defconfig ./scripts/config -e CONFIG_KMSAN \ -e CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT make LLVM=1 olddefconfig make LLVM=1 -j(nproc) vmlinux ... LD vmlinux.o vmlinux.o: warning: objtool: folio_zero_user+0x801: undefined stack state vmlinux.o: error: objtool: folio_zero_user+0x801: unknown CFA base reg -1 make[2]: *** [scripts/Makefile.vmlinux_o:76: vmlinux.o] Error 255 objtool in verbose mode shows how the frame pointer is omitted: make LLVM=1 OBJTOOL_VERBOSE=1 -j(nproc) vmlinux ... b15a2c: folio_zero_user+0x7fc xor %eax,%eax b15a2e: folio_zero_user+0x7fe mov %rcx,%rsp b15a31: folio_zero_user+0x801 mov %r14,%rdi b15a34: folio_zero_user+0x804 mov %rbx,%rcx b15a37: folio_zero_user+0x807 call 0xb15a3c <__clear_pages_unrol After the fix, the frame pointer is back: b15a37: 31 c0 xor %eax,%eax b15a39: 48 89 ec mov %rbp,%rsp b15a3c: 4c 89 f7 mov %r14,%rdi b15a3f: 48 89 d9 mov %rbx,%rcx b15a42: e8 00 00 00 00 call b15a47 It seems the issue was introduced by commit 54a6b89a3db2 ("x86/mm: simplify clear_page_*") The actual fix is to revert the change how ASM_CALL_CONSTRAINT is positioned. Additionally, reintroduce asm_inline to prevent potential compiler rejection of inlining. Link: https://lore.kernel.org/CAAX90H2_RPnZL_dFYN7cQF6yt-wAweKKSx2=6e2aZ0kv+Pm+NQ@mail.gmail.com Signed-off-by: Dmitry Voytik --- arch/x86/include/asm/page_64.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/page_64.h b/arch/x86/include/asm/page_64.h index 1895c207f629..de8604f0a3a1 100644 --- a/arch/x86/include/asm/page_64.h +++ b/arch/x86/include/asm/page_64.h @@ -100,12 +100,13 @@ static inline void clear_pages(void *addr, unsigned int npages) * __clear_pages_unrolled() are part of the inline asm register * specification. */ - asm volatile(ALTERNATIVE_2("call __clear_pages_unrolled", - "shrq $3, %%rcx; rep stosq", X86_FEATURE_REP_GOOD, - "rep stosb", X86_FEATURE_ERMS) - : "+c" (len), "+D" (addr), ASM_CALL_CONSTRAINT - : "a" (0) - : "cc", "memory"); + asm_inline volatile( + ALTERNATIVE_2("call __clear_pages_unrolled", + "shrq $3, %%rcx; rep stosq", X86_FEATURE_REP_GOOD, + "rep stosb", X86_FEATURE_ERMS) + : ASM_CALL_CONSTRAINT, "+c"(len), "+D"(addr) + : "a"(0) + : "cc", "memory"); } #define clear_pages clear_pages -- 2.54.0