Karel Zak [Thu, 10 Dec 2009 10:59:46 +0000 (11:59 +0100)]
lib: bug (typo) in function MD5Final()
On Wed, Dec 09, 2009 at 10:08:38PM +0000, Jochen Voss wrote:
> while experimenting with coccinelle, I accidentally found what I
> believe is a bug in util-linux-ng release 2.17-rc2 (downloaded
> today). The problem is the following code in lib/md5.c (around line
> 153):
>
> void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
> {
> [...]
> memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
> }
>
> The third argument of memset should probably be the size of 'struct
> MD5Context' instead of the size of the pointer. So my guess is
> that the memset line should be
>
> memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
>
> instead. I don't know whether this actually causes a problem,
> but the comment makes it seem possible that it does.
Note, this typo does not have any impact on the utils in the
util-linux-ng project, because we don't use MD5 for any security
sensitive data or cryptographic stuff. The typo also does not have any
impact to the final MD5 hashes.
Reported-by: Jochen Voss <voss@seehuhn.de> Signed-off-by: Karel Zak <kzak@redhat.com>
Mike Frysinger [Mon, 7 Dec 2009 14:18:17 +0000 (15:18 +0100)]
flock: fix hang when parent ignores SIGCHLD
If flock is executed from a process which has set SIGCHLD to SIG_IGN, then
flock will eat cpu and hang indefinitely if given a command to execute.
So before we fork(), make sure to set SIGCHLD handling back to the default
so that the later waitpid() doesn't freak out on us.
[kzak@redhat.com: - add a check for waitpid() return value]
Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Fri, 4 Dec 2009 14:45:19 +0000 (15:45 +0100)]
build-sys: rewrite TLS detection
* use more robust tls.m4 from gcc project
The old version (from util-linux-ng) used AC_TRY_COMPILE. That's
wrong. We need to use AC_RUN_IFELSE to check that the result is
link-able and executable.
The new version also test it TLS really works in multi-thread
applications.
* we need to detect TLS usability for cross-compiling
* this new version supports __thread keyword only, it seems that we
needn't to care about anything other
Ludwig Nussel [Fri, 27 Nov 2009 09:15:53 +0000 (10:15 +0100)]
fsck: honor nofail option in fsck
analog to mount gracefully ignoring non existing devices if the "nofail"
option is specified in fstab, also have fsck -A skip them. This way it's
possible to have devices optionally not available during boot but still
have them fsck'd if they are there.
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
On Wed, Nov 18, 2009 at 03:33:12PM +0000, Daniel Drake wrote:
> Booting into a system this way just leads to problems because
> you cannot remount the root read-only at shutdown (leading to unclean
> shutdowns).
> Miklos Szeredi pointed out a trick to turn any directory into a
> mount point which avoids this problem. Therefore we can simplify
> switch_root again and simply document that its users should set
Karel Zak [Thu, 19 Nov 2009 14:56:12 +0000 (15:56 +0100)]
mount: check for unsuccessful read-only bind mounts
Linux kernel allows to use MS_RDONLY together with MS_BIND,
unfortunately the MS_RDONLY is silently ignored and the target
mountpoint is still read-write. Then we have 'ro' in mtab and 'rw' in
/proc/mounts.
This patch checks for this situation by access(2) or futimens(2)
(change atime) and mtab is properly updated and user informed.
Reported-by: Terry Burton <tez@terryburton.co.uk> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 4 Nov 2009 14:14:04 +0000 (15:14 +0100)]
fdisk: offer aligned first sector
Typical "new partition" dialog looks like:
Partition number (1-4): 1
First sector (4-818687, default 4):
^^^^^^^^^
The range (e.g. 4-818687) depends on fdisk mode (DOS/non-DOS), but the
default value should be always aligned.
For example RAID5 device in the DOS mode:
Disk /dev/md0: 419 MB, 419168256 bytes
2 heads, 4 sectors/track, 102336 cylinders, total 818688 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 65536 bytes
Disk identifier: 0x081479c3
....
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (4-818687, default 128): <---- !!!
Using default value 128
Last sector, +sectors or +size{K,M,G} (128-818687, default 818687): +10M
Command (m for help): p
....
Device Boot Start End Blocks Id System
/dev/md0p1 128 20607 10240 83 Linux
Karel Zak [Tue, 3 Nov 2009 11:00:23 +0000 (12:00 +0100)]
fdisk: print info and recommendations about alignment
* inform user that phy.sector > log.sector
* warn user when alignment_offset is not provided does, DOS-compatible
mode is enabled and the default geo.sectors are not aligned
* suggest to change display units to sectors (oh yes, fdisk
default are cylinders...)
Karel Zak [Thu, 29 Oct 2009 10:25:59 +0000 (11:25 +0100)]
fdisk: read topology info from libblkid
and print ('p' command) info about logical and physical sectors and
alignment_offset.
minimum_io_size
we don't use physical sector size directly, because on RAIDs is
better to use minimum_io_size (aka stripe chunk size). For disk drives
is minimum_io_size the same value as physical sector size.
alignment_offset
For compatibility with legacy operating systems some vendors provide
disks where logical and physical sectors are aligned at sector 63
(= geometry.sectors). In other words the physical 4KB sectors
start at LBA -1. Then the physical boundary is at:
Karel Zak [Tue, 10 Nov 2009 11:48:34 +0000 (12:48 +0100)]
Revert "libblkid: fix buffer usage in FAT prober"
This patch is unnecessary, the library uses two buffers and the VFAT
superblock is always stored in the probe->sbbuf buffer which is never
overwritten. It seems that FAT fsinfo is also in the superblock
buffer. I was too paranoid :-) Sorry.
Karel Zak [Fri, 6 Nov 2009 22:43:46 +0000 (23:43 +0100)]
build-sys: clean up gtk-doc stuff
* gtk-doc.make does not care about difference between $srcdir and $builddir
and many things are generated into $srcdir. It's pretty difficult to support
out-of-source build...
* gtk-doc expects that many generated files are stored in repository
(we don't use XML templates, all documentation in source code only).
* we don't want to distribute generated html files, the docs is
attractive for very small group of people...
Frankly, it would be nice to found something more robust and better
than gtk-doc.