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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZNZPLTky6IZ47n4l@arm.com>
Date:   Fri, 11 Aug 2023 16:09:33 +0100
From:   Catalin Marinas <catalin.marinas@....com>
To:     Mark Brown <broonie@...nel.org>
Cc:     Will Deacon <will@...nel.org>, Jonathan Corbet <corbet@....net>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Marc Zyngier <maz@...nel.org>,
        Oliver Upton <oliver.upton@...ux.dev>,
        James Morse <james.morse@....com>,
        Suzuki K Poulose <suzuki.poulose@....com>,
        Arnd Bergmann <arnd@...db.de>, Oleg Nesterov <oleg@...hat.com>,
        Eric Biederman <ebiederm@...ssion.com>,
        Kees Cook <keescook@...omium.org>,
        Shuah Khan <shuah@...nel.org>,
        "Rick P. Edgecombe" <rick.p.edgecombe@...el.com>,
        Deepak Gupta <debug@...osinc.com>,
        Ard Biesheuvel <ardb@...nel.org>,
        Szabolcs Nagy <Szabolcs.Nagy@....com>,
        "H.J. Lu" <hjl.tools@...il.com>,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Palmer Dabbelt <palmer@...belt.com>,
        Albert Ou <aou@...s.berkeley.edu>,
        linux-arm-kernel@...ts.infradead.org, linux-doc@...r.kernel.org,
        kvmarm@...ts.linux.dev, linux-fsdevel@...r.kernel.org,
        linux-arch@...r.kernel.org, linux-mm@...ck.org,
        linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-riscv@...ts.infradead.org
Subject: Re: [PATCH v4 17/36] arm64/mm: Handle GCS data aborts

On Mon, Aug 07, 2023 at 11:00:22PM +0100, Mark Brown wrote:
> @@ -510,6 +527,26 @@ static vm_fault_t __do_page_fault(struct mm_struct *mm,
>  	 */
>  	if (!(vma->vm_flags & vm_flags))
>  		return VM_FAULT_BADACCESS;
> +
> +	if (vma->vm_flags & VM_SHADOW_STACK) {
> +		/*
> +		 * Writes to a GCS must either be generated by a GCS
> +		 * operation or be from EL1.
> +		 */
> +		if (is_write_abort(esr) &&
> +		    !(is_gcs_fault(esr) || is_el1_data_abort(esr)))
> +			return VM_FAULT_BADACCESS;

Related to my PIE permissions comment: when do we have a valid EL1 data
write abort that's not a GCS fault? Does a faulting GCSSTTR set the
ESR_ELx_GCS bit?

> +	} else {
> +		/*
> +		 * GCS faults should never happen for pages that are
> +		 * not part of a GCS and the operation being attempted
> +		 * can never succeed.
> +		 */
> +		if (is_gcs_fault(esr))
> +			return VM_FAULT_BADACCESS;

If one does a GCS push/store to a non-GCS page, do we get a GCS fault or
something else? I couldn't figure out from the engineering spec. If the
hardware doesn't generate such exceptions, we might as well remove this
'else' branch. But maybe it does generate a GCS-specific fault as you
added a similar check in is_invalid_el0_gcs_access().

> @@ -595,6 +644,19 @@ static int __kprobes do_page_fault(unsigned long far, unsigned long esr,
>  	if (!vma)
>  		goto lock_mmap;
>  
> +	/*
> +	 * We get legitimate write faults for GCS pages from GCS
> +	 * operations and from EL1 writes to EL0 pages but just plain

What are the EL1 writes to the shadow stack? Would it not use
copy_to_user_gcs()?

-- 
Catalin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ