Commit Graph

13032 Commits

Author SHA1 Message Date
Karel Zak 9a558f9cf6 build-sys: make sure HAVE_TIMER_CREATE defined
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-12-03 11:23:33 +01:00
Ruediger Meier 1866fa6a59 include/c: re-add type checking in container_of()
This reverts parts of commit eb06d5d4, which seems to be based on
Linux kernel commit c7acec71. Unlike the original kernel patch we did
not add that even stronger type checking by using macro BUILD_BUG_ON_MSG.
So basically we removed a useful warning when compiling such
broken code:

      struct st {
            int a;
            char b;
      };
      struct st t = { .a = 1, .b = 2 };
      struct st *x = container_of(&t.a, struct st, b);
      printf("%p %p\n", (void *)&t, (void *)x);

Moreover we also introduced a new compiler warning for intel/icc:
   "arithmetic on pointer to void or function type"

Let's just revert the update of container_of() because adding a
kernel-like BUILD_BUG_ON_MSG would be too much noise and also
problematic (see kernel commit c03567a8). Also note that the original
problem addressed by the kernel commit seems to be only reproducible
with gcc 4.9, not with any later gcc nor clang,icc. Moreover, currently
we have no such use-case in the UL sources anyways.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-12-03 10:29:56 +01:00
Karel Zak 0d79f5805f tests: make lsns-netnsid portable
It seems ip(8) link-show command does not provide link-netnsid in all
cases (versions ?). Let's try to use "ip netns list-id" as fallback.

This commit also add possibility to debug the script by $LOG variable.

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-30 12:24:15 +01:00
Karel Zak 7174b93dfd tests: enlarge backing file for fstab-btrfs
It seems the new limit for Btrfs is 47MiB.

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-30 12:22:48 +01:00
Karel Zak e11d0b8c88 lib/canonicalize: fix typo
Addresses: 8b8277b7a8 (commitcomment-31491031)
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-30 10:25:04 +01:00
Karel Zak df61216c67 libmount: (fuse) follow only user_id= on umount
The option user= is already handled by evaluate_permissions() and by
classic mount and umount usermount support. It seems we do not need
to duplicate support for user= in is_fuse_usermount().

The option user_id= is fuse specific and it's maintained by
libfuse/kernel in /proc/self/mountinfo. This is feature we need to
support in umount(8).

Addresses: https://github.com/karelzak/util-linux/pull/705
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-30 10:25:04 +01:00
Rian Hunter 5fea669e9e libmount: Support unmount FUSE mounts
FUSE mounts don't need an fstab entry to be unmounted.
This checks if a mount is a FUSE mount before checking for
the fstab entry, and if so returns success.

[kzak@redhat.com: - use libmount tools for mount options
                  - use namespace switches
                  - cleanup code

 The requirement is user=<username> or user_id=<uid> in /proc/self/mountinfo
 for fuse filesystem. The logic is the same as for user= mount options, but in
 this case it is not maintained by libmount in userspace, but by fuse FS in kernel.]

Co-Author: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-30 10:25:04 +01:00
Rian Hunter e101a9eb0f lib/canonicalize: do restricted canonicalize in a subprocess
Accessing FUSE mounts require suid/sgid (saved uid) to be equal to the
owner of the mount. If mount is running as a setuid process, swapping
creds by only setting the euid/egid isn't enough to change the
suid/sgid as well. We must do a full setuid()/setgid(), but that
removes our ability to re-assume the identity of the original
euid. The solution is swap creds in a child process, preserving the
creds of the parent.

[kzak@redhat.com: - use switch() rather than if() for fork
		  - use all-io.h
		  - close unused pipe[] ends
		  - be more strict about used types]

Addresses: https://github.com/karelzak/util-linux/pull/705
Co-Author: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-30 10:25:04 +01:00
Karel Zak 0ab0817917 blkid: fix usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-29 13:30:11 +01:00
Karel Zak 5e91d5dd71 blkid: make PART_ENTRY_* tags optional (add --no-part-details)
blkid(8) returns information from partition table also for empty
partitions. This is necessary for example for udev, but it could be
confusing if you care about on-device content only.

Default:
 # blkid -p /dev/md0p1; echo $?
 /dev/md0p1: PART_ENTRY_SCHEME="dos" PART_ENTRY_UUID="6d8796b1-01" PART_ENTRY_TYPE="0x83" PART_ENTRY_NUMBER="1" PART_ENTRY_OFFSET="2048" PART_ENTRY_SIZE="204800" PART_ENTRY_DISK="9:0"
 0

With --no-part-details:
 # blkid -p /dev/md0p1 --no-part-details; echo $?
 2

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1653413
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-29 13:21:36 +01:00
Noel Cragg 4850e97257 mkswap: fix page size warning message
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-29 11:38:41 +01:00
Carlos Santos 9c7431fd18 build-sys: make fdisk, sfdisk, cfdisk optional (enabled by default)
Useful for embedded systems, on which only few utilities are required.

[kzak@redhat.com: - rename to --disable-fdisks
                  - use $enable_{c,s,}fdisk in code]

Signed-off-by: Carlos Santos <casantos@datacom.com.br>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-29 11:33:27 +01:00
Andreas Henriksson df8d991b24 uuidd: Add hardening settings to uuidd.service
This limits what the uuid daemon has access to when it runs.

Further improving this with additional option or making
things even tighter is most likely possible.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2018-11-29 10:37:08 +01:00
Roland Kammerer 627a0efa75 tests: add test images for drbd v08/v09
This adds DRBD meta data images for DRBD versions 8 and 9, as well as
the according expected output.

Signed-off-by: Roland Kammerer <roland.kammerer@linbit.com>
2018-11-29 10:35:25 +01:00
Karel Zak f069b12824 Merge branch 'master' of https://github.com/nyantec/util-linux
* 'master' of https://github.com/nyantec/util-linux:
  fix a bug where switch_root would erroneously try to parse initargs
2018-11-22 12:04:54 +01:00
Karel Zak 46ffa930f2 Merge branch '2018wk41' of https://github.com/kerolasa/util-linux
* '2018wk41' of https://github.com/kerolasa/util-linux:
  include/c: use returns_nonnull function attribute in xalloc.h
2018-11-22 11:51:00 +01:00
Karel Zak 2dd292faf7 Merge branch 'fix-uuid-oids-test' of https://github.com/Whissi/util-linux
* 'fix-uuid-oids-test' of https://github.com/Whissi/util-linux:
  tests: run oids test only when uuidgen tool was built
2018-11-22 11:40:42 +01:00
Andreas Henriksson 8f3d2d76aa fstrim: Add hardening settings to fstrim.service
This limits what the fstrim process has access to when it runs.

PrivateUsers can't be enabled because of:
"If this mode is enabled, all unit processes are run without privileges
in the host user namespace[...]"

Further improving this with additional option or making
things even tighter is most likely possible.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-22 11:13:58 +01:00
Karel Zak 3fa06e0490 setarch: fix obscure sparc32bash use-case
Reported-by: Carlos Santos <casantos@datacom.com.br>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-22 11:03:35 +01:00
Sami Kerola f1b327f8d5
include/c: use returns_nonnull function attribute in xalloc.h
Let the compiler optimize based on the knowledge that the return value will
never be null.

Reference: https://patchwork.ozlabs.org/patch/281112/#631159
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2018-11-21 20:54:18 +00:00
Roland Kammerer ca2071c6ea libblkid: add check for DRBD9
This adds the according meta-data structs + defines and an additional
function to detect DRBD9 magics.

Signed-off-by: Roland Kammerer <roland.kammerer@linbit.com>
2018-11-21 10:48:08 +01:00
Stanislav Brabec d16afd8d15 agetty: Return old behavior with empty logname
c094fcd37 introduced a behavior change: When Return is entered with empty
logname, nothing happens. As it confuses users, return back the old
behavior: re-prompt.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
2018-11-21 10:48:05 +01:00
Andreas Henriksson b7fb72090b libblkid: Fix hidding typo
Spelling error spotted by lintian.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2018-11-21 10:48:00 +01:00
Andreas Henriksson 0f7a57f58b fstrim: Add Documentation key to fstrim.service 2018-11-21 10:47:40 +01:00
Andreas Henriksson c8d61f361c uuidd: Add Documentation key to uuidd.service 2018-11-21 10:47:31 +01:00
Sami Kerola 7004da3d73 fstrim: use long options in systemd service file
Long options are more user friendly.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2018-11-21 10:47:14 +01:00
Paul Asmuth 61bea8d567 Merge branch 'master' of github.com:karelzak/util-linux 2018-11-12 14:22:12 +01:00
Paul Asmuth 9737a16711 fix a bug where switch_root would erroneously try to parse initargs
before this change, switch_root would try to parse all arguments,
including 'initargs', using getopt, which would lead to an 'unrecognized
option' error when trying to pass a flag to the init program
2018-11-12 14:20:45 +01:00
Laurent Vivier f0af42b517 unshare: allow to set user ID and group ID
This patch introduces two new parameters to set the
user ID and the group ID of the program to be executed.
Setting group ID also drops supplementary groups.

The option names used are the same as for nsenter,
-S, --setuid and -G, --setgid.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2018-11-12 11:52:15 +01:00
Laurent Vivier bf8834d4f4 unshare: allow to set a new root
This patch instroduces two new parameters to set the new
root and the new working directory in this new root.

This allows to combine "unshare chroot" in one command,
and doing like this the /proc filesystem is correctly
mounted in the new root with "--mount-proc".

The new parameters are -R, --root and -w, --wd. The names
are the same as for nsenter, except for "-r" that is already
used by "--map-root-user" and replaced by "-R".

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2018-11-12 11:52:14 +01:00
Christian Hesse f8ee3af9fa agetty: fix output of escaped characters
Signed-off-by: Christian Hesse <mail@eworm.de>
2018-11-12 11:32:28 +01:00
Milan Broz 1741d2ea57 libblkid: fix detection of dm-integrity superblock
Some new features in Linux kernel 4.19 for dm-integrity use metadata
format version 2, patch adds it to detection.

Signed-off-by: Milan Broz <gmazyland@gmail.com>
2018-11-12 11:32:24 +01:00
Samuel Thibault d7a412fe0a agetty: fix portability issues
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-12 11:31:17 +01:00
Thomas Deutschmann 8f93c8c71d
tests: run oids test only when uuidgen tool was built
oids test did not check if uuidgen was available.

oids test was also calling uuidgen from PATH which could result
in wrong results if uuidgen from a previous util-linux installation
was used.

With this commit we will check if uuidgen was built and make sure
that we only call the uuidgen binary we just built. If uuidgen is
not available we will skip this test.
2018-11-11 02:18:25 +01:00
Justin Chen e1686b25ac rtcwake: use poweroff if shutdown is not found
Some systems do not have the shutdown command. Use poweroff as an
alternative.

Signed-off-by: Justin Chen <justinpopo6@gmail.com>
2018-11-06 12:34:02 +01:00
Karel Zak 06993ebb11 build-sys: release++ (v2.33)
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-06 12:08:46 +01:00
Karel Zak a592edc4b6 docs: update v2.33-ReleaseNotes
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-06 12:06:56 +01:00
Karel Zak 26d2d1c559 docs: update AUTHORS file
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-06 12:03:34 +01:00
Karel Zak 8f9f4431b2 po: merge changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-06 12:00:00 +01:00
Yuri Chornoivan 24f25d2d88 po: update uk.po (from translationproject.org) 2018-11-06 11:43:56 +01:00
Rafael Fontenelle cbb5b175af po: update pt_BR.po (from translationproject.org) 2018-11-06 11:43:56 +01:00
Jakub Bogusz ae41723297 po: update pl.po (from translationproject.org) 2018-11-06 11:43:56 +01:00
Takeshi Hamasaki 3c0a1d2cec po: update ja.po (from translationproject.org) 2018-11-06 11:43:56 +01:00
Frédéric Marchal c29f58940b po: update fr.po (from translationproject.org) 2018-11-06 11:43:56 +01:00
Antonio Ceballos Roa 3f4e6c013e po: update es.po (from translationproject.org) 2018-11-06 11:43:56 +01:00
Petr Písař df15152ea2 po: update cs.po (from translationproject.org) 2018-11-06 11:43:56 +01:00
Karel Zak a9b0f9b08e Merge branch 'spelling' of https://github.com/jwilk-forks/util-linux 2018-11-06 10:56:03 +01:00
Karel Zak a6f99be447 eject: use err() rather than abort()
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1645920
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-05 10:35:24 +01:00
Jakub Wilk 84bf1f6842 docs: fix typos
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
2018-11-03 20:56:20 +01:00
Stanislav Brabec c094fcd373 agetty: when logname is erased, re-enable reloads
When user starts to enter logname, 8b58ffdd blocks issue reloads.
Reloads remain blocked even if user deletes all typed characters.

Make things visually consistent: If no characters are entered,
re-enable reloads.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
Reviewed-by: Lubomir Rintel <lkundrak@v3.sk>
Tested-by: Lubomir Rintel <lkundrak@v3.sk>
2018-10-31 09:35:48 +01:00