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:   Fri, 28 Apr 2023 14:00:04 +0900
From:   sangsup lee <k1rh4.lee@...il.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
        Amol Maheshwari <amahesh@....qualcomm.com>,
        Arnd Bergmann <arnd@...db.de>, linux-arm-msm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] misc: fastrpc: Fix a Use after-free-bug by race condition

I apologize for recognizing the email in the TOP POST format. I missed
the comment in the previous email.

2023년 4월 27일 (목) 오후 6:52, Greg Kroah-Hartman <gregkh@...uxfoundation.org>님이 작성:
>
> On Thu, Apr 27, 2023 at 06:29:16PM +0900, sangsup lee wrote:
> > Is there any comment for this issue?
>
> What issue?
>
> > (reference: https://www.spinics.net/lists/kernel/msg4731408.html)
>
> Please use lore.kernel.org links, we have no control over any other
> random email archive .
>
> And the above link just points to this proposed patch.
>
> >
> >
> > 2023년 3월 23일 (목) 오전 10:37, Sangsup Lee <k1rh4.lee@...il.com>님이 작성:
> > >
> > > From: Sangsup lee <k1rh4.lee@...il.com>
> > >
> > > This patch adds mutex_lock for fixing an Use-after-free bug.
> > > fastrpc_req_munmap_impl can be called concurrently in multi-threded environments.
> > > The buf which is allocated by list_for_each_safe can be used after another thread frees it.
>
> How was this tested?
>

I was unable to configure the environment in which this code is running.
Therefore, I could not go through dynamic testing for the related issue.
However, I found vulnerabilities in similar types of functions
in other drivers in the mobile environment, so I think this code is
also problematic.

> > >
> > > Signed-off-by: Sangsup lee <k1rh4.lee@...il.com>
> > > ---
> > >  V1 -> V2: moving the locking to ioctl.
> > >
> > >  drivers/misc/fastrpc.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> > > index 93ebd174d848..aa1cf0e9f4ed 100644
> > > --- a/drivers/misc/fastrpc.c
> > > +++ b/drivers/misc/fastrpc.c
> > > @@ -1901,7 +1901,9 @@ static long fastrpc_device_ioctl(struct file *file, unsigned int cmd,
> > >                 err = fastrpc_req_mmap(fl, argp);
> > >                 break;
> > >         case FASTRPC_IOCTL_MUNMAP:
> > > +               mutex_lock(&fl->mutex);
> > >                 err = fastrpc_req_munmap(fl, argp);
> > > +               mutex_unlock(&fl->mutex);
>
> Are you sure you can call this function with the lock?  If so, why isn't
> the mmap ioctl also locked?

I am convinced that FASTRPC_IOCTL_MUNMAP can lead to a race condition bug.
However, as I mentioned in patch v1, I am not an expert in fastrpc.
I worried about the side effects of the code I suggested.
So, I asked you to recommend which code to use, and this is the code
that was recommended to me.
And I didn't check the mmap function because I couldn't find a bug in mmap.

>
> thanks,
>
> greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ