Re: [PATCH net-next v4 1/4] mm: add a signature in struct page

From: Matthew Wilcox
Date: Tue May 11 2021 - 09:45:56 EST


On Tue, May 11, 2021 at 03:31:15PM +0200, Matteo Croce wrote:
> @@ -101,6 +101,7 @@ struct page {
> * 32-bit architectures.
> */
> unsigned long dma_addr[2];
> + unsigned long signature;
> };
> struct { /* slab, slob and slub */
> union {

No. Signature now aliases with page->mapping, which is going to go
badly wrong for drivers which map this page into userspace.

I had this as:

+ unsigned long pp_magic;
+ unsigned long xmi;
+ unsigned long _pp_mapping_pad;
unsigned long dma_addr[2];

and pp_magic needs to be set to something with bits 0&1 clear and
clearly isn't a pointer. I went with POISON_POINTER_DELTA + 0x40.