[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 27/53] semihosting: Split out semihost_sys_open
From: |
Luc Michel |
Subject: |
Re: [PATCH v4 27/53] semihosting: Split out semihost_sys_open |
Date: |
Mon, 27 Jun 2022 11:22:02 +0200 |
User-agent: |
Mutt/1.9.4 (2018-02-28) |
On 08:05 Wed 22 Jun , Richard Henderson wrote:
> On 6/22/22 02:35, Luc Michel wrote:
> > On 13:45 Tue 07 Jun , Richard Henderson wrote:
> > > Split out the non-ARM specific portions of SYS_OPEN to a
> > > reusable function. This handles gdb and host file i/o.
> > >
> > > Add helpers to validate the length of the filename string.
> > > Prepare for usage by other semihosting by allowing the
> > > filename length parameter to be 0, and calling strlen.
> > >
> > > Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> > > ---
> > > include/semihosting/syscalls.h | 25 ++++++
> > > semihosting/arm-compat-semi.c | 52 ++---------
> > > semihosting/guestfd.c | 5 ++
> > > semihosting/syscalls.c | 156 +++++++++++++++++++++++++++++++++
> > > semihosting/meson.build | 1 +
> > > 5 files changed, 193 insertions(+), 46 deletions(-)
> > > create mode 100644 include/semihosting/syscalls.h
> > > create mode 100644 semihosting/syscalls.c
> > >
> >
> > [...]
> >
> > > } else {
> > > - hostfd = open(s, open_modeflags[arg1], 0644);
> > > - if (hostfd < 0) {
> > > - ret = -1;
> > > - err = errno;
> > > - } else {
> > > - ret = alloc_guestfd();
> > > - associate_guestfd(ret, hostfd);
> > > - }
> > > + semihost_sys_open(cs, common_semi_cb, arg0, arg2 + 1,
> > > + gdb_open_modeflags[arg1], 0644);
> >
> > You're missing a unlock_user(s, arg0, 0); here
>
> Good catch. Fixed.
With this fixed:
Reviewed-by: Luc Michel <lmichel@kalray.eu>
>
>
> r~
>
>
> To declare a filtering error, please use the following link :
> https://www.security-mail.net/reporter.php?mid=3812.62b32fac.79d6c.0&r=lmichel%40kalray.eu&s=richard.henderson%40linaro.org&o=Re%3A+%5BPATCH+v4+27%2F53%5D+semihosting%3A+Split+out+semihost_sys_open&verdict=C&c=588dc0ed7d12e87bd5846dca36ad4d902888f28e
>
--
- Re: [PATCH v4 15/53] semihosting: Remove GDB_O_BINARY, (continued)
- [PATCH v4 14/53] semihosting: Move common-semi.h to include/semihosting/, Richard Henderson, 2022/06/07
- [PATCH v4 16/53] include/exec: Move gdb open flags to gdbstub.h, Richard Henderson, 2022/06/07
- [PATCH v4 23/53] semihosting: Split out common_semi_has_synccache, Richard Henderson, 2022/06/07
- [PATCH v4 25/53] semihosting: Use env more often in do_common_semihosting, Richard Henderson, 2022/06/07
- [PATCH v4 27/53] semihosting: Split out semihost_sys_open, Richard Henderson, 2022/06/07
- [PATCH v4 31/53] semihosting: Bound length for semihost_sys_{read, write}, Richard Henderson, 2022/06/07
- [PATCH v4 35/53] semihosting: Split out semihost_sys_remove, Richard Henderson, 2022/06/07
- [PATCH v4 37/53] semihosting: Split out semihost_sys_system, Richard Henderson, 2022/06/07
- [PATCH v4 38/53] semihosting: Create semihost_sys_{stat,fstat}, Richard Henderson, 2022/06/07
- [PATCH v4 19/53] gdbstub: Convert GDB error numbers to host error numbers, Richard Henderson, 2022/06/07