[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#193327: libc6.1: IA64 umount needs to set second paramter for sys_umount



Package: libc6.1
Version: 2.3.1-17
Severity: normal


As reported to linux-ia64, followed by a response with a patch:
==========================================================================

From: MONTGOMERY,BOB (HP-FtCollins,ex1) [bob.montgomery@hp.com]
Sent: Tuesday, May 13, 2003 2:07 PM
To: linux-ia64@linuxia64.org
Subject: [Linux-ia64] libc umount and umount2 can't both be right

The problem:  On IA64, the implementation of umount(2) in glibc
and of sys_umount in the kernel results in the kernel performing
umounts with essentially random flag words.

$ dpkg -l | grep libc6
ii libc6.1       2.3.1-17  GNU C Library: Shared libraries and Timezone
ii libc6.1-dev   2.3.1-17  GNU C Library: Development Libraries and Hea

In libc, umount and umount2 are the same code.  They both use
syscall number 1044 without introducing a call layer. 
   
$ gdb /lib/libc.so.6.1
...
(gdb) disas umount
Dump of assembler code for function umount:
0x1a63a0 <umount>:      [MII]       mov r15=1044
0x1a63a1 <umount+1>:                break.i 0x100000;;
0x1a63a2 <umount+2>:                cmp.eq p6,p0=-1,r10;;
0x1a63b0 <umount+16>:
    [BBB] (p06) br.cond.spnt.few 0x2d820 <__libc_start_main+640>
0x1a63b1 <umount+17>:               br.ret.sptk.few b0
0x1a63b2 <umount+18>:               nop.b 0x0;;
End of assembler dump.

(gdb) disas umount2
Dump of assembler code for function umount2:
0x1a63c0 <umount2>:     [MII]       mov r15=1044
0x1a63c1 <umount2+1>:               break.i 0x100000;;
0x1a63c2 <umount2+2>:               cmp.eq p6,p0=-1,r10;;
0x1a63d0 <umount2+16>:
    [BBB] (p06) br.cond.spnt.few 0x2d820 <__libc_start_main+640>
0x1a63d1 <umount2+17>:              br.ret.sptk.few b0
0x1a63d2 <umount2+18>:              nop.b 0x0;;
End of assembler dump.


And from fs/namespace.c, the interface for sys_umount is:

   asmlinkage long sys_umount(char * name, int flags)

The problem is that sys_umount expects two parameters, the sys/umount.h
header only allows the program to specify one parameter for umount(),
and the kernel picks up whatever is in the next output register of the
caller as the flags word.  So umount calls are executed with essentially
random flag words.

The problem could be solved in libc by implementing a wrapper for
umount that looks something like:

extern int umount2 (__const char *__special_file, int __flags) ;

int umount (const char *target)
{
	umount2(target, 0);
}

In this case, umount2 could use the same lightweight method that
it uses now.  

Bob Montgomery, HP

_______________________________________________
Linux-IA64 mailing list
Linux-IA64@linuxia64.org
http://lists.linuxia64.org/lists/listinfo/linux-ia64

==========================================================================

From: Andreas Schwab [schwab@suse.de]
Sent: Wednesday, May 14, 2003 8:43 AM
To: MONTGOMERY,BOB (HP-FtCollins,ex1)
Cc: linux-ia64@linuxia64.org; libc-alpha@sources.redhat.com
Subject: Re: [Linux-ia64] libc umount and umount2 can't both be right

"MONTGOMERY,BOB (HP-FtCollins,ex1)" <bob.montgomery@hp.com> writes:

|> The problem:  On IA64, the implementation of umount(2) in glibc
|> and of sys_umount in the kernel results in the kernel performing
|> umounts with essentially random flag words.

[ SYS_umount is actually umount2 on ia64 ]

Here is a patch:

2003-05-14  Andreas Schwab  <schwab@suse.de>

	* sysdeps/unix/sysv/linux/ia64/umount.c: New file.

--- /dev/null	2003-03-21 07:28:43.000000000 +0100
+++ sysdeps/unix/sysv/linux/ia64/umount.c	2003-05-14 14:33:40.000000000 +0200
@@ -0,0 +1,31 @@
+/* umount system call for Linux/ia64.
+   Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/mount.h>
+#include <errno.h>
+
+#include <sysdep.h>
+#include <bp-checks.h>
+
+/* Unmount a filesystem.  */
+int
+umount (const char *special_file)
+{
+  return INLINE_SYSCALL (umount, 2, CHECK_STRING (special_file), 0);
+}

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

_______________________________________________
Linux-IA64 mailing list
Linux-IA64@linuxia64.org
http://lists.linuxia64.org/lists/listinfo/linux-ia64

-- System Information:
Debian Release: testing/unstable
Architecture: ia64
Kernel: Linux krebs 2.4.20-mckinley #1 Fri May 2 16:50:37 MDT 2003 ia64
Locale: LANG=C, LC_CTYPE=C

Versions of packages libc6.1 depends on:
ii  libdb1-compat                 2.1.3-7    The Berkeley database routines [gl

-- no debconf information




Reply to: