Re: Bug#509874, #508397: undefined reference to umount2 on ia64
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Could someone with IA64 expertise have a look at #508397 in dietlibc please?
Quoting full text for the benefit of the list.
On Sun, 28 Dec 2008 at 15:35:23 +0000, Simon McVittie wrote:
> reopen 508397
> retitle 508397 dietlibc: umount2 still undefined on ia64, and umount is wrong
> block 509874 by 508397
> thanks
>
> Bug#508397 in dietlibc is still not fixed on ia64, causing the FTBFS
> that is #509874. I am not an expert on alpha or ia64 (and don't own an
> example of either) but my interpretation of the problem is:
>
> * Case 1: Typical architectures like i386 have syscalls sys_umount(path, flags)
> and sys_oldumount(path), corresponding to the C library functions
> umount2(path, flags) and umount(path). __NR_umount2 corresponds to
> sys_umount and __NR_umount corresponds to sys_oldumount. dietlibc
> always supported this case.
>
> * Case 2: Old versions of Linux only have a syscall equivalent to the
> modern sys_oldumount(path) and umount(path). __NR_umount corresponds to
> what we would now call sys_oldumount and __NR_umount2 is absent.
> dietlibc always supported this case, and would simply not provide the
> umount2 API (but would still declare it in sys/mount.h, which is
> arguably a bug).
>
> * Case 3: alpha instead has __NR_umount corresponding to sys_umount, and
> __NR_oldumount => sys_oldumount. Micah's patch in dietlibc 0.31-1.1 fixed
> this case.
>
> (Side note: I have no idea what the justification was for making
> alpha inconsistent in the kernel headers)
>
> * Case 4: ia64 never had oldumount. __NR_umount corresponds to
> sys_umount(path, flags) and there is no syscall that only takes a path.
> If you just look at the syscall numbers, this case is
> indistinguishable from case 2 :-(
>
> (Side note: Linux kernel people could have solved this by calling this
> syscall __NR_umount2. *shrug* I'm not a kernel hacker, their ways are a
> mystery to me.)
>
> A quick way to fix this for Debian would be to check for defined(__ia64__)
> in umount.S and umount2.S, although I doubt upstream would like this.
>
> In the IA-64 case, an extern symbol for umount also still needs generating
> somehow, maybe by adding a trivial ia64/umount.c which implements it as
> a call to umount2 (upstream would probably prefer it in assembler, but I
> don't speak fluent assembler).
>
> I attach a proof-of-concept patch. I haven't tested it with util-vserver,
> but it compiles on merulo, and the resulting dietlibc.a contains exactly one
> definition each for umount and umount2.
>
> Regards,
> Simon
> diffstat for dietlibc_0.31-1.1 dietlibc_0.31-1.2
>
> debian/diff/0012-umount-ia64.diff | 14 ++++++++++
> dietlibc-0.31/debian/changelog | 10 +++++++
> dietlibc-0.31/debian/diff/0011-undefined-symbol-umount2-alpha-ia64.diff | 4 +-
> 3 files changed, 26 insertions(+), 2 deletions(-)
>
> diff -u dietlibc-0.31/debian/changelog dietlibc-0.31/debian/changelog
> --- dietlibc-0.31/debian/changelog
> +++ dietlibc-0.31/debian/changelog
> @@ -1,3 +1,13 @@
> +dietlibc (0.31-1.2) UNRELEASED; urgency=low
> +
> + * Untested proof-of-concept
> + * debian/diff/0011-undefined-symbol-umount2-alpha-ia64.diff:
> + treat __NR_umount as the 2-argument version on ia64 (closes: #508397)
> + * debian/diff/0012-umount-ia64.diff: provide an implementation of the
> + 1-argument version of umount on ia64
> +
> + -- Simon McVittie <smcv@debian.org> Sun, 28 Dec 2008 15:16:27 +0000
> +
> dietlibc (0.31-1.1) unstable; urgency=high
>
> * Non-maintainer upload.
> diff -u dietlibc-0.31/debian/diff/0011-undefined-symbol-umount2-alpha-ia64.diff dietlibc-0.31/debian/diff/0011-undefined-symbol-umount2-alpha-ia64.diff
> --- dietlibc-0.31/debian/diff/0011-undefined-symbol-umount2-alpha-ia64.diff
> +++ dietlibc-0.31/debian/diff/0011-undefined-symbol-umount2-alpha-ia64.diff
> @@ -5,7 +5,7 @@
>
> +#if defined(__NR_oldumount) && defined(__NR_umount)
> +syscall(oldumount,umount)
> -+#else
> ++#elif !defined(__ia64__)
> syscall(umount,umount)
> +#endif
> --- a/syscalls.s/umount2.S 4 Jan 2003 22:21:48 -0000 1.2
> @@ -17,5 +17,5 @@
> +#if defined(__NR_umount2)
> syscall(umount2,umount2)
> -+#elif defined(__NR_oldumount) && defined(__NR_umount)
> ++#elif defined(__NR_umount) && (defined(__NR_oldumount) || defined(__ia64__))
> +syscall(umount,umount2)
> #endif
> only in patch2:
> unchanged:
> --- dietlibc-0.31.orig/debian/diff/0012-umount-ia64.diff
> +++ dietlibc-0.31/debian/diff/0012-umount-ia64.diff
> @@ -0,0 +1,14 @@
> +--- a/ia64/Makefile.add 2008-12-28 15:13:51.000000000 +0000
> ++++ b/ia64/Makefile.add 2008-12-28 15:14:10.000000000 +0000
> +@@ -1,2 +1,2 @@
> + VPATH:=ia64:syscalls.s:$(VPATH)
> +-LIBOBJ+=$(OBJDIR)/__time.o $(OBJDIR)/__waitpid.o $(OBJDIR)/__nice.o $(OBJDIR)/__alarm.o
> ++LIBOBJ+=$(OBJDIR)/__time.o $(OBJDIR)/__waitpid.o $(OBJDIR)/__nice.o $(OBJDIR)/__alarm.o $(OBJDIR)/umount-wrapper.o
> +--- /dev/null 2008-12-18 18:10:23.510503709 +0000
> ++++ b/ia64/umount-wrapper.c 2008-12-28 15:13:38.000000000 +0000
> +@@ -0,0 +1,5 @@
> ++#include <sys/mount.h>
> ++
> ++int umount(const char *target) {
> ++ return umount2(target, 0);
> ++}
-----BEGIN PGP SIGNATURE-----
iD8DBQFJV6KRWSc8zVUw7HYRAldIAKCuQtbr6SE8tv6UfmzLyyWAwa2YwgCfTFNr
sFoU6yXfJH/nRyI/X1gQ1Xg=
=YKwf
-----END PGP SIGNATURE-----
Reply to: