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 5B00022423A for ; Fri, 9 Jan 2026 08:11:26 +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=1767946286; cv=none; b=hPx2klIXArptY695Lh+myC2/WkXukxYJuU8BEZlab/ypTPz7V4cKDdAJAcAUtLJGuT18fFNSpDVz5NzPwkP81RClW0142L2dY055Q1CXc0eCcWeM4xESgj1DIKv8FgwVqCdY9dHHhYvhq4WyGkWaqV1n5n8Q3A4N2gcv4gekjCc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767946286; c=relaxed/simple; bh=Xq3UOD0XwNT7ffDnXN6V65L94VH6ol+iib+k2l0DCkU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ndr2iPVlCpRetjRq16n9ggK+TIorl0FbIEduev7AnE7pKUnuB4M/gJK1oAkgsERJqkGAk0ynTnLImQq/M/zZzGkj7AT5xqQmNY+Lc61Mf9R8FJ39Qy/jR4DsLUB1AhEU6OqMfuc3P5NMUD4R5rjNyYiE24VjFtMvWwIFlMP5UzY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=S6J+quoK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="S6J+quoK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E844C4CEF1; Fri, 9 Jan 2026 08:11:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767946286; bh=Xq3UOD0XwNT7ffDnXN6V65L94VH6ol+iib+k2l0DCkU=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=S6J+quoKf3GioEh8V6vQ7YVqM24FHWk8a4zHlYhdpMQL0IHN/Oewnesl/ww2WC9cJ YQQnJRPrGCVXesJDqtrG4wn0AjCuM++ydSKX2OntJ+78tPWu7vLTQ8rP5stV9mR6oE iifxjqx11Xpt2ruk8UfRsl96WGQy9mrXkU8lnM2uMg+DVZWfoKObMzr88JWmigD8pm VpwE84rzfgOF+K4bgz2wvj8+ZXT89GdCWanrRroG5Ote5Jji/JdNgYKgIkzU0p4t8o aUzxhi7tg6czRFpKFBa4IrCtv0qyPLiwwNfnXBfA+/E7JPmtQSuihlMDWAtycDdKv1 EE7oQpnR1CKvA== Message-ID: Date: Fri, 9 Jan 2026 09:11:19 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 0/1] powerpc: Fix kuap warnings To: Shrikanth Hegde , maddy@linux.ibm.com, linuxppc-dev@lists.ozlabs.org, rostedt@goodmis.org, mhiramat@kernel.org, Nicholas Piggin Cc: riteshh@linux.ibm.com, linux-kernel@vger.kernel.org, hbathini@linux.ibm.com References: <20260109064917.777587-1-sshegde@linux.ibm.com> Content-Language: fr-FR From: "Christophe Leroy (CS GROUP)" In-Reply-To: <20260109064917.777587-1-sshegde@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Le 09/01/2026 à 07:49, Shrikanth Hegde a écrit : > Recently stumbled upon these kuap warnings. This happens with > preempt=full/lazy kernel with function tracing enabled. What irked > me was kernel compilation was getting failed when i had tracing > enabled. It doesn't fail everytime. While running stress-ng memory class > it threw same warnings. So that helped to narrow it down. > > So one possible way is to disable tracing for these enter/exit > vmx_usercopy. That seems to fix the bug/warnings. But that will make > them as non trace-able. If there is a better way to fix these warning while > keeping them as trace-able, please let me know. > > Anyone with insights on amr, vmx and tracing, please advise. The main principle with KUAP is to not call subfunctions once userspace access enabled. There are a few exceptions like __copy_tofrom_user() that are allowed in order to optimise large copies. However this needs to be handled very carefully, and in principle we don't expect __copy_tofrom_user() to call other functions. So it might require wider rework but we should narrow as much as possible the period during which access to userspace is opened, with something like: raw_coy_to_user_power7() { enter_vmx_usercopy(); allow_write_to_user(to, n); ret = __copy_tofrom_user_power7(); prevent_write_to_user(to, n); exit_vmx_usercopy(); return ret; } raw_copy_to_user() { if (cpu_has_feature(CPU_FTR_VMX_COPY)) raw_copy_to_user_power7(); allow_write_to_user(to, n); ret = __copy_tofrom_user(to, (__force const void __user *)from, n); prevent_write_to_user(to, n); return ret; }