lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d1938a63-839b-44a5-a68f-34ad290fef21@kernel.org>
Date: Wed, 14 Jan 2026 10:44:08 +0100
From: "David Hildenbrand (Red Hat)" <david@...nel.org>
To: Gregory Price <gourry@...rry.net>, linux-mm@...ck.org
Cc: linux-cxl@...r.kernel.org, nvdimm@...ts.linux.dev,
 linux-kernel@...r.kernel.org, virtualization@...ts.linux.dev,
 kernel-team@...a.com, dan.j.williams@...el.com, vishal.l.verma@...el.com,
 dave.jiang@...el.com, mst@...hat.com, jasowang@...hat.com,
 xuanzhuo@...ux.alibaba.com, eperezma@...hat.com, osalvador@...e.de,
 akpm@...ux-foundation.org, Hannes Reinecke <hare@...e.de>
Subject: Re: [PATCH 8/8] dax/kmem: add memory notifier to block external state
 changes

On 1/14/26 09:52, Gregory Price wrote:
> Add a memory notifier to prevent external operations from changing the
> online/offline state of memory blocks managed by dax_kmem. This ensures
> state changes only occur through the driver's hotplug sysfs interface,
> providing consistent state tracking and preventing races with auto-online
> policies or direct memory block sysfs manipulation.
> 
> The notifier uses a transition protocol with memory barriers:
>    - Before initiating a state change, set target_state then in_transition
>    - Use a barrier to ensure target_state is visible before in_transition
>    - The notifier checks in_transition, then uses barrier before reading
>      target_state to ensure proper ordering on weakly-ordered architectures
> 
> The notifier callback:
>    - Returns NOTIFY_DONE for non-overlapping memory (not our concern)
>    - Returns NOTIFY_BAD if in_transition is false (block external ops)
>    - Validates the memory event matches target_state (MEM_GOING_ONLINE
>      for online operations, MEM_GOING_OFFLINE for offline/unplug)
>    - Returns NOTIFY_OK only for driver-initiated operations with matching
>      target_state
> 
> This prevents scenarios where:
>    - Auto-online policies re-online memory the driver is trying to offline

Is this still a problem when using offline_and_remove_memory() ?

>    - Users manually change memory state via /sys/devices/system/memory/

I don't see why we would want to care about that :)

>    - Other kernel subsystems interfere with driver-managed memory state
What do you have in mind?

Not sure if this functionality here is really needed when the driver 
does add+online and offline+remove in a single operation. So please 
elaborate :)

-- 
Cheers

David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ