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-next>] [day] [month] [year] [list]
Message-ID: <CALGdzuoubbra4xKOJcsyThdk5Y1BrAmZs==wbqjbkAgmKS39Aw@mail.gmail.com>
Date: Tue, 12 Mar 2024 09:43:50 -0500
From: Chenyuan Yang <chenyuan0y@...il.com>
To: Kai.Makisara@...umbus.fi, jejb@...ux.ibm.com, martin.petersen@...cle.com, 
	linux-scsi@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Zijie Zhao <zzjas98@...il.com>
Subject: [drivers/scsi] Question about `st_setup`

Dear Linux Developers for SCSI Driver,

We are curious about the functionality of `st_setup`
(https://elixir.bootlin.com/linux/latest/source/drivers/scsi/st.c#L4102).

```
static int __init st_setup(char *str)
{
  int i, len, ints[5];
  char *stp;

  stp = get_options(str, ARRAY_SIZE(ints), ints);

  if (ints[0] > 0) {
    for (i = 0; i < ints[0] && i < ARRAY_SIZE(parms); i++)
    if (parms[i].val)
      *parms[i].val = ints[i + 1];
  }
  ...
}
```

For this function, we are trying to understand how it works but not
sure whether it would be an out-of-bound read.

The length of both `ints` and `parms` is 5 (the latterdefined at
https://elixir.bootlin.com/linux/latest/source/drivers/scsi/st.c#L125).
Thus, when `ints[0]` is 5, we could assign `ints[5]`
(out-of-bound-read) to `parms[4].val`. Based on our understanding of
the `get_options` function
(https://elixir.bootlin.com/linux/latest/source/lib/cmdline.c#L107),
it could be possible that `ints[0] == 5`, where the first element of
`ints` indicates the number of parsed options. Hence, it is possible
to do
a out-of-bound read once `debug_flag` is enabled (to pass `if
(parms[i].val)`).

Please correct us if we miss some key prerequisites for this function
or the data structure.
Thanks in advance!

Based on our understanding, the possible fix could be
```
int i, len, ints[6];
```
which allocates `len(parms) + 1` for `ints`.

Best,
Chenyuan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ