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: <CALE4mHrBC-ni3HunRzxRzM8QJDHb=FuJquccum6OcnB4jZ6KbQ@mail.gmail.com>
Date:   Thu, 15 Sep 2022 13:27:01 -0400
From:   Andrew Bresticker <abrestic@...osinc.com>
To:     Conor.Dooley@...rochip.com
Cc:     Palmer Dabbelt <palmer@...belt.com>,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Celeste Liu <coelacanthus@...look.com>,
        dram <dramforever@...e.com>, Ruizhe Pan <c141028@...il.com>,
        linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Atish Kumar Patra <atishp@...osinc.com>
Subject: Re: [PATCH v3 2/2] riscv: Allow PROT_WRITE-only mmap()

On Thu, Sep 15, 2022 at 12:56 PM <Conor.Dooley@...rochip.com> wrote:
>
> On 09/09/2022 22:27, Andrew Bresticker wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >
> > Commit 2139619bcad7 ("riscv: mmap with PROT_WRITE but no PROT_READ is
> > invalid") made mmap() return EINVAL if PROT_WRITE was set wihtout
> > PROT_READ with the justification that a write-only PTE is considered a
> > reserved PTE permission bit pattern in the privileged spec. This check
> > is unnecessary since we let VM_WRITE imply VM_READ on RISC-V, and it is
> > inconsistent with other architectures that don't support write-only PTEs,
> > creating a potential software portability issue. Just remove the check
> > altogether and let PROT_WRITE imply PROT_READ as is the case on other
> > architectures.
> >
> > Note that this also allows PROT_WRITE|PROT_EXEC mappings which were
> > disallowed prior to the aforementioned commit; PROT_READ is implied in
> > such mappings as well.
> >
> > Fixes: 2139619bcad7 ("riscv: mmap with PROT_WRITE but no PROT_READ is invalid")
>
> For the naive members of the audience such as myself, this patch
> came after a non-fixes patch in the series. What is the dependence
> of this patch on the other one (if any)?

This patch is dependent on the first. Happy to re-spin with a "Fixes"
tag on the first patch (or maybe Palmer can add when applying).

-Andrew

> Thanks,
> Conor.
>
> > Reviewed-by: Atish Patra <atishp@...osinc.com>
> > Signed-off-by: Andrew Bresticker <abrestic@...osinc.com>
> > ---
> > v1 -> v2: Update access_error() to account for write-implies-read
> > v2 -> v3: Separate into two commits
> > ---
> >  arch/riscv/kernel/sys_riscv.c | 3 ---
> >  1 file changed, 3 deletions(-)
> >
> > diff --git a/arch/riscv/kernel/sys_riscv.c b/arch/riscv/kernel/sys_riscv.c
> > index 571556bb9261..5d3f2fbeb33c 100644
> > --- a/arch/riscv/kernel/sys_riscv.c
> > +++ b/arch/riscv/kernel/sys_riscv.c
> > @@ -18,9 +18,6 @@ static long riscv_sys_mmap(unsigned long addr, unsigned long len,
> >         if (unlikely(offset & (~PAGE_MASK >> page_shift_offset)))
> >                 return -EINVAL;
> >
> > -       if (unlikely((prot & PROT_WRITE) && !(prot & PROT_READ)))
> > -               return -EINVAL;
> > -
> >         return ksys_mmap_pgoff(addr, len, prot, flags, fd,
> >                                offset >> (PAGE_SHIFT - page_shift_offset));
> >  }
> > --
> > 2.25.1
> >
> >
> > _______________________________________________
> > linux-riscv mailing list
> > linux-riscv@...ts.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-riscv
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ