public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: enh <enh@google.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>,
	Stafford Horne <shorne@gmail.com>,
	 Adhemerval Zanella <adhemerval.zanella@linaro.org>
Subject: Re: [PATCH 3/6] linux: Implement mremap in C
Date: Thu, 6 Jun 2024 15:38:25 -0400	[thread overview]
Message-ID: <CAJgzZoodO1Q7gF_o+3nXdoJwwrnzqu-CN69oRuVDwbD_hLGgaw@mail.gmail.com> (raw)
In-Reply-To: <CAJgzZoo7EY=d0egecq05GO7sf_rFWKgyrr7a3t7ofWKRxbYh-A@mail.gmail.com>

On Thu, Jun 6, 2024 at 12:01 PM enh <enh@google.com> wrote:
>
> On Thu, Jun 6, 2024 at 11:15 AM Florian Weimer <fweimer@redhat.com> wrote:
> >
> > * Adhemerval Zanella via Libc-alpha:
> >
> > > Variadic function calls in syscalls.list does not work for all ABIs
> > > (for instance where the argument are passed on the stack instead of
> > > registers) and might have underlying issues depending of the variadic
> > > type (for instance if a 64-bit argument is used).
> > >
> > > Checked on x86_64-linux-gnu.
> >
> > Where exactly does this break?
> >
> > If the syscall generator cannot handle pointer arguments, we should fix
> > that.  As far as I can tell, we currently assume that the kernel can
> > handle sign-extended pointers.  I don't see any special code for
> > processing a/p/s pointers, for example.  That impacts far more than just
> > mremap.  These pointers are generally not marked as U, for which we have
> > special processing.
> >
> > Conditional varargs processing for system calls is very bad.  It causes
> > an ongoing maintenance headache, and weird application issues.  For
> > example, Linux 5.7 added MREMAP_DONTUNMAP, and it can use the address
> > argument just like MREMAP_FIXED.  But the current mremap implementation
> > always passes NULL as a system call argument.
>
> yeah, bionic and musl have this same bug, for the same reason of
> having been written before MREMAP_DONTUNMAP was added, and not having
> been updated since.

is it possible to use MREMAP_DONTUNMAP with a destination address
without also setting MREMAP_FIXED? the kernel selftests don't seem to
_test_ that case if so...

the glibc header comment also claims that MREMAP_FIXED is necessary.

> bionic and musl both have a PTRDIFF_MAX check that glibc doesn't have,
> though, so although i think using assembler instead of C would be a
> no-op for glibc, it would be an observable change for bionic and musl
> (albeit only on ILP32).
>
> > Then there's the issue where varargs functions have more stringent ABI
> > requirements than non-varargs functions, as we recently saw with prctl.
> >
> > I think we should just revert this change, to be honest.
> >
> > Thanks,
> > Florian
> >

  reply	other threads:[~2024-06-06 19:38 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-22 18:54 [PATCH 0/6] linux: Some syscall refactors Adhemerval Zanella
2021-11-22 18:54 ` [PATCH 1/6] linux: Add fanotify_mark C implementation Adhemerval Zanella
2021-11-24 21:45   ` Stafford Horne
2021-11-25 12:55     ` Adhemerval Zanella
2021-11-22 18:54 ` [PATCH 2/6] linux: Add prlimit64 " Adhemerval Zanella
2021-11-25 23:39   ` Stafford Horne
2021-11-30 11:51     ` Adhemerval Zanella
2021-11-22 18:54 ` [PATCH 3/6] linux: Implement mremap in C Adhemerval Zanella
2021-11-26  0:26   ` Stafford Horne
2021-11-30 11:55     ` Adhemerval Zanella
2024-06-06 15:15   ` Florian Weimer
2024-06-06 16:01     ` enh
2024-06-06 19:38       ` enh [this message]
2024-06-06 20:26         ` Adhemerval Zanella Netto
2024-06-07  8:40           ` Sam James
2024-06-07  8:51             ` Sam James
2024-06-07  9:06           ` Xi Ruoyao
2021-11-22 18:54 ` [PATCH 4/6] linux: Implement pipe in terms of __NR_pipe2 Adhemerval Zanella
2021-11-26 23:03   ` Stafford Horne
2021-11-30 14:53     ` Adhemerval Zanella
2021-11-22 18:54 ` [PATCH 5/6] linux: Add generic syscall implementation Adhemerval Zanella
2021-11-22 18:54 ` [PATCH 6/6] linux: Add generic ioctl implementation Adhemerval Zanella
2021-12-04  7:50   ` Stafford Horne

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=CAJgzZoodO1Q7gF_o+3nXdoJwwrnzqu-CN69oRuVDwbD_hLGgaw@mail.gmail.com \
    --to=enh@google.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=shorne@gmail.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).