Skip to content
Commits on Source (4)
glibc (2.29-3) UNRELEASED; urgency=medium
glibc (2.29-4) UNRELEASED; urgency=medium
 
[ Aurelien Jarno ]
* Upload to experimental.
......@@ -10,6 +10,22 @@ glibc (2.29-3) UNRELEASED; urgency=medium
 
-- Aurelien Jarno <aurel32@debian.org> Tue, 08 Oct 2019 22:55:48 +0200
 
glibc (2.29-3) unstable; urgency=medium
[ Svante Signell ]
* patches/hurd-i386/git-rlock.diff: New patch to add support for record
locking.
[ Samuel Thibault ]
* patches/hurd-i386/tg-locarchive.diff,tg-WRLCK-upgrade.diff: Remove, now
useless.
* control: Bump hurd-dev dependency to get record locking RPC.
* libc0.3.symbols.hurd-i386: Update accordingly.
* patches/arm/unsubmitted-ldso-abi-check.diff: Remove obsolete patch.
Closes: #943798.
-- Samuel Thibault <sthibault@debian.org> Thu, 31 Oct 2019 23:31:12 +0100
glibc (2.29-2) unstable; urgency=medium
 
[ Aurelien Jarno ]
......
......@@ -6,8 +6,8 @@ Build-Depends: gettext, dpkg (>= 1.18.7), dpkg-dev (>= 1.17.14), xz-utils, file,
linux-libc-dev (>= 3.9) [linux-any],
libaudit-dev [linux-any], libcap-dev [linux-any], libselinux-dev [linux-any],
mig (>= 1.5-3) [hurd-i386], gnumach-dev (>= 2:1.8+git20181103-1~) [hurd-i386],
hurd-dev (>= 1:0.9.git20181030-1) [hurd-i386] | hurd-headers-dev [hurd-i386],
hurd-dev (>= 1:0.9.git20181030-1) [hurd-i386] <!stage1> | libihash-dev [hurd-i386] <!stage1>,
hurd-dev (>= 1:0.9.git20191029-1) [hurd-i386] | hurd-headers-dev [hurd-i386],
hurd-dev (>= 1:0.9.git20191029-1) [hurd-i386] <!stage1> | libihash-dev [hurd-i386] <!stage1>,
kfreebsd-kernel-headers [kfreebsd-any],
binutils (>= 2.29),
g++-9, g++-9-multilib [amd64 i386 kfreebsd-amd64 mips mipsel mipsn32 mipsn32el mips64 mips64el mipsr6 mipsr6el mipsn32r6 mipsn32r6el mips64r6 mips64r6el powerpc ppc64 s390x sparc sparc64 x32] <!nobiarch>,
......
......@@ -6,8 +6,8 @@ Build-Depends: gettext, dpkg (>= 1.18.7), dpkg-dev (>= 1.17.14), xz-utils, file,
linux-libc-dev (>= 3.9) [linux-any],
libaudit-dev [linux-any], libcap-dev [linux-any], libselinux-dev [linux-any],
mig (>= 1.5-3) [hurd-i386], gnumach-dev (>= 2:1.8+git20181103-1~) [hurd-i386],
hurd-dev (>= 1:0.9.git20181030-1) [hurd-i386] | hurd-headers-dev [hurd-i386],
hurd-dev (>= 1:0.9.git20181030-1) [hurd-i386] <!stage1> | libihash-dev [hurd-i386] <!stage1>,
hurd-dev (>= 1:0.9.git20191029-1) [hurd-i386] | hurd-headers-dev [hurd-i386],
hurd-dev (>= 1:0.9.git20191029-1) [hurd-i386] <!stage1> | libihash-dev [hurd-i386] <!stage1>,
kfreebsd-kernel-headers [kfreebsd-any],
binutils (>= 2.29),
g++-9, g++-9-multilib [amd64 i386 kfreebsd-amd64 mips mipsel mipsn32 mipsn32el mips64 mips64el mipsr6 mipsr6el mipsn32r6 mipsn32r6el mips64r6 mips64r6el powerpc ppc64 s390x sparc sparc64 x32] <!nobiarch>,
......
......@@ -105,6 +105,7 @@ libhurduser.so.0.3 #PACKAGE# #MINVER#
__file_lock@Base 2.11
__file_lock_stat@Base 2.11
__file_notice_changes@Base 2.11
__file_record_lock@Base 2.29-3~
__file_reparent@Base 2.11
__file_set_size@Base 2.11
__file_set_translator@Base 2.11
......@@ -482,6 +483,7 @@ libhurduser.so.0.3 #PACKAGE# #MINVER#
file_lock@Base 2.11
file_lock_stat@Base 2.11
file_notice_changes@Base 2.11
file_record_lock@Base 2.29-3~
file_reparent@Base 2.11
file_set_size@Base 2.11
file_set_translator@Base 2.11
......
---
elf/dl-load.c | 219 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 219 insertions(+)
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1438,6 +1438,209 @@
_dl_debug_printf_c ("\t\t(%s)\n", what);
}
+#ifdef __arm__
+/* Read an unsigned leb128 value from P, store the value in VAL, return
+ P incremented past the value. We assume that a word is large enough to
+ hold any value so encoded; if it is smaller than a pointer on some target,
+ pointers should not be leb128 encoded on that target. */
+static unsigned char *
+read_uleb128 (unsigned char *p, unsigned long *val)
+{
+ unsigned int shift = 0;
+ unsigned char byte;
+ unsigned long result;
+
+ result = 0;
+ do
+ {
+ byte = *p++;
+ result |= (byte & 0x7f) << shift;
+ shift += 7;
+ }
+ while (byte & 0x80);
+
+ *val = result;
+ return p;
+}
+
+
+#define ATTR_TAG_FILE 1
+#define ABI_VFP_args 28
+#define VFP_ARGS_IN_VFP_REGS 1
+
+/* Check consistency of ABI in the ARM attributes. Search through the
+ section headers looking for the ARM attributes section, then
+ check the VFP_ARGS attribute. */
+static int
+check_arm_attributes_hfabi(int fd, ElfW(Ehdr) *ehdr, bool *is_hf)
+{
+ unsigned int i;
+ ElfW(Shdr) *shdrs;
+ int sh_size = ehdr->e_shentsize * ehdr->e_shnum;
+
+ /* Load in the section headers so we can look for the attributes
+ * section */
+ shdrs = alloca(sh_size);
+ __lseek (fd, ehdr->e_shoff, SEEK_SET);
+ if ((size_t) __libc_read (fd, (void *) shdrs, sh_size) != sh_size)
+ return -1;
+
+ for (i = 0; i < ehdr->e_shnum; i++)
+ {
+ if (SHT_ARM_ATTRIBUTES == shdrs[i].sh_type)
+ {
+ /* We've found a likely section. Load the contents and
+ * check the tags */
+ unsigned char *contents = alloca(shdrs[i].sh_size);
+ unsigned char *p = contents;
+ unsigned char * end;
+
+ __lseek (fd, shdrs[i].sh_offset, SEEK_SET);
+ if ((size_t) __libc_read (fd, (void *) contents, shdrs[i].sh_size) != shdrs[i].sh_size)
+ return -1;
+
+ /* Sanity-check the attribute section details. Make sure
+ * that it's the "aeabi" section, that's all we care
+ * about. */
+ if (*p == 'A')
+ {
+ unsigned long len = shdrs[i].sh_size - 1;
+ unsigned long namelen;
+ p++;
+
+ while (len > 0)
+ {
+ unsigned long section_len = p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24;
+ if (section_len > len)
+ {
+ _dl_debug_printf_c (" invalid section len %lu, max remaining %lu\n", section_len, len);
+ section_len = len;
+ }
+
+ p += 4;
+ len -= section_len;
+ section_len -= 4;
+
+ if (0 != strcmp((char *)p, "aeabi"))
+ {
+ _dl_debug_printf_c (" ignoring unknown attr section %s\n", p);
+ p += section_len;
+ continue;
+ }
+ namelen = strlen((char *)p) + 1;
+ p += namelen;
+ section_len -= namelen;
+
+ /* We're in a valid section. Walk through this
+ * section looking for the tag we care about
+ * (ABI_VFP_args) */
+ while (section_len > 0)
+ {
+ unsigned long val = 0;
+ unsigned long tag;
+ unsigned long size;
+
+ end = p;
+ tag = (*p++);
+
+ size = p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24;
+ if (size > section_len)
+ {
+ _dl_debug_printf_c (" invalid subsection length %lu, max allowed %lu\n", size, section_len);
+ size = section_len;
+ }
+ p += 4;
+
+ section_len -= size;
+ end += size;
+ if (ATTR_TAG_FILE != tag)
+ {
+ /* ignore, we don't care */
+ _dl_debug_printf_c (" ignoring unknown subsection with type %lu length %lu\n", tag, size);
+ p = end;
+ continue;
+ }
+ while (p < end)
+ {
+ p = read_uleb128 (p, &tag);
+ /* Handle the different types of tag. */
+ if ( (tag == 4) || (tag == 5) || (tag == 67) )
+ {
+ /* Special cases for string values */
+ namelen = strlen((char *)p) + 1;
+ p += namelen;
+ }
+ else
+ {
+ p = read_uleb128 (p, &val);
+ }
+ if ( (tag == ABI_VFP_args) && (val == VFP_ARGS_IN_VFP_REGS) )
+ {
+ *is_hf = 1;
+ return 0;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+
+/* ARM-specific checks. If we're built using the HF ABI, then fail any
+ attempts to use the SF ABI (and vice versa). Then, check for
+ consistency of ABI in terms of passing VFP args. */
+static int
+arm_specific_checks(int fd, const char *name, ElfW(Ehdr) *ehdr)
+{
+ static int all_hf = -1; /* unset */
+ bool is_hf = false;
+ int ret;
+
+ ret = check_arm_attributes_hfabi(fd, ehdr, &is_hf);
+ if (ret != 0)
+ return ret;
+
+#ifdef __ARM_PCS_VFP
+ if (!is_hf)
+ return EINVAL;
+#else
+ if (is_hf)
+ return EINVAL;
+#endif
+
+ if (all_hf == -1)
+ {
+ if (is_hf)
+ all_hf = 1;
+ else
+ all_hf = 0;
+ }
+ else if (all_hf == 1 && !is_hf)
+ return EINVAL;
+ else if (all_hf == 0 && is_hf)
+ return EINVAL;
+ return 0;
+}
+#endif
+
+
+/* Run any architecture-specific checks that might be needed for the
+ current architecture. */
+static int
+arch_specific_checks(int fd, const char *name, ElfW(Ehdr) *ehdr)
+{
+#ifdef __arm__
+ return arm_specific_checks(fd, name, ehdr);
+#endif
+
+ return 0;
+}
+
+
/* Open a file and verify it is an ELF file for this architecture. We
ignore only ELF files for other architectures. Non-ELF files and
ELF files with different header information cause fatal errors since
@@ -1676,6 +1879,7 @@
/* Check .note.ABI-tag if present. */
for (ph = phdr; ph < &phdr[ehdr->e_phnum]; ++ph)
+ {
if (ph->p_type == PT_NOTE && ph->p_filesz >= 32 && ph->p_align >= 4)
{
ElfW(Addr) size = ph->p_filesz;
@@ -1751,6 +1955,20 @@
break;
}
+ if (-1 != fd)
+ {
+ int error = arch_specific_checks(fd, name, ehdr);
+ if (EINVAL == error)
+ {
+ goto close_and_out;
+ }
+ if (0 != error)
+ {
+ errstring = N_("Unable to run arch-specific checks\n");
+ goto call_lose;
+ }
+ }
+ }
free (abi_note_malloced);
}
commit 0b262ca4c64cd9042576ddb9969607c0ea1187d7
Author: Svante Signell <svante.signell@gmail.com>
Date: Wed Oct 30 01:23:41 2019 +0100
hurd: Support for file record locking
* sysdeps/mach/hurd/fcntl.c: Add support for file-record-lock RPC
fixing posix file locking using the flock64 version of struct
flock.
diff --git a/sysdeps/mach/hurd/fcntl.c b/sysdeps/mach/hurd/fcntl.c
index 26243682ca..0e3f0adbd9 100644
--- a/sysdeps/mach/hurd/fcntl.c
+++ b/sysdeps/mach/hurd/fcntl.c
@@ -130,23 +130,75 @@ __libc_fcntl (int fd, int cmd, ...)
case F_SETLKW:
{
struct flock *fl = va_arg (ap, struct flock *);
- int wait = 0;
- va_end (ap);
+
switch (cmd)
{
case F_GETLK:
- errno = ENOSYS;
- return -1;
- case F_SETLKW:
- wait = 1;
- /* FALLTHROUGH */
+ cmd = F_GETLK64;
+ break;
case F_SETLK:
- return __f_setlk (fd, fl->l_type, fl->l_whence,
- fl->l_start, fl->l_len, wait);
+ cmd = F_SETLK64;
+ break;
+ case F_SETLKW:
+ cmd = F_SETLKW64;
+ break;
default:
errno = EINVAL;
return -1;
}
+
+ struct flock64 fl64 = {
+ .l_type = fl->l_type,
+ .l_whence = fl->l_whence,
+ .l_start = fl->l_start,
+ .l_len = fl->l_len,
+ .l_pid = fl->l_pid
+ };
+
+ err = HURD_FD_PORT_USE (d, __file_record_lock (port, cmd, &fl64,
+ MACH_PORT_NULL, MACH_MSG_TYPE_MAKE_SEND));
+
+ /* XXX: To remove once file_record_lock RPC is settled. */
+ if (err == EMIG_BAD_ID || err == EOPNOTSUPP)
+ {
+ int wait = 0;
+ va_end (ap);
+ switch (cmd)
+ {
+ case F_GETLK64:
+ errno = ENOSYS;
+ return -1;
+ case F_SETLKW64:
+ wait = 1;
+ /* FALLTHROUGH */
+ case F_SETLK64:
+ return __f_setlk (fd, fl->l_type, fl->l_whence,
+ fl->l_start, fl->l_len, wait);
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+ }
+ else if (cmd == F_GETLK64)
+ {
+ fl->l_type = fl64.l_type;
+ fl->l_whence = fl64.l_whence;
+ fl->l_start = fl64.l_start;
+ fl->l_len = fl64.l_len;
+ fl->l_pid = fl64.l_pid;
+
+ if ((sizeof fl->l_start != sizeof fl64.l_start
+ && fl->l_start != fl64.l_start)
+ || (sizeof fl->l_len != sizeof fl64.l_len
+ && fl->l_len != fl64.l_len))
+ {
+ errno = EOVERFLOW;
+ return -1;
+ }
+ }
+
+ result = err ? __hurd_dfail (fd, err) : 0;
+ break;
}
case F_GETLK64:
@@ -154,23 +206,34 @@ __libc_fcntl (int fd, int cmd, ...)
case F_SETLKW64:
{
struct flock64 *fl = va_arg (ap, struct flock64 *);
- int wait = 0;
- va_end (ap);
- switch (cmd)
+
+ err = HURD_FD_PORT_USE (d, __file_record_lock (port, cmd, fl,
+ MACH_PORT_NULL, MACH_MSG_TYPE_MAKE_SEND));
+
+ /* XXX: To remove once file_record_lock RPC is settled. */
+ if (err == EMIG_BAD_ID || err == EOPNOTSUPP)
{
- case F_GETLK64:
- errno = ENOSYS;
- return -1;
- case F_SETLKW64:
- wait = 1;
- /* FALLTHROUGH */
- case F_SETLK64:
- return __f_setlk (fd, fl->l_type, fl->l_whence,
- fl->l_start, fl->l_len, wait);
- default:
- errno = EINVAL;
- return -1;
+ int wait = 0;
+ va_end (ap);
+ switch (cmd)
+ {
+ case F_GETLK64:
+ errno = ENOSYS;
+ return -1;
+ case F_SETLKW64:
+ wait = 1;
+ /* FALLTHROUGH */
+ case F_SETLK64:
+ return __f_setlk (fd, fl->l_type, fl->l_whence,
+ fl->l_start, fl->l_len, wait);
+ default:
+ errno = EINVAL;
+ return -1;
+ }
}
+
+ result = err ? __hurd_dfail (fd, err) : 0;
+ break;
}
case F_GETFL: /* Get per-open flags. */
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
Subject: [PATCH] Make F_RDLCK/F_WRLCK atomic
lockf(LOCK_EX) would for instance drop any existing shared lock before taking
the exclusive lock. F_RDLCK/F_WRLCK need atomic changes, so introduce and use
__LOCK_ATOM
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* misc/sys/file.h (__LOCK_ATOMIC): New macro.
* sysdeps/mach/hurd/fcntl.c (__libc_fcntl): Use __LOCK_ATOMIC along LOCK_SH and
LOCK_EX.
XXX: Adding to misc/sys/file.h is questionable
---
misc/sys/file.h | 1 +
sysdeps/mach/hurd/fcntl.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/misc/sys/file.h b/misc/sys/file.h
index 64e8764..a5892db 100644
--- a/misc/sys/file.h
+++ b/misc/sys/file.h
@@ -40,6 +40,7 @@ __BEGIN_DECLS
#define LOCK_SH 1 /* Shared lock. */
#define LOCK_EX 2 /* Exclusive lock. */
#define LOCK_UN 8 /* Unlock. */
+#define __LOCK_ATOMIC 16 /* Atomic update. */
/* Can be OR'd in to one of the above. */
#define LOCK_NB 4 /* Don't block when locking. */
diff --git a/sysdeps/mach/hurd/fcntl.c b/sysdeps/mach/hurd/fcntl.c
index 70180fa..8a8308f 100644
--- a/sysdeps/mach/hurd/f_setlk.c
+++ b/sysdeps/mach/hurd/f_setlk.c
@@ -150,8 +150,8 @@ __libc_fcntl (int fd, int cmd, ...)
switch (type)
{
- case F_RDLCK: cmd = LOCK_SH; break;
- case F_WRLCK: cmd = LOCK_EX; break;
+ case F_RDLCK: cmd = LOCK_SH | __LOCK_ATOMIC; break;
+ case F_WRLCK: cmd = LOCK_EX | __LOCK_ATOMIC; break;
case F_UNLCK: cmd = LOCK_UN; break;
default:
errno = EINVAL;
--
tg: (9a079e2..) t/WRLCK-upgrade (depends on: baseline)
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
Subject: [PATCH] Fix installation of locales-all
Dirty hack to fix installation of locales-all: instead of just locking the
archive extension (which is not supported on hurd-i386), lock it all.
---
locale/programs/locarchive.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -453,7 +453,16 @@ enlarge_archive (struct locarhandle *ah,
}
/* Lock the new file. */
+#ifdef __GNU__
+ struct flock fl;
+ fl.l_whence = SEEK_SET;
+ fl.l_start = 0;
+ fl.l_len = 0;
+ fl.l_type = F_WRLCK;
+ if (fcntl(fd, F_SETLKW, &fl) != 0)
+#else
if (lockf64 (fd, F_LOCK, total) != 0)
+#endif
{
int errval = errno;
unlink (fname);
@@ -613,7 +622,16 @@ open_archive (struct locarhandle *ah, bo
error (EXIT_FAILURE, errno, _("cannot stat locale archive \"%s\""),
archivefname);
+#ifdef __GNU__
+ struct flock fl;
+ fl.l_whence = SEEK_SET;
+ fl.l_start = 0;
+ fl.l_len = 0;
+ fl.l_type = F_WRLCK;
+ if (!readonly && fcntl(fd, F_SETLKW, &fl) == -1)
+#else
if (!readonly && lockf64 (fd, F_LOCK, sizeof (struct locarhead)) == -1)
+#endif
{
close (fd);
......@@ -25,7 +25,6 @@ alpha/submitted-makecontext.diff
arm/local-sigaction.diff
arm/unsubmitted-ldconfig-cache-abi.diff
arm/unsubmitted-ldso-abi-check.diff
arm/local-soname-hack.diff
arm/local-vfp-sysdeps.diff
arm/unsubmitted-ldso-multilib.diff
......@@ -39,7 +38,6 @@ hurd-i386/tg-sysvshm.diff
hurd-i386/tg-thread-cancel.diff
hurd-i386/tg-bigmem.diff
hurd-i386/local-disable-ioctls.diff
hurd-i386/tg-locarchive.diff
hurd-i386/tg-sendmsg-SCM_RIGHTS.diff
hurd-i386/tg-sendmsg-SCM_CREDS.diff
hurd-i386/tg-mach-hurd-link.diff
......@@ -77,8 +75,8 @@ hurd-i386/local-no_unsupported_ioctls.diff
hurd-i386/local-exec_filename.diff
hurd-i386/libpthread_sigs.diff
hurd-i386/local-hurd_sigstate-PLT.diff
hurd-i386/tg-WRLCK-upgrade.diff
hurd-i386/git-renameat2.diff
hurd-i386/git-rlock.diff
i386/local-biarch.diff
i386/unsubmitted-quiet-ldconfig.diff
......