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: <Z5NOWvrOln4T0RCH@li-008a6a4c-3549-11b2-a85c-c5cc2836eea2.ibm.com>
Date: Fri, 24 Jan 2025 09:24:58 +0100
From: Alexander Gordeev <agordeev@...ux.ibm.com>
To: Kevin Brodsky <kevin.brodsky@....com>
Cc: Qi Zheng <zhengqi.arch@...edance.com>,
        Gerald Schaefer <gerald.schaefer@...ux.ibm.com>,
        Heiko Carstens <hca@...ux.ibm.com>, linux-mm@...ck.org,
        linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] s390/mm: Add missing ctor/dtor on page table upgrade

On Fri, Jan 24, 2025 at 08:58:07AM +0100, Kevin Brodsky wrote:

Kevin,
...
> Thank you for putting together this patch! I was completely unaware of
> this "upgrade" path on s390.
...
> > diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c
> > index a4e761902093..d33f55b7ee98 100644
> > --- a/arch/s390/mm/pgalloc.c
> > +++ b/arch/s390/mm/pgalloc.c
> > @@ -88,12 +88,14 @@ int crst_table_upgrade(struct mm_struct *mm, unsigned long end)
> >  		if (unlikely(!p4d))
> >  			goto err_p4d;
> >  		crst_table_init(p4d, _REGION2_ENTRY_EMPTY);
> > +		pagetable_p4d_ctor(virt_to_ptdesc(p4d));
> 
> This block seems to be equivalent to p4d_alloc_one(), maybe it would be
> preferable to just call p4d_alloc_one() here to avoid further mismatches
> in the future (and reduce duplication)?

Yes, I wanted to do exactly that (together with p4d_free() you noticed),
but then the whole thing with open coded pagetable_pgd_ctor() below gets
inconsistent. I would prefer to keep it this way as of now.

> >  	}
> >  	if (end > _REGION1_SIZE) {
> >  		pgd = crst_table_alloc(mm);
> >  		if (unlikely(!pgd))
> >  			goto err_pgd;
> >  		crst_table_init(pgd, _REGION1_ENTRY_EMPTY);
> > +		pagetable_pgd_ctor(virt_to_ptdesc(pgd));
> 
> I was hoping this might be equivalent to pgd_alloc() but it does not
> include a call to crst_table_init(). Since adding it would be apparently
> undesirable (having read the other thread), it seems reasonable to add
> the explicit constructor call.

We were thinking about a follow-up cleanup that addresses it all, but this
patch is a targeted fix to catch up your and Qi Zheng series in the still
open merge window.

> >  	}
> >  
> >  	spin_lock_bh(&mm->page_table_lock);
> > @@ -130,6 +132,7 @@ int crst_table_upgrade(struct mm_struct *mm, unsigned long end)
> >  	return 0;
> >  
> >  err_pgd:
> > +	pagetable_dtor(virt_to_ptdesc(p4d));
> >  	crst_table_free(mm, p4d);
> 
> Similarly, this could be a call to p4d_free().
> 
> - Kevin
> 
> >  err_p4d:
> >  	return -ENOMEM;

Thanks for the review!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ