From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9D5ACC433EF for ; Mon, 31 Jan 2022 22:28:30 +0000 (UTC) Received: from localhost ([::1]:55418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nEf9x-0000Ps-8m for qemu-devel@archiver.kernel.org; Mon, 31 Jan 2022 17:28:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48520) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEf8Z-00085X-RS for qemu-devel@nongnu.org; Mon, 31 Jan 2022 17:27:03 -0500 Received: from [2a00:1450:4864:20::131] (port=45762 helo=mail-lf1-x131.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nEf8X-00086A-7A for qemu-devel@nongnu.org; Mon, 31 Jan 2022 17:27:03 -0500 Received: by mail-lf1-x131.google.com with SMTP id o12so29860072lfg.12 for ; Mon, 31 Jan 2022 14:27:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zZEXMDHhKolNCTzYWufa6k24RvHx5Ur8lMDuaS9w0fY=; b=Mb1ECfPwuv75h5irw84d2VtPfEFg+m8QjnB9RsIk8DG9sI2l0iwbAD3SFDeYHfUx7k yAUpO6j62KJNGp1TeWIOG0Btv6lafh0eXOUZxwxbPAicrGRa/EyBf7kQLsACA0iLz8q1 K60Y4MuyFjzbe7mCBtSGvlvb3ZrWnYmvJ+9THipqS4eXwWF6Nk4pJ5dljWksh6Of154C GdQnhxpZVTXHbrVurqbqTLlbe2dKTw2RfrBj1l9SZZJebIupBFsA1ZFw34c92rVAsyAF hYCtY53vKQcWNyCgCgTM+a3in+IVHLrNh6OUz9as0aGvtRqHFK1JR+nWEExZbuK60TO2 MFyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zZEXMDHhKolNCTzYWufa6k24RvHx5Ur8lMDuaS9w0fY=; b=DHVT3c6lFg4GU99NwcEsx1IPuAwpVqBGn07KkZS8j78uHWFo4e5j+OIx1fTuF7AM4q l0LTTJNkzHVgdheJ6IgPhvFxHXgKUhMOTafILmfCiJ6P0vyGWKFmYUD7afshMJz7Pnpi Y5y8KXb1hr0GPDadbaBbinc02k1/mITONBw8Kxc8BpkLBF3YLh1Qca6ETGmfWuBr7XAC oMbdMYi27flqyAiRjaP+VueM0oTtAk0rymTrUvBMYmgWztdO8rFAAasMBorhmgf8AnI+ 774XSLvJJMh9HbgU9kDqKj7t8H0dGqUdyFhyhlSeUHc3qduspQcCmmi+/7PqGj8cDfy4 hnHw== X-Gm-Message-State: AOAM5306pTEFbleCTTTKGdlXw1i28WbOdWu1JhrYa9sO41Ud+UNlVP7x N7q17hE1O+/rtf8MK/mzPUcPz6C54FY2pQbpEIE= X-Google-Smtp-Source: ABdhPJxpYYfv/Lq+T1I12g2SVIDc02EVwIX4mq2jfmG1LTiues4b3IffWVAl30BNDcmS0p+4nYcxN3L2CRGdPtMYK78= X-Received: by 2002:a05:6512:2243:: with SMTP id i3mr14659706lfu.598.1643668018224; Mon, 31 Jan 2022 14:26:58 -0800 (PST) MIME-Version: 1.0 References: <20211122004913.20052-1-wwcohen@gmail.com> <3039867.d4g7DdiYNH@silver> <1868804.s9PD02ncGZ@silver> In-Reply-To: From: Will Cohen Date: Mon, 31 Jan 2022 17:26:46 -0500 Message-ID: Subject: Re: [PATCH v2 10/11] 9p: darwin: Implement compatibility for mknodat To: Christian Schoenebeck Content-Type: multipart/alternative; boundary="0000000000005ae10805d6e8482a" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::131 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::131; envelope-from=wwcohen@gmail.com; helo=mail-lf1-x131.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Keno Fischer , Michael Roitzsch , qemu-devel@nongnu.org, hi@alyssa.is, Greg Kurz Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --0000000000005ae10805d6e8482a Content-Type: text/plain; charset="UTF-8" Upon further review, it looks like since 10.12 there's actually a (not-heavily-documented) function that wraps this syscall and avoids the need to call the private syscall directly: https://opensource.apple.com/source/libpthread/libpthread-218.51.1/src/pthread_cwd.c.auto.html. Chromium uses it too ( https://chromium.googlesource.com/chromium/src/+/lkgr/base/process/launch_mac.cc#110) -- given that we're not looking for pre-10.12 compatibility, I'm a little less worried about the workaround breaking in the future if this wrapper gets used instead. Would it work to change to pthread_fchdir_np, remove all the syscall discussion in the comment, and add a meson check for pthread_fchdir_np as a prereq for virtfs on darwin? On Fri, Jan 28, 2022 at 1:28 PM Will Cohen wrote: > Understood. Since I cannot find the original number, I have submitted a > new report at rdar://FB9862426 ( > https://openradar.appspot.com/FB9862426). > > I'll note that and work on a testcase/error message for v4. > > Many thanks, > Will > > On Fri, Jan 28, 2022 at 10:15 AM Christian Schoenebeck < > qemu_oss@crudebyte.com> wrote: > >> On Donnerstag, 27. Januar 2022 22:47:54 CET Will Cohen wrote: >> > Back when this was being proposed, the original proposer did file such a >> > report to Apple, but we're still in this situation! >> >> Ok, but still, do you find it appropriate to just blindly use a private >> syscall that may or may not exist or might change its behaviour at any >> time >> without a user being aware? >> >> I am not opposed to using workarounds at all, but what I worry about is >> that >> Apple might change this in whatever way at any time, and as this sycall >> is >> currently not guarded in this patch at all, we might one day receive bug >> reports by macOS users with symptoms that might not immediately be >> obvious to >> relate to this being the root cause. >> >> Options that would come to my mind: >> - a test case for this syscall >> - a clear runtime error message for ordinary users >> >> Is there a rdar or FB number for the report on Apple's side? >> >> > Replacing clang with gcc in v3. >> > >> > On Wed, Nov 24, 2021 at 12:20 PM Christian Schoenebeck < >> > >> > qemu_oss@crudebyte.com> wrote: >> > > On Montag, 22. November 2021 01:49:12 CET Will Cohen wrote: >> > > > From: Keno Fischer >> > > > >> > > > Darwin does not support mknodat. However, to avoid race conditions >> > > > with later setting the permissions, we must avoid using mknod on >> > > > the full path instead. We could try to fchdir, but that would cause >> > > > problems if multiple threads try to call mknodat at the same time. >> > > > However, luckily there is a solution: Darwin as an (unexposed in the >> > > > C library) system call that sets the cwd for the current thread >> only. >> > > > This should suffice to use mknod safely. >> > > > >> > > > Signed-off-by: Keno Fischer >> > > > Signed-off-by: Michael Roitzsch >> > > > [Will Cohen: - Adjust coding style] >> > > > Signed-off-by: Will Cohen >> > > > --- >> > > > >> > > > hw/9pfs/9p-local.c | 5 +++-- >> > > > hw/9pfs/9p-util-darwin.c | 33 +++++++++++++++++++++++++++++++++ >> > > > hw/9pfs/9p-util-linux.c | 5 +++++ >> > > > hw/9pfs/9p-util.h | 2 ++ >> > > > 4 files changed, 43 insertions(+), 2 deletions(-) >> > > > >> > > > diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c >> > > > index 4268703d05..42b65e143b 100644 >> > > > --- a/hw/9pfs/9p-local.c >> > > > +++ b/hw/9pfs/9p-local.c >> > > > @@ -673,7 +673,7 @@ static int local_mknod(FsContext *fs_ctx, >> V9fsPath >> > > > *dir_path, >> > > > >> > > > if (fs_ctx->export_flags & V9FS_SM_MAPPED || >> > > > >> > > > fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) { >> > > > >> > > > - err = mknodat(dirfd, name, fs_ctx->fmode | S_IFREG, 0); >> > > > + err = qemu_mknodat(dirfd, name, fs_ctx->fmode | S_IFREG, >> 0); >> > > > >> > > > if (err == -1) { >> > > > >> > > > goto out; >> > > > >> > > > } >> > > > >> > > > @@ -688,7 +688,7 @@ static int local_mknod(FsContext *fs_ctx, >> V9fsPath >> > > > *dir_path, } >> > > > >> > > > } else if (fs_ctx->export_flags & V9FS_SM_PASSTHROUGH || >> > > > >> > > > fs_ctx->export_flags & V9FS_SM_NONE) { >> > > > >> > > > - err = mknodat(dirfd, name, credp->fc_mode, credp->fc_rdev); >> > > > + err = qemu_mknodat(dirfd, name, credp->fc_mode, >> > > > credp->fc_rdev); >> > > > >> > > > if (err == -1) { >> > > > >> > > > goto out; >> > > > >> > > > } >> > > > >> > > > @@ -701,6 +701,7 @@ static int local_mknod(FsContext *fs_ctx, >> V9fsPath >> > > > *dir_path, >> > > > >> > > > err_end: >> > > > unlinkat_preserve_errno(dirfd, name, 0); >> > > > >> > > > + >> > > > >> > > > out: >> > > > close_preserve_errno(dirfd); >> > > > return err; >> > > > >> > > > diff --git a/hw/9pfs/9p-util-darwin.c b/hw/9pfs/9p-util-darwin.c >> > > > index ac414bcbfd..25e67d5067 100644 >> > > > --- a/hw/9pfs/9p-util-darwin.c >> > > > +++ b/hw/9pfs/9p-util-darwin.c >> > > > >> > > > @@ -158,3 +158,36 @@ done: >> > > > close_preserve_errno(fd); >> > > > return ret; >> > > > >> > > > } >> > > > >> > > > + >> > > > +#ifndef SYS___pthread_fchdir >> > > > +# define SYS___pthread_fchdir 349 >> > > > +#endif >> > > > + >> > > > +/* >> > > > + * This is an undocumented OS X syscall. It would be best to avoid >> it, >> > > > + * but there doesn't seem to be another safe way to implement >> mknodat. >> > > > + * Dear Apple, please implement mknodat before you remove this >> syscall. >> > > > + */ >> > > > +static int fchdir_thread_local(int fd) >> > > >> > > Hooo, that's a brave move. Shouldn't its future and likely becoming >> > > absence be >> > > guarded "somehow"? :) >> > > >> > > BTW it might make sense to file a report instead of hoping Apple will >> just >> > > read this comment: ;-) >> > > https://feedbackassistant.apple.com/ >> > > >> > > > +{ >> > > > +#pragma clang diagnostic push >> > > > +#pragma clang diagnostic ignored "-Wdeprecated-declarations" >> > > > + return syscall(SYS___pthread_fchdir, fd); >> > > > +#pragma clang diagnostic pop >> > > > +} >> > > >> > > Consider s/clang/GCC/ then it would also work with GCC. In the end >> most >> > > people >> > > probably just use clang on macOS anyway, but just saying. >> > > >> > > > + >> > > > +int qemu_mknodat(int dirfd, const char *filename, mode_t mode, >> dev_t >> > > >> > > dev) >> > > >> > > > +{ >> > > > + int preserved_errno, err; >> > > > + if (fchdir_thread_local(dirfd) < 0) { >> > > > + return -1; >> > > > + } >> > > > + err = mknod(filename, mode, dev); >> > > > + preserved_errno = errno; >> > > > + /* Stop using the thread-local cwd */ >> > > > + fchdir_thread_local(-1); >> > > > + if (err < 0) { >> > > > + errno = preserved_errno; >> > > > + } >> > > > + return err; >> > > > +} >> > > > diff --git a/hw/9pfs/9p-util-linux.c b/hw/9pfs/9p-util-linux.c >> > > > index d54bf57a59..4f57d8c047 100644 >> > > > --- a/hw/9pfs/9p-util-linux.c >> > > > +++ b/hw/9pfs/9p-util-linux.c >> > > > @@ -68,3 +68,8 @@ int utimensat_nofollow(int dirfd, const char >> > > > *filename, >> > > > >> > > > { >> > > > >> > > > return utimensat(dirfd, filename, times, AT_SYMLINK_NOFOLLOW); >> > > > >> > > > } >> > > > >> > > > + >> > > > +int qemu_mknodat(int dirfd, const char *filename, mode_t mode, >> dev_t >> > > >> > > dev) >> > > >> > > > +{ >> > > > + return mknodat(dirfd, filename, mode, dev); >> > > > +} >> > > > diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h >> > > > index 1c477a0e66..cac682d335 100644 >> > > > --- a/hw/9pfs/9p-util.h >> > > > +++ b/hw/9pfs/9p-util.h >> > > > @@ -105,4 +105,6 @@ ssize_t fremovexattrat_nofollow(int dirfd, const >> > > > char >> > > > *filename, int utimensat_nofollow(int dirfd, const char *filename, >> > > > >> > > > const struct timespec times[2]); >> > > > >> > > > +int qemu_mknodat(int dirfd, const char *filename, mode_t mode, >> dev_t >> > > >> > > dev); >> > > >> > > > + >> > > > >> > > > #endif >> >> >> Best regards, >> Christian Schoenebeck >> >> >> --0000000000005ae10805d6e8482a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Upon further review, it looks like since 10.12 there&= #39;s actually a (not-heavily-documented) function that wraps this syscall = and avoids the need to call the private syscall directly: https://opensource.apple.com/source/libpthread/libpthread-21= 8.51.1/src/pthread_cwd.c.auto.html. Chromium uses it too (https://chromium.googlesource.com/chromium/src/+/lkgr/base/process= /launch_mac.cc#110) -- given that we're not looking for pre-10.12 c= ompatibility, I'm a little less worried about the workaround breaking i= n the future if this wrapper gets used instead.

Wo= uld it work to change to pthread_fchdir_np, remove all the syscall discussi= on in the comment, and add a meson check for pthread_fchdir_np as a prereq = for virtfs on darwin?

On Fri, Jan 28, 2022 at 1:28 PM Will Cohen &= lt;wwcohen@gmail.com> wrote:
<= div>Understood. Since I cannot find the original number, I have submitted a= new report at rdar://FB9862426 (https://openradar.appspot.com/FB9862426).



qemu_oss@c= rudebyte.com> wrote:
> > On Montag, 22. November 2021 01:49:12 CET Will Cohen wrote:
> > > From: Keno Fischer <keno@juliacomputing.com>
> > >
> > > Darwin does not support mknodat. However, to avoid race cond= itions
> > > with later setting the permissions, we must avoid using mkno= d on
> > > the full path instead. We could try to fchdir, but that woul= d cause
> > > problems if multiple threads try to call mknodat at the same= time.
> > > However, luckily there is a solution: Darwin as an (unexpose= d in the
> > > C library) system call that sets the cwd for the current thr= ead only.
> > > This should suffice to use mknod safely.
> > >
> > > Signed-off-by: Keno Fischer <keno@juliacomputing.com>
> > > Signed-off-by: Michael Roitzsch <reactorcontrol@icloud.com> > > > [Will Cohen: - Adjust coding style]
> > > Signed-off-by: Will Cohen <wwcohen@gmail.com>
> > > ---
> > >
> > >=C2=A0 hw/9pfs/9p-local.c=C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 5= +++--
> > >=C2=A0 hw/9pfs/9p-util-darwin.c | 33 ++++++++++++++++++++++++= +++++++++
> > >=C2=A0 hw/9pfs/9p-util-linux.c=C2=A0 |=C2=A0 5 +++++
> > >=C2=A0 hw/9pfs/9p-util.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 2= ++
> > >=C2=A0 4 files changed, 43 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
> > > index 4268703d05..42b65e143b 100644
> > > --- a/hw/9pfs/9p-local.c
> > > +++ b/hw/9pfs/9p-local.c
> > > @@ -673,7 +673,7 @@ static int local_mknod(FsContext *fs_ctx= , V9fsPath
> > > *dir_path,
> > >
> > >=C2=A0 =C2=A0 =C2=A0 if (fs_ctx->export_flags & V9FS_S= M_MAPPED ||
> > >=C2=A0 =C2=A0 =C2=A0
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 fs_ctx->export_flags &a= mp; V9FS_SM_MAPPED_FILE) {
> > >
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 err =3D mknodat(dirfd, name, fs= _ctx->fmode | S_IFREG, 0);
> > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 err =3D qemu_mknodat(dirfd, nam= e, fs_ctx->fmode | S_IFREG, 0);
> > >
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (err =3D=3D -1) {
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto out; > > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
> > >
> > > @@ -688,7 +688,7 @@ static int local_mknod(FsContext *fs_ctx= , V9fsPath
> > > *dir_path, }
> > >
> > >=C2=A0 =C2=A0 =C2=A0 } else if (fs_ctx->export_flags &= V9FS_SM_PASSTHROUGH ||
> > >=C2=A0 =C2=A0 =C2=A0
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0fs_ctx->export_flags & V9FS_SM_NONE) {
> > >
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 err =3D mknodat(dirfd, name, cr= edp->fc_mode, credp->fc_rdev);
> > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 err =3D qemu_mknodat(dirfd, nam= e, credp->fc_mode,
> > > credp->fc_rdev);
> > >
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (err =3D=3D -1) {
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto out; > > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
> > >
> > > @@ -701,6 +701,7 @@ static int local_mknod(FsContext *fs_ctx= , V9fsPath
> > > *dir_path,
> > >
> > >=C2=A0 err_end:
> > >=C2=A0 =C2=A0 =C2=A0 unlinkat_preserve_errno(dirfd, name, 0);=
> > >
> > > +
> > >
> > >=C2=A0 out:
> > >=C2=A0 =C2=A0 =C2=A0 close_preserve_errno(dirfd);
> > >=C2=A0 =C2=A0 =C2=A0 return err;
> > >
> > > diff --git a/hw/9pfs/9p-util-darwin.c b/hw/9pfs/9p-util-darw= in.c
> > > index ac414bcbfd..25e67d5067 100644
> > > --- a/hw/9pfs/9p-util-darwin.c
> > > +++ b/hw/9pfs/9p-util-darwin.c
> > >
> > > @@ -158,3 +158,36 @@ done:
> > >=C2=A0 =C2=A0 =C2=A0 close_preserve_errno(fd);
> > >=C2=A0 =C2=A0 =C2=A0 return ret;
> > >=C2=A0
> > >=C2=A0 }
> > >
> > > +
> > > +#ifndef SYS___pthread_fchdir
> > > +# define SYS___pthread_fchdir 349
> > > +#endif
> > > +
> > > +/*
> > > + * This is an undocumented OS X syscall. It would be best t= o avoid it,
> > > + * but there doesn't seem to be another safe way to imp= lement mknodat.
> > > + * Dear Apple, please implement mknodat before you remove t= his syscall.
> > > + */
> > > +static int fchdir_thread_local(int fd)
> >
> > Hooo, that's a brave move. Shouldn't its future and likel= y becoming
> > absence be
> > guarded "somehow"? :)
> >
> > BTW it might make sense to file a report instead of hoping Apple = will just
> > read this comment: ;-)
> > https://feedbackassistant.apple.com/
> >
> > > +{
> > > +#pragma clang diagnostic push
> > > +#pragma clang diagnostic ignored "-Wdeprecated-declara= tions"
> > > +=C2=A0 =C2=A0 return syscall(SYS___pthread_fchdir, fd);
> > > +#pragma clang diagnostic pop
> > > +}
> >
> > Consider s/clang/GCC/ then it would also work with GCC. In the en= d most
> > people
> > probably just use clang on macOS anyway, but just saying.
> >
> > > +
> > > +int qemu_mknodat(int dirfd, const char *filename, mode_t mo= de, dev_t
> >
> > dev)
> >
> > > +{
> > > +=C2=A0 =C2=A0 int preserved_errno, err;
> > > +=C2=A0 =C2=A0 if (fchdir_thread_local(dirfd) < 0) {
> > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 return -1;
> > > +=C2=A0 =C2=A0 }
> > > +=C2=A0 =C2=A0 err =3D mknod(filename, mode, dev);
> > > +=C2=A0 =C2=A0 preserved_errno =3D errno;
> > > +=C2=A0 =C2=A0 /* Stop using the thread-local cwd */
> > > +=C2=A0 =C2=A0 fchdir_thread_local(-1);
> > > +=C2=A0 =C2=A0 if (err < 0) {
> > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 errno =3D preserved_errno;
> > > +=C2=A0 =C2=A0 }
> > > +=C2=A0 =C2=A0 return err;
> > > +}
> > > diff --git a/hw/9pfs/9p-util-linux.c b/hw/9pfs/9p-util-linux= .c
> > > index d54bf57a59..4f57d8c047 100644
> > > --- a/hw/9pfs/9p-util-linux.c
> > > +++ b/hw/9pfs/9p-util-linux.c
> > > @@ -68,3 +68,8 @@ int utimensat_nofollow(int dirfd, const ch= ar
> > > *filename,
> > >
> > >=C2=A0 {
> > >=C2=A0
> > >=C2=A0 =C2=A0 =C2=A0 return utimensat(dirfd, filename, times,= AT_SYMLINK_NOFOLLOW);
> > >=C2=A0
> > >=C2=A0 }
> > >
> > > +
> > > +int qemu_mknodat(int dirfd, const char *filename, mode_t mo= de, dev_t
> >
> > dev)
> >
> > > +{
> > > +=C2=A0 =C2=A0 return mknodat(dirfd, filename, mode, dev); > > > +}
> > > diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h
> > > index 1c477a0e66..cac682d335 100644
> > > --- a/hw/9pfs/9p-util.h
> > > +++ b/hw/9pfs/9p-util.h
> > > @@ -105,4 +105,6 @@ ssize_t fremovexattrat_nofollow(int dirf= d, const
> > > char
> > > *filename, int utimensat_nofollow(int dirfd, const char *fil= ename,
> > >
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0const struct timespec times[2]);
> > >
> > > +int qemu_mknodat(int dirfd, const char *filename, mode_t mo= de, dev_t
> >
> > dev);
> >
> > > +
> > >
> > >=C2=A0 #endif


Best regards,
Christian Schoenebeck


--0000000000005ae10805d6e8482a--