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] [day] [month] [year] [list]
Date:   Tue, 7 Dec 2021 10:50:36 +0000
From:   Catalin Marinas <catalin.marinas@....com>
To:     Yunfeng Ye <yeyunfeng@...wei.com>
Cc:     will@...nel.org, wangkefeng.wang@...wei.com,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        wuxu.wu@...wei.com, Hewenliang <hewenliang4@...wei.com>
Subject: Re: [PATCH] arm64: mm: Use asid2idx() and asid feature macro for
 cleanup

On Tue, Dec 07, 2021 at 10:21:26AM +0800, Yunfeng Ye wrote:
> On 2021/12/7 0:23, Catalin Marinas wrote:
> > On Thu, Oct 28, 2021 at 08:27:23PM +0800, Yunfeng Ye wrote:
> >> @@ -162,7 +162,7 @@ static u64 new_context(struct mm_struct *mm)
> >>  	u64 generation = atomic64_read(&asid_generation);
> >>
> >>  	if (asid != 0) {
> >> -		u64 newasid = generation | (asid & ~ASID_MASK);
> >> +		u64 newasid = generation | asid2idx(asid);
> >>
> >>  		/*
> >>  		 * If our current ASID was active during a rollover, we
> >> @@ -306,7 +306,7 @@ unsigned long arm64_mm_context_get(struct mm_struct *mm)
> >>  out_unlock:
> >>  	raw_spin_unlock_irqrestore(&cpu_asid_lock, flags);
> >>
> >> -	asid &= ~ASID_MASK;
> >> +	asid = asid2idx(asid);
> > 
> > While functionally the code is the same, I don't think this was the
> > intention of asid2idx(). It's meant to provide an index into asid_map,
> > while the ASID_MASK lines isolate the asid number and add a new
> > generation to it.
> 
> The commit 0c8ea531b774 ("arm64: mm: Allocate ASIDs in pairs") introduce the
> asid2idx and idx2asid macro, but these macros is not really useful after the
> commit f88f42f853a8 ("arm64: context: Free up kernel ASIDs if KPTI is not in use").
> 
> I think "(asid & ~ASID_MASK)" can be instead by a macro, it is the same code with
> asid2idx(). Can it be renamed?  (eg, ctxid2asid)

Yes, that would work.

-- 
Catalin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ