| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
| |
After mkostemp() failed, umask() and free() might alter the errno
to another value. Not sure those calls really changes the errno
or not. But let's be more conservative.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The [u]mount helper path is "/sbin/mount.<type>", the <type> should not
be possible to interpret like a path, for example:
# mkdir /sbin/mount.fake
# mount -t fake/../../../home/user/foo.sh
Anyway, this is *not mount(8) security issue*, because:
- non-root users don't have permissions to specify -t on mount(8)
command line
- /sbin is not writable for regular users
This patch makes libmount more robust for situations when the library
is used by incompetent developers who don't sanitize user's input.
Reported-by: "Horsfall, Matthew" <mhorsfal@akamai.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
| |
It seems we have to call AM_PATH_PYTHON() monster to get
pyexec (shared libs) and python (scripts) directories.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
| |
We should not use the results from mnt_split_optstr() if the function
failed.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
| |
The commit f9906424 ("libmount: add post-mount checks to detect ro/rw")
added necessary check so the comment is not valid anymore.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
|
|
|
|
|
|
|
|
| |
When mnt_split_optstr() failed in the middle, vfs, fs, user optstr's
are freed but not reset. It can lead to double frees at the end of
mnt_fs_{ap,pre}pend_options().
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
|
|
|
|
|
|
| |
When strdup() failed, u, v and f optstr's should be freed.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
|
|
|
|
|
|
|
| |
libmount_debug_mask was OR'ed to MNT_DEBUG_INIT so it should be non-null.
Thus the check is pointless.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
|
|
|
|
|
| |
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* we use pkg-config to get CGLAGS and LIBS, use package specific
config (e.g. python-config) is non-sense.
* default is to follow distribution and use pkg-config module name
"python". This is probably symlink to python2.pc or python3.pc.
* --with-python=2 forces to pkg-module "python2 >= 2"
* --with-python=3 forces to pkg-module "python3 >= 3"
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Leak reported by valgrind:
==14226== 7 bytes in 1 blocks are definitely lost in loss record 1 of 1
==14226== at 0x4C2757B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==14226== by 0x5534839: strdup (in /usr/lib/libc-2.18.so)
==14226== by 0x4E53FE0: mnt_get_username (utils.c:560)
==14226== by 0x4E456A5: mnt_context_prepare_umount (context_umount.c:413)
==14226== by 0x4E464F7: mnt_context_umount (context_umount.c:851)
==14226== by 0x403476: umount_one (umount.c:299)
==14226== by 0x402B34: main (umount.c:629)
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When unmounting some mountpoints as an unprivileged user (via the
'user' option in fstab), the umount fails. Debug output of 'umount
/opt' reveals:
17760: libmount: CXT: [0x22890e0]: do umount
17760: libmount: UTILS: moving to /opt parent
17760: libmount: CXT: current directory moved to / [last_component='opt']
17760: libmount: CXT: [0x22890e0]: umount(2) [target='pt', flags=0x00000000]
valgrind shows the problem:
==23544== Source and destination overlap in memcpy(0x58d1370, 0x58d1371, 4)
==23544== at 0x4C2BBC3: memcpy@@GLIBC_2.14 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23544== by 0x4E537C3: mnt_chdir_to_parent (utils.c:168)
==23544== by 0x4E45E4C: mnt_context_do_umount (context_umount.c:601)
==23544== by 0x4E46513: mnt_context_umount (context_umount.c:855)
==23544== by 0x403476: umount_one (umount.c:299)
==23544== by 0x402B34: main (umount.c:629)
==23544==
ref: https://bugs.archlinux.org/task/36968
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
| |
Avoid code dublication in libmount and time-util.
Proposed-by: Karel Zak <kzak@redhat.com>
Reference: http://markmail.org/message/h7zexvqsieqngtmx
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
|
|
|
|
|
|
|
|
| |
This is necessary for paranoid security guys who believe that things
like "-Wl,-z,relro" or "-Wl,-z,bind_now" is a way how to make the
world a safer place...
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
| |
.. otherwise mnt_free_fs() will try to remove FS from non-existing
list.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* mnt_new_fs() returns object with refcount=1
* mnt_free_fs() does not care about reference counter
* new functions mnt_ref_fs() and mnt_unref_fs()
* mnt_table_add_fs() and mnt_table_rem_fs() uses reference counter
* libmmnt_context uses reference counter for internal FS (as it could be
shared outside the context)
* backwardly incompatible change:
- FS could be deallocated after mnt_table_remove_fs()
* it's recommended to use mnt_unref_fs() after mnt_table_add_fs()
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
| |
It's too problematic and too low-level to support it Py binding.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
| |
It's enough to call mnt_free_fs() to remove fs from the table.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
| |
Currently you have to use mnt_table_remove_fs() + mnt_free_fs() to
destroy the list in the table. This is complicated in same situations.
This patch allows to use mnt_free_fs() only.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
| |
It's better to follow libmnt_context status than allow to play any
nasty games with this important variables in Python.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
| |
* remove unnecessary comments
* cleanup up strings format
* remove direct access to private libmount stuff
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
| |
It's unnecessary and very low-level.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
| |
Cxt -> Context
Tab -> Table
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|