From patchwork Thu Jun 18 19:11:32 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 137366 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B728A4B9DB70 for ; Thu, 18 Jun 2026 19:12:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B728A4B9DB70 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=UZKIQYun X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-dl1-x122a.google.com (mail-dl1-x122a.google.com [IPv6:2607:f8b0:4864:20::122a]) by sourceware.org (Postfix) with ESMTPS id 5755B4BA543C for ; Thu, 18 Jun 2026 19:11:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5755B4BA543C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5755B4BA543C Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::122a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781809907; cv=none; b=npZOsx7UUkRIF7sUJPvg6Odk8Ae95SmBe/PlOB4eCCtL4z5VY5aGS6uBEvKazHXvvzw3kuRuf2Gm/MN61SmJqVkQ9j+XlyxiMHrJGvAUA+aJaIkj6uLftE1lCsQEt4vMLdN1vOVSLS2b+1Nay9136tVsCYEUF69rqXQVhTxdRT8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781809907; c=relaxed/simple; bh=i8nHIWNXZfkcKJ9fLDMkpEnfA4M6HW05SOTx5f2FkUY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=qE2vepYkh/XlDFsNSHRKM6YndaOGCyUF0cCLXc9SoUC5bah3OrnM6okUoYg/mJkufaxJ1mi7CIlKH3d3AJWkt8RGHUxQYiYOC9IqAt9XIJAgvVSuzOIKvfdy0yBTwLlXs6j8ykPeWNIrsm//UpIj83lfNrmlmNaFwUe+4qReod0= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=UZKIQYun DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5755B4BA543C Received: by mail-dl1-x122a.google.com with SMTP id a92af1059eb24-13981833e13so1583162c88.1 for ; Thu, 18 Jun 2026 12:11:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1781809906; x=1782414706; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=dRgnYzE7N+cZiK32qyTPn4CXhPGfHxAEEIYHxchNGEE=; b=UZKIQYun2ojoHcWgZxpcU5iTP7qejShIC4sZONi5ZP3LKOCW3IiBvGvQIABm12+jIO J/PM1fHKhT1mrfQroi0mgh8lsXZP6rTHn73Gb9sGw+Nd+hoYuyaCWiSKbrs0wuxWy/PL Gigb8ExhTY3j03Re3Sh6gnllEw3A89UpkHGdIUCS+a+z3UVVH0NaKtzh1dES5zQQ3qpH vWlL4obvEkwIgHfaFhqdQSBO7ZVLz2KGqdYxY4xmsj5Yk4PYWF4uOFLw8a9g77u5ROzp JenlWC0VQP5AieeuBI8U+gXxqyLFbdVuUlcCehxZPmNpt64RFsGE0VtN99P5FcEMBnnm cUyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781809906; x=1782414706; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=dRgnYzE7N+cZiK32qyTPn4CXhPGfHxAEEIYHxchNGEE=; b=BzH54vUTmRNnFNKtuFJQBY5l0s7X2ObpxYUdelZFunC3/7oy1D4lg3PEnAyzRp9e3D FoDJiOMExTYOJS6YcpJ04n3vrQdUaipnWeHhh2UGjwFTEbxHP/vONUcTXSyS1woOqdi8 6TyjXk839RMpgigbPxVvd+nhtybVoF28fPgopJKmTwnLacVeONBIswMQMcr51/HbJqd9 LIKtoCmZUBNmgkszv7RtKmg+0iB6TVZfPZDsRTlkI7rvWK1/gTr8RtV4oyTtiBUrYQD5 jiUC0oMm3vF9E82IzpOML7b3z0KVYlng5EufwPEEHPM7VS8Ey1I/aY3KNlpbSQy7Rwe+ nZrQ== X-Gm-Message-State: AOJu0YzU6GNi9Yw8LKTS1CM9NmHP6uz51tgKzynhZkz7AvF8odp6r3OK XGaedrMXaaxDtrRoi9a3fI0yLO6oHUCJ/p6JbVkYIHyX3EwWkErqxqecrVPtD+RxELkf7Jz1bSQ WA2NC X-Gm-Gg: AfdE7cmaKLfODY7K5HLOlpRTOholsS0zcsiG+DucaR1dj5lRZkFQp7Vj1MAjiwx3H+d bqJTMZWkMpQZtexgSOgy0WpuDz8qH9bI8WsxGQPPftfmNqfSk7WyHu7Fn3OXu+2qJC6JLAnmXZg DOjeKS4XguVXpynGmjdlYJr8wOJJNODSfX0ZSizFs2QkuqqrjthpOMLxsec5VtnDn8t3SQWQG28 r05oss3rxOIWsiQiNgY+Gy1J3WLH7kpY9q/MhN9uVOeF9XhYm7sAZWctjtN9IaNQYY3P10N7DQz JbdaMWVcmILC3RsHcD09w3BtyV/BwYgeqkCPs7zu5llMI0HX71SckeDF+tvL2WFSgNTGhJifRio AbBTtA33Eb7F1nfjo95Fya8JS9DbYv7CHFs15DNG2DGuus4JJFWWkKN0zj4Jz/DBNpJggCNGR07 5HlG1J0RlDeqqEmYeQPgrBYHdQ X-Received: by 2002:a05:7022:2206:b0:137:64ad:a62e with SMTP id a92af1059eb24-139a21a9858mr675450c88.30.1781809905496; Thu, 18 Jun 2026 12:11:45 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c0:d170:cba4:dad7:468a:5e45]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-139a364a431sm40790c88.10.2026.06.18.12.11.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2026 12:11:44 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Collin Funk , Mark Wielaard Subject: [PATCH] misc: Add mkostempat (BZ 19866) Date: Thu, 18 Jun 2026 16:11:32 -0300 Message-ID: <20260618191140.654843-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org The mkstemp family has a lot of potential pitfalls: 1. In-place mutation of the template, where makes string literals usage not possible. 2. The randomness count is baked in the string and it can not be changed (users can no ask for more). 3. O_CLOEXEC is not the default. 4. A lot of combinatorial variant: mkstemp -> mkostemp (flags) -> mkstemps (suffix) -> mkostemps (both) 5. No mode parameter, the file is always created as 0600. 6. Suffix typing and positioning: the XXXXXX must sit at exactly strlen(template) - suffixlen - 6 and mismatches are setups for EINVAL rather than compile-time errors. 7. mkostemp accepts only O_APPEND/O_CLOEXEC/O_SYNC(-ish); anything else is rejected, but the signature gives no hint. This patch adds mkostempat: int mkostempat (int dirfd, /* as other *at functions. */ const char *prefix, /* maybe a relative or absolute. */ const char *suffix, /* no '/' allowed; may be "" */ unsigned int n_random, /* entropy chars, 0 -> default 6 */ int oflags, /* extra O_* OR'd into the create */ mode_t mode, /* e.g. 0600 */ char *namebuf, /* output, or NULL */ size_t namebuf_size); /* bound; ERANGE/ENAMETOOLONG on overflow */ The functions is a GNU extension and a more flexible alternative to the mkstemp family: it creates the file relative to a directory descriptor (with openat's absolute-path/dirfd semantics)i. It also fixes the aforementioned issues: * dirfd first, AT_FDCWD semantics (as other *at functions). * namebuf/namebuf_size replaces the mutated template, killing the string-literal footgun and the lifetime coupling. NULL namebuf means "I only want the fd" (the common O_TMPFILE-adjacent case) * prefix+suffix+n_random replaces the XXXXXX/suffixlen convention. * O_CLOEXEC as the implicit default, with oflags for opt-out/extra flags. * mode so 0600 is a default the caller can override atomically. Checked on aarch64-linux-gnu and x86_64-linux-gnu. --- NEWS | 7 + include/stdio.h | 9 + manual/filesys.texi | 60 +++++ misc/Makefile | 3 + misc/Versions | 3 + misc/mkostempat.c | 102 ++++++++ misc/tst-mkostempat.c | 240 ++++++++++++++++++ stdlib/stdlib.h | 19 ++ sysdeps/mach/hurd/i386/libc.abilist | 1 + sysdeps/mach/hurd/x86_64/libc.abilist | 1 + sysdeps/posix/tempname.c | 83 +++++- sysdeps/unix/sysv/linux/aarch64/libc.abilist | 1 + sysdeps/unix/sysv/linux/alpha/libc.abilist | 1 + sysdeps/unix/sysv/linux/arc/libc.abilist | 1 + sysdeps/unix/sysv/linux/arm/be/libc.abilist | 1 + sysdeps/unix/sysv/linux/arm/le/libc.abilist | 1 + sysdeps/unix/sysv/linux/csky/libc.abilist | 1 + sysdeps/unix/sysv/linux/hppa/libc.abilist | 1 + sysdeps/unix/sysv/linux/i386/libc.abilist | 1 + .../sysv/linux/loongarch/ilp32/libc.abilist | 1 + .../sysv/linux/loongarch/lp64/libc.abilist | 1 + .../sysv/linux/m68k/coldfire/libc.abilist | 1 + .../unix/sysv/linux/m68k/m680x0/libc.abilist | 1 + .../sysv/linux/microblaze/be/libc.abilist | 1 + .../sysv/linux/microblaze/le/libc.abilist | 1 + .../sysv/linux/mips/mips32/fpu/libc.abilist | 1 + .../sysv/linux/mips/mips32/nofpu/libc.abilist | 1 + .../sysv/linux/mips/mips64/n32/libc.abilist | 1 + .../sysv/linux/mips/mips64/n64/libc.abilist | 1 + sysdeps/unix/sysv/linux/or1k/libc.abilist | 1 + .../linux/powerpc/powerpc32/fpu/libc.abilist | 1 + .../powerpc/powerpc32/nofpu/libc.abilist | 1 + .../linux/powerpc/powerpc64/be/libc.abilist | 1 + .../linux/powerpc/powerpc64/le/libc.abilist | 1 + .../unix/sysv/linux/riscv/rv32/libc.abilist | 1 + .../unix/sysv/linux/riscv/rv64/libc.abilist | 1 + sysdeps/unix/sysv/linux/s390/libc.abilist | 1 + sysdeps/unix/sysv/linux/sh/be/libc.abilist | 1 + sysdeps/unix/sysv/linux/sh/le/libc.abilist | 1 + .../sysv/linux/sparc/sparc32/libc.abilist | 1 + .../sysv/linux/sparc/sparc64/libc.abilist | 1 + .../unix/sysv/linux/x86_64/64/libc.abilist | 1 + .../unix/sysv/linux/x86_64/x32/libc.abilist | 1 + 43 files changed, 553 insertions(+), 7 deletions(-) create mode 100644 misc/mkostempat.c create mode 100644 misc/tst-mkostempat.c diff --git a/NEWS b/NEWS index e2173fa1aa7..25b021a3afd 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,13 @@ Major new features: * Static PIE is now supported for arm-*-linux-gnueabi. It requires toolchain support to correctly set the expected linker options. +* The mkostempat function has been added as a GNU extension. It is a more + flexible alternative to mkstemp and its variants, where it creates the + temporary file relative to a directory descriptor, writes the generated + name to a caller-supplied buffer instead of modifying a template in + place, takes the amount of randomness and the creation mode as + parameters, and sets O_CLOEXEC by default. + Deprecated and removed features, and other changes affecting compatibility: * Although malloc and related functions currently return pointers diff --git a/include/stdio.h b/include/stdio.h index 88166993dd9..e3db30b3b06 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -162,8 +162,17 @@ extern FILE *__old_tmpfile (void); # include +/* Default number of random characters used by the mk[s]temp family, and + the smallest number that __gen_tempname's retry loop is designed for + (see ATTEMPTS_MIN in tempname.c). */ +# define GEN_TEMPNAME_DEF_SUFFIX_LEN 6 +# define GEN_TEMPNAME_MIN_SUFFIX_LEN 3 + extern int __gen_tempname (char *__tmpl, int __suffixlen, int __flags, int __kind) attribute_hidden; +extern int __gen_tempname_at (int __dirfd, char *__tmpl, int __suffixlen, + int __flags, __mode_t __mode, + size_t __x_suffix_len) attribute_hidden; /* The __kind argument to __gen_tempname may be one of: */ # define __GT_FILE 0 /* create a file */ # define __GT_DIR 1 /* create a directory */ diff --git a/manual/filesys.texi b/manual/filesys.texi index f49d7d75728..a4004deb9d8 100644 --- a/manual/filesys.texi +++ b/manual/filesys.texi @@ -3988,6 +3988,66 @@ creation always works like @code{open} with @code{O_EXCL}. The @code{mkdtemp} function comes from OpenBSD. +@deftypefun int mkostempat (int @var{dirfd}, const char *@var{prefix}, const char *@var{suffix}, unsigned int @var{n_random}, int @var{oflags}, mode_t @var{mode}, char *@var{namebuf}, size_t @var{namebuf_size}) +@standards{GNU, stdlib.h} +@safety{@prelim{}@mtsafe{}@asunsafe{@ascuheap{}}@acunsafe{@acsmem{} @acsfd{}}} +@c __gen_tempname_at (caller tmpl, __GT_FILE) ok +@c When namebuf is null, a large name is assembled with scratch_buffer, +@c which may call malloc; the file descriptor leaks on cancellation. +The @code{mkostempat} function creates and opens a unique temporary file. +It is a more flexible alternative to @code{mkstemp} and its variants that +avoids several of their pitfalls: it does not modify a caller-supplied +template in place, the amount of randomness is a parameter rather than a +fixed part of the template, the creation mode is a parameter, and the file +is created relative to a directory descriptor. + +The name of the created file has the form +@w{@code{@var{prefix}@var{random}@var{suffix}}}, where @var{random} is a +sequence of @var{n_random} random characters. If @var{n_random} is zero a +default of six characters is used; a nonzero @var{n_random} smaller than +three is rejected with @code{EINVAL} (since too little randomness defeats +the purpose of a unique name). @var{suffix} may be the empty string but +must not contain a @samp{/} character, so that the random characters always +fall in the final path component; if it does, the call fails with +@code{EINVAL}. @var{prefix}, in contrast, may contain @samp{/} characters +and so may name a file in a subdirectory or an absolute path. + +The file is created relative to the directory referenced by the descriptor +@var{dirfd}, in the same way as @code{openat} (@pxref{Descriptor-Relative +Access}). If @var{dirfd} is the special value @code{AT_FDCWD} then the +current working directory is used. If the assembled name is absolute (that +is, @var{prefix} begins with @samp{/}), @var{dirfd} is ignored, exactly as +for @code{openat} and the other @code{*at} functions. + +The file is created atomically using @code{open} with the @code{O_CREAT} +and @code{O_EXCL} flags, so it cannot clash with an existing file. It is +always created in large-file mode and with the @code{O_CLOEXEC} flag set, +and always opened for reading and writing. Any additional flags in +@var{oflags} (for example @code{O_APPEND}) are included in the @code{open} +call; @var{oflags} is not otherwise restricted, so unlike @code{mkostemp} +there is no fixed set of permitted flags, but the access-mode bits +(@code{O_RDONLY}, @code{O_WRONLY}, @code{O_RDWR}) in @var{oflags} are +ignored, and a flag the kernel rejects causes the call to fail accordingly. +The file is created with permissions @var{mode} (for example @code{0600}), +as modified by the process umask. + +If @var{namebuf} is not a null pointer, the generated file name is written +to it, including the terminating null character. At most +@var{namebuf_size} bytes are written; if the name and its terminator do not +fit, the call fails with @code{ERANGE} and no file is created. If +@var{namebuf} is a null pointer, only the descriptor is produced and +@var{namebuf_size} is ignored; this is convenient when the name is not +needed. + +On success @code{mkostempat} returns a file descriptor open for reading and +writing. On failure it returns @code{-1} and sets @code{errno}; in +addition to @code{EINVAL} and @code{ERANGE} described above it may report +@code{ENAMETOOLONG} if the requested name is too large to represent, as +well as any error reported by @code{openat}. + +@code{mkostempat} is a GNU extension. +@end deftypefun + @c FIXME these are undocumented: @c fchmodat @c fchownat diff --git a/misc/Makefile b/misc/Makefile index 3937b5d5ea4..0f6460232b2 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -140,6 +140,7 @@ routines := \ mkdtemp \ mkostemp \ mkostemp64 \ + mkostempat \ mkostemps \ mkostemps64 \ mkstemp \ @@ -255,6 +256,7 @@ tests := \ tst-ldbl-errorfptr \ tst-ldbl-warn \ tst-makedev \ + tst-mkostempat \ tst-mntent \ tst-mntent-autofs \ tst-mntent-blank-corrupt \ @@ -338,6 +340,7 @@ CFLAGS-error.c += -fexceptions CFLAGS-getpass.c += -fexceptions CFLAGS-mkstemp.c += -fexceptions CFLAGS-mkstemp64.c += -fexceptions +CFLAGS-mkostempat.c += -fexceptions CFLAGS-getsysstats.c += -fexceptions CFLAGS-getusershell.c += -fexceptions CFLAGS-err.c += -fexceptions diff --git a/misc/Versions b/misc/Versions index d5b348e83ad..377ad0e3503 100644 --- a/misc/Versions +++ b/misc/Versions @@ -164,6 +164,9 @@ libc { GLIBC_2.32 { __libc_single_threaded; } + GLIBC_2.44 { + mkostempat; + } GLIBC_PRIVATE { __madvise; __mktemp; diff --git a/misc/mkostempat.c b/misc/mkostempat.c new file mode 100644 index 00000000000..614e2f55f75 --- /dev/null +++ b/misc/mkostempat.c @@ -0,0 +1,102 @@ +/* Generate a temporary file relative to a directory descriptor. + Copyright (C) 2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include +#include +#include +#include +#include + +static int +mkostempat_create (int dirfd, char *buf, const char *prefix, size_t prefixlen, + unsigned int n_random, const char *suffix, size_t suffixlen, + int oflags, mode_t mode) +{ + char *p = __mempcpy (buf, prefix, prefixlen); + memset (p, 'X', n_random); + p += n_random; + p = __mempcpy (p, suffix, suffixlen); + *p = '\0'; + + return __gen_tempname_at (dirfd, buf, suffixlen, + oflags | O_CLOEXEC | O_LARGEFILE, mode, n_random); +} + +static int __attribute_noinline__ +mkostempat_scratch (int dirfd, size_t bufsize, const char *prefix, + size_t prefixlen, unsigned int n_random, + const char *suffix, size_t suffixlen, int oflags, + mode_t mode) +{ + struct scratch_buffer sbuf; + scratch_buffer_init (&sbuf); + if (!scratch_buffer_set_array_size (&sbuf, bufsize, 1)) + return -1; + int fd = mkostempat_create (dirfd, sbuf.data, prefix, prefixlen, n_random, + suffix, suffixlen, oflags, mode); + scratch_buffer_free (&sbuf); + return fd; +} + +int +mkostempat (int dirfd, const char *prefix, const char *suffix, + unsigned int n_random, int oflags, mode_t mode, + char *namebuf, size_t namebuf_size) +{ + /* SUFFIX must not contain '/', so that the random characters always end up + in the final path component. */ + if (strchr (suffix, '/') != NULL + || (n_random != 0 && n_random < GEN_TEMPNAME_MIN_SUFFIX_LEN)) + { + __set_errno (EINVAL); + return -1; + } + + if (n_random == 0) + n_random = GEN_TEMPNAME_DEF_SUFFIX_LEN; + + size_t prefixlen = strlen (prefix); + size_t suffixlen = strlen (suffix); + + size_t bufsize; + if (suffixlen > INT_MAX + || INT_ADD_WRAPV (prefixlen, n_random, &bufsize) + || INT_ADD_WRAPV (bufsize, suffixlen, &bufsize) + || INT_ADD_WRAPV (bufsize, 1, &bufsize)) /* '\0' */ + { + __set_errno (ENAMETOOLONG); + return -1; + } + + if (namebuf != NULL) + { + if (namebuf_size < bufsize) + { + __set_errno (ERANGE); + return -1; + } + return mkostempat_create (dirfd, namebuf, prefix, prefixlen, n_random, + suffix, suffixlen, oflags, mode); + } + + return mkostempat_scratch (dirfd, bufsize, prefix, prefixlen, n_random, + suffix, suffixlen, oflags, mode); +} diff --git a/misc/tst-mkostempat.c b/misc/tst-mkostempat.c new file mode 100644 index 00000000000..6d419a4498a --- /dev/null +++ b/misc/tst-mkostempat.c @@ -0,0 +1,240 @@ +/* Tests for mkostempat. + Copyright (C) 2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +/* Verify that the leaf name NAME has PREFIX as a prefix, SUFFIX as a + suffix, and exactly N_RANDOM characters in between. */ +static void +check_name (const char *name, const char *prefix, const char *suffix, + unsigned int n_random) +{ + size_t prefixlen = strlen (prefix); + size_t suffixlen = strlen (suffix); + TEST_COMPARE (strlen (name), prefixlen + n_random + suffixlen); + TEST_VERIFY (strncmp (name, prefix, prefixlen) == 0); + TEST_VERIFY (strcmp (name + prefixlen + n_random, suffix) == 0); +} + +static int +do_test (void) +{ + /* Make the recorded permission bits deterministic. */ + umask (0); + + char *dir = support_create_temp_directory ("tst-mkostempat-"); + int dirfd = xopen (dir, O_RDONLY | O_DIRECTORY, 0); + + /* Basic case: default entropy, the name is returned, the descriptor is + a regular file open for reading and writing, the requested mode is + honored, and O_CLOEXEC is set by default. */ + { + char namebuf[64]; + int fd = mkostempat (dirfd, "base-", ".txt", 0, 0, 0600, + namebuf, sizeof namebuf); + TEST_VERIFY_EXIT (fd >= 0); + check_name (namebuf, "base-", ".txt", 6); + + /* The file is created relative to dirfd, not the cwd. */ + struct stat64 st; + xfstatat64 (dirfd, namebuf, &st, 0); + TEST_VERIFY (S_ISREG (st.st_mode)); + TEST_COMPARE (st.st_mode & 07777, 0600); + + TEST_COMPARE (write (fd, "hello", 5), 5); + TEST_VERIFY (fcntl (fd, F_GETFD) & FD_CLOEXEC); + + xclose (fd); + } + + /* Custom entropy length and an empty suffix. */ + { + char namebuf[64]; + int fd = mkostempat (dirfd, "p", "", 12, 0, 0644, + namebuf, sizeof namebuf); + TEST_VERIFY_EXIT (fd >= 0); + check_name (namebuf, "p", "", 12); + struct stat64 st; + xfstatat64 (dirfd, namebuf, &st, 0); + TEST_COMPARE (st.st_mode & 07777, 0644); + TEST_VERIFY (fcntl (fd, F_GETFD) & FD_CLOEXEC); + xclose (fd); + } + + /* A large N_RANDOM, well above the default of six and above the number + of base-62 digits produced by a single random draw (so the random + buffer is refilled several times), yields exactly that many random + characters, each drawn from the temporary-name alphabet [0-9A-Za-z]. */ + { + enum { many = 40 }; + char namebuf[64]; + int fd = mkostempat (dirfd, "many-", ".dat", many, 0, 0600, + namebuf, sizeof namebuf); + TEST_VERIFY_EXIT (fd >= 0); + check_name (namebuf, "many-", ".dat", many); + const char *random = namebuf + strlen ("many-"); + for (int i = 0; i < many; i++) + TEST_VERIFY (isalnum ((unsigned char) random[i])); + struct stat64 st; + xfstatat64 (dirfd, namebuf, &st, 0); + TEST_VERIFY (S_ISREG (st.st_mode)); + xclose (fd); + } + + /* NULL namebuf: only the descriptor is wanted. The file is still + created (and unlinkable through /proc is not portable, so just check + the descriptor itself). */ + { + int fd = mkostempat (dirfd, "anon-", "", 0, 0, 0600, NULL, 0); + TEST_VERIFY_EXIT (fd >= 0); + struct stat64 st; + xfstat64 (fd, &st); + TEST_VERIFY (S_ISREG (st.st_mode)); + TEST_COMPARE (st.st_nlink, 1); + TEST_VERIFY (fcntl (fd, F_GETFD) & FD_CLOEXEC); + xclose (fd); + } + + /* AT_FDCWD works like the other *at functions. */ + { + xchdir (dir); + char namebuf[64]; + int fd = mkostempat (AT_FDCWD, "cwd-", ".tmp", 0, 0, 0600, + namebuf, sizeof namebuf); + TEST_VERIFY_EXIT (fd >= 0); + check_name (namebuf, "cwd-", ".tmp", 6); + TEST_COMPARE (access (namebuf, F_OK), 0); + TEST_VERIFY (fcntl (fd, F_GETFD) & FD_CLOEXEC); + xclose (fd); + } + + /* oflags are honored: request O_APPEND. */ + { + char namebuf[64]; + int fd = mkostempat (dirfd, "app-", "", 0, O_APPEND, 0600, + namebuf, sizeof namebuf); + TEST_VERIFY_EXIT (fd >= 0); + int fl = fcntl (fd, F_GETFL); + TEST_VERIFY (fl & O_APPEND); + TEST_VERIFY (fcntl (fd, F_GETFD) & FD_CLOEXEC); + xclose (fd); + } + + /* A '/' in the suffix is rejected with EINVAL (the random characters + must stay in the final path component). A '/' in the prefix is + allowed; see the absolute-path case below. */ + { + char namebuf[64]; + errno = 0; + TEST_COMPARE (mkostempat (dirfd, "ok", "x/y", 0, 0, 0600, + namebuf, sizeof namebuf), -1); + TEST_COMPARE (errno, EINVAL); + } + + /* An absolute prefix names an absolute location and DIRFD is ignored, as + with openat. Pass a deliberately invalid DIRFD to prove it is not + consulted, and verify the file lands at the absolute path. */ + { + char *abs_prefix = xasprintf ("%s/abs-", dir); + char namebuf[256]; + int fd = mkostempat (-1, abs_prefix, ".bin", 0, 0, 0600, + namebuf, sizeof namebuf); + TEST_VERIFY_EXIT (fd >= 0); + TEST_VERIFY (namebuf[0] == '/'); + check_name (namebuf, abs_prefix, ".bin", 6); + TEST_COMPARE (access (namebuf, F_OK), 0); + xclose (fd); + free (abs_prefix); + } + + /* A nonzero N_RANDOM smaller than three is rejected with EINVAL, while + exactly three is accepted. */ + { + char namebuf[64]; + for (unsigned int n = 1; n <= 2; n++) + { + errno = 0; + TEST_COMPARE (mkostempat (dirfd, "low-", "", n, 0, 0600, + namebuf, sizeof namebuf), -1); + TEST_COMPARE (errno, EINVAL); + } + + int fd = mkostempat (dirfd, "low-", "", 3, 0, 0600, + namebuf, sizeof namebuf); + TEST_VERIFY_EXIT (fd >= 0); + check_name (namebuf, "low-", "", 3); + xclose (fd); + } + + /* A too-small output buffer is rejected with ERANGE. The exact name + needs prefix + 6 + suffix + 1 = 5 + 6 + 4 + 1 = 16 bytes. */ + { + char small[8]; + errno = 0; + TEST_COMPARE (mkostempat (dirfd, "base-", ".txt", 0, 0, 0600, + small, sizeof small), -1); + TEST_COMPARE (errno, ERANGE); + } + + /* A buffer that is exactly large enough succeeds. */ + { + char exact[16]; + int fd = mkostempat (dirfd, "base-", ".txt", 0, 0, 0600, + exact, sizeof exact); + TEST_VERIFY_EXIT (fd >= 0); + TEST_COMPARE (strlen (exact), 15); + xclose (fd); + } + + /* An invalid directory descriptor surfaces the underlying error. */ + { + char namebuf[64]; + errno = 0; + TEST_COMPARE (mkostempat (-1, "base-", "", 0, 0, 0600, + namebuf, sizeof namebuf), -1); + TEST_COMPARE (errno, EBADF); + } + + /* Remove every file we created so the temporary directory itself can be + cleaned up on exit. */ + DIR *dirp = xopendir (dir); + struct dirent *e; + while ((e = readdir (dirp)) != NULL) + if (strcmp (e->d_name, ".") != 0 && strcmp (e->d_name, "..") != 0) + TEST_COMPARE (unlinkat (dirfd, e->d_name, 0), 0); + xclosedir (dirp); + + xclose (dirfd); + free (dir); + return 0; +} + +#include diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index 1c67d8e13f3..f42c69acb42 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -935,6 +935,25 @@ extern int __REDIRECT (mkostemps, (char *__template, int __suffixlen, extern int mkostemps64 (char *__template, int __suffixlen, int __flags) __nonnull ((1)) __wur; # endif + +/* Create and open a unique temporary file relative to the directory + referenced by DIRFD. The file name has the form , + where RANDOM is N_RANDOM random characters (six if N_RANDOM is zero; a + nonzero value below three fails with EINVAL). PREFIX may contain directory + components and may be absolute, in which case DIRFD is ignored, as with + openat. SUFFIX must not contain a `/' and may be empty. + The file is created atomically with mode MODE and opened for reading and + writing; OFLAGS is or'ed into the open call, which always sets O_CREAT, + O_EXCL, O_CLOEXEC and large-file mode. + When NAMEBUF is not NULL the generated file name is stored there, bounded + by NAMEBUF_SIZE (ERANGE if it does not fit). Returns the new file + descriptor, or -1 with errno set on error. + + This function is a possible cancellation point. */ +extern int mkostempat (int __dirfd, const char *__prefix, + const char *__suffix, unsigned int __n_random, + int __oflags, mode_t __mode, char *__namebuf, + size_t __namebuf_size) __nonnull ((2, 3)) __wur; #endif diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist index 0166703bdb3..dfed67b0536 100644 --- a/sysdeps/mach/hurd/i386/libc.abilist +++ b/sysdeps/mach/hurd/i386/libc.abilist @@ -2820,6 +2820,7 @@ GLIBC_2.44 gai_suspend F GLIBC_2.44 getaddrinfo_a F GLIBC_2.44 lio_listio F GLIBC_2.44 lio_listio64 F +GLIBC_2.44 mkostempat F GLIBC_2.44 mq_close F GLIBC_2.44 mq_getattr F GLIBC_2.44 mq_notify F diff --git a/sysdeps/mach/hurd/x86_64/libc.abilist b/sysdeps/mach/hurd/x86_64/libc.abilist index 0262a079aa8..59745e9bf02 100644 --- a/sysdeps/mach/hurd/x86_64/libc.abilist +++ b/sysdeps/mach/hurd/x86_64/libc.abilist @@ -2496,6 +2496,7 @@ GLIBC_2.44 gai_suspend F GLIBC_2.44 getaddrinfo_a F GLIBC_2.44 lio_listio F GLIBC_2.44 lio_listio64 F +GLIBC_2.44 mkostempat F GLIBC_2.44 mq_close F GLIBC_2.44 mq_getattr F GLIBC_2.44 mq_notify F diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c index 677ea8d5f04..603fa0e8bdb 100644 --- a/sysdeps/posix/tempname.c +++ b/sysdeps/posix/tempname.c @@ -126,8 +126,39 @@ random_bits (random_value *r, random_value s) #if _LIBC static int try_tempname_len (char *, int, void *, int (*) (char *, void *), size_t); -#endif +struct tempname_args +{ + int flags; /* Extra flags OR'ed into the open call. */ + int dirfd; /* Directory descriptor, or AT_FDCWD. */ + mode_t mode; /* Creation mode for the new file. */ +}; + +static int +try_file (char *tmpl, void *args) +{ + struct tempname_args *a = args; + return __openat (a->dirfd, tmpl, + (a->flags & ~O_ACCMODE) | O_RDWR | O_CREAT | O_EXCL, + a->mode); +} + +static int +try_dir (char *tmpl, _GL_UNUSED void *args) +{ + return __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR); +} + +static int +try_nocreate (char *tmpl, _GL_UNUSED void *args) +{ + struct_stat64 st; + + if (__lstat64_time64 (tmpl, &st) == 0 || errno == EOVERFLOW) + __set_errno (EEXIST); + return errno == ENOENT ? 0 : -1; +} +#else static int try_file (char *tmpl, void *flags) { @@ -152,6 +183,7 @@ try_nocreate (char *tmpl, _GL_UNUSED void *flags) __set_errno (EEXIST); return errno == ENOENT ? 0 : -1; } +#endif /* These are the characters used in temporary file names. */ static const char letters[] = @@ -184,8 +216,19 @@ gen_tempname_len (char *tmpl, int suffixlen, int flags, int kind, [__GT_DIR] = try_dir, [__GT_NOCREATE] = try_nocreate }; +#if _LIBC + struct tempname_args args = + { + .flags = flags, + .dirfd = AT_FDCWD, + .mode = S_IRUSR | S_IWUSR + }; + return try_tempname_len (tmpl, suffixlen, &args, tryfunc[kind], + x_suffix_len); +#else return try_tempname_len (tmpl, suffixlen, &flags, tryfunc[kind], x_suffix_len); +#endif } #ifdef _LIBC @@ -203,11 +246,14 @@ try_tempname_len (char *tmpl, int suffixlen, void *args, /* A lower bound on the number of temporary files to attempt to generate. The maximum total number of temporary file names that - can exist for a given template is 62**6. It should never be - necessary to try all of these combinations. Instead if a reasonable - number of names is tried (we define reasonable as 62**3) fail to - give the system administrator the chance to remove the problems. - This value requires that X_SUFFIX_LEN be at least 3. */ + can exist for a given template is 62**X_SUFFIX_LEN. It should never + be necessary to try all of these combinations. Instead if a + reasonable number of names is tried (we define reasonable as 62**3) + fail to give the system administrator the chance to remove the + problems. This value requires that X_SUFFIX_LEN be at least + GEN_TEMPNAME_MIN_SUFFIX_LEN (3), which every caller ensures: the + mk[s]temp family uses GEN_TEMPNAME_DEF_SUFFIX_LEN, and mkostempat + rejects a smaller request. */ #define ATTEMPTS_MIN (62 * 62 * 62) /* The number of times to attempt to generate a temporary file. To @@ -279,9 +325,32 @@ try_tempname_len (char *tmpl, int suffixlen, void *args, int __gen_tempname (char *tmpl, int suffixlen, int flags, int kind) { - return gen_tempname_len (tmpl, suffixlen, flags, kind, 6); + return gen_tempname_len (tmpl, suffixlen, flags, kind, + GEN_TEMPNAME_DEF_SUFFIX_LEN); } +#if _LIBC +/* Generate a temporary file relative to DIRFD (which may be AT_FDCWD). TMPL + holds the leaf name with X_SUFFIX_LEN 'X' placeholders before a + SUFFIXLEN-byte suffix; the placeholders are overwritten in place with + random characters. The file is created with open (O_CREAT | O_EXCL), the + extra FLAGS are OR'ed into the open call, and the file is created with the + given MODE. Returns the new read-write file descriptor, or -1 with errno + set. */ +int +__gen_tempname_at (int dirfd, char *tmpl, int suffixlen, int flags, + mode_t mode, size_t x_suffix_len) +{ + struct tempname_args args = + { + .flags = flags, + .dirfd = dirfd, + .mode = mode + }; + return try_tempname_len (tmpl, suffixlen, &args, try_file, x_suffix_len); +} +#endif + #if !_LIBC int try_tempname (char *tmpl, int suffixlen, void *args, diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist index 3156688addb..d5648924d45 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist @@ -2775,3 +2775,4 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist index 8af5b0b5818..dcc849a3f4e 100644 --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist @@ -3122,6 +3122,7 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist index 35fcef2cc4c..9a13113fb44 100644 --- a/sysdeps/unix/sysv/linux/arc/libc.abilist +++ b/sysdeps/unix/sysv/linux/arc/libc.abilist @@ -2536,3 +2536,4 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist index a6c6b951bfa..111445a4abe 100644 --- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist +++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist @@ -2828,6 +2828,7 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist index e76015fe666..158e42b91a5 100644 --- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist +++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist @@ -2825,6 +2825,7 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist index 1fb7cdcad5d..36f19d26604 100644 --- a/sysdeps/unix/sysv/linux/csky/libc.abilist +++ b/sysdeps/unix/sysv/linux/csky/libc.abilist @@ -2812,3 +2812,4 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist index 0710ccecf9d..b5c68f584bd 100644 --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist @@ -2849,6 +2849,7 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist index 3afe3a88eb4..a8db7987afb 100644 --- a/sysdeps/unix/sysv/linux/i386/libc.abilist +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist @@ -3032,6 +3032,7 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/loongarch/ilp32/libc.abilist b/sysdeps/unix/sysv/linux/loongarch/ilp32/libc.abilist index 7c6d7055c3d..693307abad5 100644 --- a/sysdeps/unix/sysv/linux/loongarch/ilp32/libc.abilist +++ b/sysdeps/unix/sysv/linux/loongarch/ilp32/libc.abilist @@ -1314,6 +1314,7 @@ GLIBC_2.44 mknod F GLIBC_2.44 mknodat F GLIBC_2.44 mkostemp F GLIBC_2.44 mkostemp64 F +GLIBC_2.44 mkostempat F GLIBC_2.44 mkostemps F GLIBC_2.44 mkostemps64 F GLIBC_2.44 mkstemp F diff --git a/sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist b/sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist index c2b3a66d3a1..39de94b9ea6 100644 --- a/sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist +++ b/sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist @@ -2296,3 +2296,4 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist index d6855131e8b..67e6f07148c 100644 --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist @@ -2808,6 +2808,7 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist index 4e3fe9c42f2..88901170989 100644 --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist @@ -2975,6 +2975,7 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist index 29f0c5f954b..e3ceb45313d 100644 --- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist +++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist @@ -2861,3 +2861,4 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist index 2ef62838f75..3b7c82c13af 100644 --- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist +++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist @@ -2858,3 +2858,4 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist index 031e8961acc..a539ce6b7d4 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist @@ -2938,6 +2938,7 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist index 8dc99d81b4b..9daa1b52f81 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist @@ -2936,6 +2936,7 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist index 054c5b6391b..c95c5ac40e4 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist @@ -2944,6 +2944,7 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist index 13f0148bc00..75f1df836f9 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist @@ -2846,6 +2846,7 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/or1k/libc.abilist b/sysdeps/unix/sysv/linux/or1k/libc.abilist index e7ffe07dd8d..1a24a3af3b9 100644 --- a/sysdeps/unix/sysv/linux/or1k/libc.abilist +++ b/sysdeps/unix/sysv/linux/or1k/libc.abilist @@ -2286,3 +2286,4 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist index dea4b20f05c..c48df291011 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist @@ -3165,6 +3165,7 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist index b45e1274636..b818ca307be 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist @@ -3210,6 +3210,7 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist index 942cf6a0276..34e86c24ddc 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist @@ -2919,6 +2919,7 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist index 65d78e50760..c6de1cfa006 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist @@ -2995,3 +2995,4 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist index dcab30d72ee..2924f80caa8 100644 --- a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist +++ b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist @@ -2539,3 +2539,4 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist index 796ef35e26e..62f429c7daa 100644 --- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist +++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist @@ -2739,3 +2739,4 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F diff --git a/sysdeps/unix/sysv/linux/s390/libc.abilist b/sysdeps/unix/sysv/linux/s390/libc.abilist index 8f2350ee0b6..675a2642bc2 100644 --- a/sysdeps/unix/sysv/linux/s390/libc.abilist +++ b/sysdeps/unix/sysv/linux/s390/libc.abilist @@ -2956,6 +2956,7 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist index 7aa98c5aede..adf95b7c32d 100644 --- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist +++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist @@ -2855,6 +2855,7 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist index 6bd4f8f63a1..55048466fbc 100644 --- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist +++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist @@ -2852,6 +2852,7 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist index b52cab2a351..4dc19f7c229 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist @@ -3186,6 +3186,7 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist index ff99cd4f219..bbd59006c5d 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist @@ -2822,6 +2822,7 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist index 306cd627fd8..ee85ca210ea 100644 --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist @@ -2771,6 +2771,7 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist index 8b9c448742e..27503331c39 100644 --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist @@ -2790,3 +2790,4 @@ GLIBC_2.43 memset_explicit F GLIBC_2.43 mseal F GLIBC_2.43 openat2 F GLIBC_2.43 umaxabs F +GLIBC_2.44 mkostempat F