KaiGai Kohei [Mon, 22 Oct 2007 08:30:19 +0000 (10:30 +0200)]
mkswap: possible to crash with SELinux relabeling support
When fgetfilecon() is failed with -ENODATA, this process does not
exit. However, "oldcontext" is not initialized in this case, so
context_new() will be called with uninitialized "oldcontext" at the
next.
Finally, it makes a segmentation fault, because context_new() have to
refer an incorrect memory region.
The attached patch fixes this matter using matchpathcon(). If we
cannot obtain actual file context due to -ENODATA, a context which is
returned by matchpathcon() is applied as oldcontext. Then, the type
of the context is relabeled to "swapfile_t" explicitly.
Signed-off-by: KaiGai Kohei <kaigai@kaigai.gr.jp> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Fri, 5 Oct 2007 10:22:13 +0000 (12:22 +0200)]
script: dies on SIGWINCH
The "doinput" process doesn't make a difference between SIGWINCH and
SIGCHILD. This process also sends unnecessary SIGWINCH to child (the
signal is ignored by child). Fixed.
chsh: should use pam_end function to terminate the PAM transaction
chsh will use PAM transaction if macros 'REQUIRE_PASSWORD' and
'HAVE_SECURITY_PAM_MISC_H' are defined, but there is no pam_end function be
used when the PAM transaction be terminated.
This patch also cleanup PAM code in chsh(1).
Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Run pg(1) and type '/<CR>' which is supposed to forward search for the
previously remembered search string. pg(1) will segfault after printing
"No remembered search string:".
Signed-off-by: Rajeev V. Pillai <rajeevvp@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
The --rtc option does not set the name of the device correctly.
It still uses /dev/rtc even if the --rtc option is given.
Testcase:
$ mv /dev/rtc /dev/foo
$ hwclock --show --debug --rtc=/dev/foo
hwclock from util-linux-2.13-rc2
Using /dev interface to clock.
Last drift adjustment done at 1190198135 seconds after 1969
Last calibration done at 1190198135 seconds after 1969
Hardware clock is on local time
Assuming hardware clock is kept in local time.
Waiting for clock tick...
hwclock: open() of /dev/rtc failed, errno=2: No such file or directory.
...got clock tick
Co-Author: Karel Zak <kzak@redhat.com> Signed-off-by: Matthias Koenig <mkoenig@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
Mike Frysinger [Fri, 7 Sep 2007 00:30:16 +0000 (20:30 -0400)]
build-sys: nls/locale handling in util-linux-ng general
On Monday 03 September 2007, Karel Zak wrote:
> http://thread.gmane.org/gmane.linux.utilities.util-linux-ng/590/focus=592
>
> I agree that we need a better support for compilation without
> locales, but from my point of view NLS != all locales stuff. The NLS
> support is subset only.
thinking about the input from everyone, i'd propose the attached ...
Only pull in locale.h as needed and move it to the common nls.h.
mount: chain of symlinks to fstab causes use of pointer after free
Looking at the source in 'mount/realpath.c' we find that when dealing with
the second or later symlink in the chain, a memory block was free()d before
copying its contents to a newly allocated block.
Karel Zak [Mon, 27 Aug 2007 21:31:25 +0000 (23:31 +0200)]
setarch: add --3gb option fot compatibility with Debian linux{32,64} command
Debian had a pre-existing linux{32,64} command which supported only
--3gb and --4gb. Adding support for those options allows setarch to
replace that package.
(Note that long options are expected for all setarch flags in the next
release.)
Signed-off-by: LaMont Jones <lamont@mmjgroup.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 27 Aug 2007 11:16:08 +0000 (13:16 +0200)]
Revert "mount: improve error message when helper program not present"
This reverts commit f8988ebf89c65b624ee19c685d15cab6c77fd9df that
breaks new PO translation. The code is currently in "string freeze"
state. The patch will be applied to 2.14 and 2.13.1.
Sascha Sommer [Tue, 21 Aug 2007 13:13:43 +0000 (15:13 +0200)]
mount: free loop device on failure
Testcase:
$ mount -oloop /etc/group /mnt
ioctl: LOOP_CLR_FD: Device or resource busy
mount: you must specify the filesystem type
$ losetup /dev/loop0
/dev/loop0: [0803]:1931929 (/etc/group)
Matthias Koenig [Fri, 24 Aug 2007 11:05:27 +0000 (13:05 +0200)]
mount: avoid duplicates for root fs in mtab
If the root fs is defined with LABEL or UUID in fstab, avoid
a duplicate entry in mtab when calling mount without existing
mtab.
A mount -f / creates two entries, one for LABEL and another
for the devicename, because canonicalize does not expand the
LABEL or UUID tags.
Karel Zak [Tue, 14 Aug 2007 12:32:45 +0000 (14:32 +0200)]
build-sys: add --disable-makeinstall-chown
A chown-like operations are unexpected when you execute "make install"
as non-root user. For example RPM defines owner+permissions in .spec
file -- you needn't to use root account to create useful RPM package.
Karel Zak [Tue, 14 Aug 2007 10:27:55 +0000 (12:27 +0200)]
docs: add README.licensing
There is not only one unique license for all code in utl-linux-ng. We
have mix of utils with Public Domain, BSD, GPLv2 or GPLv2+. This thing
should be more transparent to avoid misunderstanding.
Karel Zak [Tue, 14 Aug 2007 10:04:09 +0000 (12:04 +0200)]
chsh: don't use empty shell field in /etc/passwd
chsh(1) uses empty shell setting (pw->pw_shell="") as a synonym for
/bin/sh. This convention is silly and unnecessary. (The vsftpd server
will not run if the shell assigned to user "ftp" is a null string --
according to bug rh#103004).
Attila Áfra [Mon, 6 Aug 2007 12:48:37 +0000 (15:48 +0300)]
mount: fix incorrect behavior when more than one fs type is specified
"mount" may fail when more than one file system type is specified, and the
requested access mode is read/write, but the device is read-only. The error
message is: "mount: wrong fs type, bad option, bad superblock on...".
It works only if the correct file system type is the last item in the comma
separated list. This is because when it tries to mount the file system again
in read-only mode, the "types" parameter passed to the "try_mount_one"
function contains only the last item instead of the entire list.
For example, you cannot mount a UDF CD/DVD with "-t udf,iso9660" if you
don't also add the read-only option. This means that some Linux distributions
with the default configuration may not be able to mount UDF disks
automatically (e.g. Ubuntu Dapper - Gutsy Tribe 3).
Signed-off-by: Attila Áfra <attila.afra@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 6 Aug 2007 22:36:31 +0000 (00:36 +0200)]
script: fix race conditions
script(1) uses three processes (doinput, dooutput and doshell). It's
possible that the shell process is finished before the input and
output processes are completely initialized. For example:
$ script -c "printf Bingo"
In particular case the output and input processes read/write data from
shell process in time when the shell process is already done -- so it
hangs on read().
The second problem is that the output process can finish although
there are unread data from finished shell process -- an output in
the typescript file and on terminal is incomplete!
script(1) has to pass:
$ for i in `seq 1 1000`; do script -q -c "printf 'Bingo\n'"; done | grep -c Bingo
1000
Karel Zak [Wed, 1 Aug 2007 13:47:33 +0000 (15:47 +0200)]
blockdev: use LU and LLU for BLKGETSIZE and BLKGETSIZE64
The "blkockdev --getsize" returns negative numbers on i386
for 1Tb devices. The BLKGETSIZE and BLKGETSIZE64 have to
use unsigned long and unsigned long long.
When creating the "/etc/mtab~" lockfile (specifically 'linktargetfile' in the
lock_mtab function), the file is created with incorrect permissions ('000')
which necessitates root to leverage CAP_DAC_OVERRIDE. If proper file modes (it
would appear 0600 would be sufficient) were used in the open this would
function properly with CAP_DAC_OVERRIDE revoked.
$ sysctl -w kernel.cap-bound=0xf7fd7df5
$ mount -t tmpfs /dev/swap /mnt
can't open lock file /etc/mtab~: Permission denied (use -n flag to override)
Signed-off-by: Flávio Leitner <fleitner@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
agetty: 8 bit characters on the Linux console lead to input corruption
8 bit characters on the Linux console lead to input corruption (e.g.
German umlauts). This is easily reproducable by inserting a login name with
umlaut and typing backspace afterwards.
agetty supports tty parity, which leads to getty treating these characters
as a 7bit char with set parity.
This patch by Samuel Thibault adds a new option -8 which disables parity
detection for ttys not used for serial logins.
| Note: With this patch, 8bit characters are just silently dropped (that's
| the expected getty behavior), this is quite neat since you then don't
| even need to backspace your 8bit characters :)
The idle class has no class data. It will print a warning if
a prio argument is given for it, since this will be ignored.
Output for idle class will not contain prio data.
Fix inconsistency between kernel profiling and readprofile.
The range of kernel profiling is between _stext and _etext,
and readprofile tries to extract profiling for all the symbols in
/boot/System.map-2.6.16.11-7-ppc64 from /proc/profile, but there
are more symbols in /boot/System.map-2.6.16.11-7-ppc64 than those
between _stext and _etext.
Signed-off-by: Matthias Koenig <mkoenig@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>