[LTP] [PATCH] ioctl_loop06: no validate block size
Li Wang
liwang@redhat.com
Mon Aug 26 14:49:59 CEST 2024
On Mon, Aug 26, 2024 at 8:45 PM Jan Stancek <jstancek@redhat.com> wrote:
> On Mon, Aug 26, 2024 at 2:02 PM Li Wang <liwang@redhat.com> wrote:
> >
> > Since commit 9423c653fe6110 ("loop: Don't bother validating blocksize")
> kernel
>
> This commit above says "The block queue limits validation does this
> for us now.",
> shouldn't that still catch the errors?
>
Yes, I overlooked that before, after removing the blk_validate_block_size()
from
kernel side, test ioctl_loop06 always failed on ppc64le/aarch64.
Weirdly, x86_64 and s390x work well. I guess it's probably a kernel new bug.
> > drop validating blocksize for both loop_configure and
> loop_set_block_size so
> > that set large block size succeeds.
> >
> > Error log:
> > 12 ioctl_loop06.c:76: TINFO: Using LOOP_SET_BLOCK_SIZE with arg >
> PAGE_SIZE
> > 13 ioctl_loop06.c:59: TFAIL: Set block size succeed unexpectedly
> > ...
> > 18 ioctl_loop06.c:76: TINFO: Using LOOP_CONFIGURE with block_size >
> PAGE_SIZE
> > 19 ioctl_loop06.c:59: TFAIL: Set block size succeed unexpectedly
> >
> > Signed-off-by: Li Wang <liwang@redhat.com>
> > ---
> > testcases/kernel/syscalls/ioctl/ioctl_loop06.c | 9 +++++++++
> > 1 file changed, 9 insertions(+)
> >
> > diff --git a/testcases/kernel/syscalls/ioctl/ioctl_loop06.c
> b/testcases/kernel/syscalls/ioctl/ioctl_loop06.c
> > index 317f693a0..4aacd284a 100644
> > --- a/testcases/kernel/syscalls/ioctl/ioctl_loop06.c
> > +++ b/testcases/kernel/syscalls/ioctl/ioctl_loop06.c
> > @@ -23,6 +23,7 @@ static char dev_path[1024];
> > static int dev_num, dev_fd, file_fd, attach_flag, loop_configure_sup =
> 1;
> > static unsigned int invalid_value, half_value, unalign_value;
> > static struct loop_config loopconfig;
> > +static int novalidate_blocksize = 0;
> >
> > static struct tcase {
> > unsigned int *setvalue;
> > @@ -74,6 +75,11 @@ static void run(unsigned int n)
> > struct tcase *tc = &tcases[n];
> >
> > tst_res(TINFO, "%s", tc->message);
> > + if ((*(tc->setvalue) == invalid_value) && novalidate_blocksize) {
> > + tst_res(TCONF, "Kernel doesn't validate block size, skip
> invalid value test");
> > + return;
> > + }
> > +
> > if (tc->ioctl_flag == LOOP_SET_BLOCK_SIZE) {
> > if (!attach_flag) {
> > tst_attach_device(dev_path, "test.img");
> > @@ -126,6 +132,9 @@ static void setup(void)
> > return;
> > }
> > loopconfig.fd = file_fd;
> > +
> > + if ((tst_kvercmp(6, 11, 0)) >= 0)
> > + novalidate_blocksize = 1;
> > }
> >
> > static void cleanup(void)
> > --
> > 2.46.0
> >
>
>
--
Regards,
Li Wang
More information about the ltp
mailing list