mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Naveen N Rao <naveen@kernel.org>
To: Nikolay Borisov <nik.borisov@suse.com>
Cc: x86@kernel.org, mhocko@suse.com, kas@kernel.org,
	 linux-kernel@vger.kernel.org,
	Dan Williams <dan.j.williams@intel.com>,
	 Kees Cook <kees@kernel.org>, Ingo Molnar <mingo@kernel.org>,
	 Vishal Annapurve <vannapurve@google.com>,
	Kirill Shutemov <kirill.shutemov@linux.intel.com>,
	 Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Michael Ellerman <mpe@ellerman.id.au>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	 stable@vger.kernel.org
Subject: Re: [PATCH v2] x86/devmem: Drop /dev/mem access for confidential guests
Date: Mon, 30 Nov 2026 15:07:40 +0530	[thread overview]
Message-ID: <aw1DUmw8QakPupCo@blrnaveerao1> (raw)
In-Reply-To: <20261127154211.21360-2-nik.borisov@suse.com>

On Fri, Nov 27, 2026 at 05:42:12PM +0200, Nikolay Borisov wrote:
> diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
> index 079f8c7e9e3c..8768508f3c6d 100644
> --- a/arch/x86/mm/init.c
> +++ b/arch/x86/mm/init.c
> @@ -8,6 +8,7 @@
>  #include <linux/kmemleak.h>
>  #include <linux/sched/task.h>
>  #include <linux/execmem.h>
> +#include <linux/cc_platform.h>
>  
>  #include <asm/set_memory.h>
>  #include <asm/cpu_device_id.h>
> @@ -866,6 +867,15 @@ void __init poking_init(void)
>   */
>  int devmem_is_allowed(unsigned long pagenr)
>  {
> +	/*
> +	 * Enforce encrypted mapping consistency and avoid unaccepted
> +	 * memory conflicts, "lockdown" /dev/mem for confidential
> +	 * guests.
> +	 */
> +	if (IS_ENABLED(CONFIG_STRICT_DEVMEM) &&
> +	    cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT))
> +		return 0;
> +

You can drop IS_ENABLED() check there -- devmem_is_allowed() is only 
called if STRICT_DEVMEM is enabled.


- Naveen


      parent reply	other threads:[~2026-11-30  9:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 15:42 Nikolay Borisov
2026-11-30  9:22 ` Naveen N Rao
2026-11-30  9:37 ` Naveen N Rao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aw1DUmw8QakPupCo@blrnaveerao1 \
    --to=naveen@kernel.org \
    --cc=arnd@arndb.de \
    --cc=dan.j.williams@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kas@kernel.org \
    --cc=kees@kernel.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.com \
    --cc=mingo@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=nik.borisov@suse.com \
    --cc=stable@vger.kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=vannapurve@google.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®