linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Zhangjin Wu <falcon@tinylab.org>
To: w@1wt.eu
Cc: arnd@arndb.de, david.laight@aculab.com, falcon@tinylab.org,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-riscv@lists.infradead.org, thomas@t-8ch.de
Subject: Re: [PATCH v6 13/15] selftests/nolibc: add mmap_bad test case
Date: Mon, 10 Jul 2023 02:33:22 +0800	[thread overview]
Message-ID: <20230709183322.96859-1-falcon@tinylab.org> (raw)
In-Reply-To: <20230709091547.GD9321@1wt.eu>

Hi, Willy

> On Fri, Jul 07, 2023 at 11:05:49PM +0800, Zhangjin Wu wrote:
> > The length argument of mmap() must be greater than 0, passing a zero
> > length argument expects failure with -EINVAL.
> 
> This one doesn't work for me on x86_64 kernel 5.15.112, qemu userland:
> 
>   46 mmap_bad = <0x0> EEXIST  != (<0xffffffffffffffff> EINVAL)    [FAIL]
>

Just rerun 'run-user' on x86_64 with kernel 5.11.0-41-generic, it is ok.

The failure is very interesting, and also rechecked the kernel mmap code:

    unsigned long do_mmap(struct file *file, unsigned long addr,
                        unsigned long len, unsigned long prot,
                        unsigned long flags, unsigned long pgoff,
                        unsigned long *populate, struct list_head *uf)
    {
        ...
        if (!len)
                return -EINVAL; 
        ...
    }

    $ git blame -L 1202,1202 mm/mmap.c
    e37609bb36f70 (Piotr Kwapulinski 2015-06-24 16:58:39 -0700 1202)        if (!len)

    $ git show e37609bb36f706c954e82e580e2e790e9d5caef8:Makefile 
    VERSION = 4
    PATCHLEVEL = 1
    SUBLEVEL = 0
    EXTRAVERSION =

So, the kernel side should be ok from v4.1?

For qemu-user, I have rechecked the following version:

    $ qemu-x86_64 --version
    qemu-x86_64 version 4.2.1 (Debian 1:4.2-3ubuntu6.18)

    $ qemu-x86_64 --version
    qemu-x86_64 version 7.0.0 (Debian 1:7.0+dfsg-7ubuntu2.6~backport20.04.202306190332~ubuntu20.04.1)

    $ build/x86_64/pc/qemu/v8.0.2/qemu-x86_64 --version
    qemu-x86_64 version 8.0.2 (v8.0.2-dirty)

all of them work well, as a comparison, what's your qemu-user version?

> This EEXIST actually is the errno from the previous test. If I run
> the test natively it's OK:
> 
>   $ ./nolibc-test syscall:46
>   Running test 'syscall'
>   46 mmap_bad = <0xffffffffffffffff> EINVAL                        [OK]
>   Errors during this test: 0
> 
> I'll queue it anyway for now but it would be nice that we figure what's
> happening (even if we need to adjust or drop the test if it's a false
> positive) so that we don't get used to "ah this is a normal error".
>

Yes, if there is a failure, we should figure out why. It is ok for me to remove
this one or let's find another errno condition before we find the root cause of
the reported failure. 

Thanks,
Zhangjin
 
> Willy

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2023-07-09 18:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-07 14:49 [PATCH v6 00/15] tools/nolibc: add a new syscall helper Zhangjin Wu
2023-07-07 14:50 ` [PATCH v6 01/15] tools/nolibc: arch-*.h: fix up code indent errors Zhangjin Wu
2023-07-09  9:17   ` Willy Tarreau
2023-07-07 14:52 ` [PATCH v6 02/15] toolc/nolibc: arch-*.h: clean up whitespaces after __asm__ Zhangjin Wu
2023-07-07 14:53 ` [PATCH v6 03/15] tools/nolibc: arch-loongarch.h: shrink with _NOLIBC_SYSCALL_CLOBBERLIST Zhangjin Wu
2023-07-07 14:54 ` [PATCH v6 04/15] tools/nolibc: arch-mips.h: " Zhangjin Wu
2023-07-07 14:55 ` [PATCH v6 05/15] tools/nolibc: add missing my_syscall6() for mips Zhangjin Wu
2023-07-07 14:56 ` [PATCH v6 06/15] tools/nolibc: __sysret: support syscalls who return a pointer Zhangjin Wu
2023-07-07 14:58 ` [PATCH v6 07/15] tools/nolibc: clean up mmap() routine Zhangjin Wu
2023-07-07 14:59 ` [PATCH v6 08/15] tools/nolibc: clean up sbrk() routine Zhangjin Wu
2023-07-07 15:01 ` [PATCH v6 09/15] selftests/nolibc: export argv0 for some tests Zhangjin Wu
2023-07-07 15:02 ` [PATCH v6 10/15] selftests/nolibc: prepare: create /dev/zero Zhangjin Wu
2023-07-07 15:03 ` [PATCH v6 11/15] selftests/nolibc: add EXPECT_PTREQ, EXPECT_PTRNE and EXPECT_PTRER Zhangjin Wu
2023-07-07 15:04 ` [PATCH v6 12/15] selftests/nolibc: add sbrk_0 to test current brk getting Zhangjin Wu
2023-07-07 15:05 ` [PATCH v6 13/15] selftests/nolibc: add mmap_bad test case Zhangjin Wu
2023-07-09  9:15   ` Willy Tarreau
2023-07-09 18:33     ` Zhangjin Wu [this message]
2023-07-10  7:04       ` Willy Tarreau
2023-07-07 15:07 ` [PATCH v6 14/15] selftests/nolibc: add munmap_bad " Zhangjin Wu
2023-07-07 15:08 ` [PATCH v6 15/15] selftests/nolibc: add mmap_munmap_good " Zhangjin Wu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230709183322.96859-1-falcon@tinylab.org \
    --to=falcon@tinylab.org \
    --cc=arnd@arndb.de \
    --cc=david.laight@aculab.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=thomas@t-8ch.de \
    --cc=w@1wt.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).