Compare commits

..

34 Commits

Author SHA1 Message Date
Jan Höppner
8565e591bd New release s390-tools-2.10.0
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-31 16:26:57 +02:00
Jan Höppner
80443ab629 fdasd: Fix exit status in error cases
In error cases, fdasd returns -1 which results in the return value 255.
This is due to the fact that only the low-order 8 bits are used for the
status value. See 2.13 Status Information [1] in the POSIX standard and
the exit() POSIX man page [2] for more details.

Instead of returning -1, use the EXIT_FAILURE constant to indicate
unsuccessful termination properly.

[1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html
[2]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/exit.html

Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-31 16:00:40 +02:00
Peter Oberparleiter
8b3cc6e4c1 zdev: Improve handling of invalid udev rules
Add basic checking when reading udev rules and print a warning when an
invalid udev rule file is found. This addresses the current inconsistent
behavior:

  - CCW devices: invalid udev rules are considered valid
  - CCW group devices: invalid udev rules are silently ignored
  - zFCP LUNs: invalid rules cause chzdev/lszdev to silently terminate
    with non-zero exit code

Checks include a test for empty or truncated rule files that might be
the result of an interrupted chzdev operation, or a file system or I/O
error.

Note: The recommended way to correct invalid udev rules is to either
remove the offending rules file, or to repeat the associated persistent
configuration step.

Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Reported-by: Steffen Maier <maier@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-31 16:00:40 +02:00
Peter Oberparleiter
5693c16894 zdev: Add helper to report warnings only once
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-31 16:00:40 +02:00
Stefan Haberland
8bf5f8d0e2 zipl: do not overwrite BOOT_IMAGE entry
The zipl internal loader adds a variable BOOT_IMAGE= to the commandline
so that it is visible in the operating system which menu entry has been
chosen.

This entry was overwritten by the stage3 parameter page.

Fix by re-arranging the internal memory layout and putting the command
line extra param, which contains the BOOT_IMAGE entry, at 0xe000.
This location is available because less than  one page is used for the
stack.

Fixes: https://github.com/ibm-s390-tools/s390-tools/issues/67
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-31 15:59:50 +02:00
Ingo Franzki
99ab2db6ad zkey: Fix auto-detection of clear key bitsize for XTS keys
When 'zkey generate' is used with options '--clearkey <file>' and
'--xts', but without the '--keybits <bitsize>' option, then the
auto-detection of the bitsize of the specified clear key fails.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-31 15:59:50 +02:00
Ingo Franzki
784ac7d190 zcryptstats: Add note about loading kernel module chsc_sch
Dependent on kernel config option CHSC_SCH the device node /dev/chsc may
exist per default or not. In case the kernel is built with CHSC_SCH=M,
then the device driver is built as separate kernel module, and must
therefore be loaded using modprobe chsc_sch to make device node /dev/chsc
available.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-31 15:59:50 +02:00
Javier Martinez Canillas
53f166673d zipl: remove trailing spaces from the fields defined in BLS files
Currently the zipl tool doesn't remove trailing spaces from the BLS field
values. So for example if a 'title' field has trailing spaces and is used
as the default, zipl will complain that there's no section with that name:

Using config file '/etc/zipl.conf'
Using BLS config file '/boot/loader/entries/f871a0cf218348c5ba921f61c92b7eac-4.18.0-80.20.el8.s390x.conf'
Using BLS config file '/boot/loader/entries/f871a0cf218348c5ba921f61c92b7eac-0-rescue.conf'
Error: Config file '/etc/zipl.conf': Line 6: no such section 'Red Hat Enterprise Linux (4.18.0-80.20.el8.s390x) 8.1 (Ootpa)'

Since the trailing spaces are also removed from the fields defined in the
zipl.conf file, do the same for the ones that are defined in the BLS file.

Closes: https://github.com/ibm-s390-tools/s390-tools/pull/62
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-18 16:21:17 +02:00
Dimitri John Ledkov
d4ea321a97 zipl/boot/Makefile: fix failure to build, do not specify .lds twice.
Whilst stage3.lds is a dependency, it is specified via SFLAGS and must
not be repeated again along all the .o files. Filter anything but .o
files.

Fixes failure to build from source on Ubuntu 19.10.

Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/s390-tools/+bug/1833238
Closes: https://github.com/ibm-s390-tools/s390-tools/pull/63
Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
Acked-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-18 15:02:06 +02:00
Dimitri John Ledkov
1a63894487 zipl/boot/Makefile: do not suppress echo in verbose builds.
By default, non-verbose builds don't echo the full command anyway. And
supressed echos in verbose builds make it harder to debug the build
failure.

GitHub-ID: https://github.com/ibm-s390-tools/s390-tools/pull/63
Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
Acked-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-18 15:02:06 +02:00
Stefan Haberland
e3fc9478bf zipl: secure IPL man page update
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-15 16:06:53 +02:00
Thomas Richter
f110a77b68 cpumf: Add support for CPU-Measurement Facility counters SVN 6
Add support for CPU-Measurement facility counter second version
number 6. This adds some more counters to the crypto counter set.
Extended counter set is the same as for z14.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-15 16:06:53 +02:00
Ingo Franzki
712433d7f9 util_opt: Correct util_opt_example to handle all possible options
The util_opt_example allows to specify '-l' and '-m, --manual' options,
but does not handle them. This leads to error message 'PANIC: The
application terminated due to an unrecoverable error' with 'Option 'l'
should not be handled here' and the program is aborted.

Add the required case statements in the switch to handle those options.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-15 16:06:53 +02:00
Fedor Loshakov
2c4c210ca8 zdev: add zfcp dix parameter handling
The zfcp kernel module was changed to introduce separate parameters for
selecting DIF and DIF&DIX. This commit implements the corresponding
changes in chzdev and lszdev.

Signed-off-by: Fedor Loshakov <loshakov@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Reviewed-by: Steffen Maier <maier@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-09 16:24:17 +02:00
Karsten Graul
58e2135d87 znetconf: show help and version without ccwgroup driver loaded
When directory $SYSFSDIR/bus/ccwgroup does not exist znetconf issues an
error message and terminates. Its not even possible to get the output of
--help or --version. Fix that by moving the responsible check behind the
parameter evaluation.

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-09 16:24:17 +02:00
Ingo Franzki
5dbe73403f zkey: Fix option check for validate command
The validate command should allow to specify the --no-apqn-check
option even when --apqns is not specified.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-09 16:24:17 +02:00
Ingo Franzki
819513ab38 zkey: Fix misspelled option name in error messages
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-09 16:24:17 +02:00
Ingo Franzki
7e6d782699 zkey: Fix typo in function name
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-09 16:24:17 +02:00
Heiko Carstens
cc82be3135 zipl: add missing inline
please merge with previous commit.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-09 16:24:17 +02:00
Heiko Carstens
1b318fe114 zipl: fix stfle zero padding
The stfle inline assembly returns the number of double words written
(condition code 0) or the double words it would have written
(condition code 3), if the memory array it got as parameter would have
been large enough.

The current stfle implementation assumes that the array is always
large enough and clears those parts of the array that have not been
written to with a subsequent memset call.

If however the array is not large enough memset will get a negative
length parameter, which means that memset clears memory until it gets
an exception and the system crashes.

To fix this simply limit the maximum length. Move also the inline
assembly to an extra function to avoid clobbering of register 0, which
might happen because of the added MIN invocation together with code
instrumentation.

Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-09 16:24:17 +02:00
Jens Remus
87f47f60e4 zdev: Add comment that zfcp LUNs do not support ranges
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-09 16:24:17 +02:00
Jens Remus
0f55dab2de zdev: Add missing includes
The header exit_code.h is required for the exit_code_t type and
the header misc.h for the err_t type.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-09 16:24:17 +02:00
Jens Remus
b58adc26f4 zdev: Cleanup zfcp attribute help
Add missing punctuation, remove duplicate newline, and add missing
spacing.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-09 16:24:17 +02:00
Jens Remus
91509973fe zdev: Do not pass user input as format string
The function util_path_exists() consumes its first parameter as format
string. Passing the user input specified to the chzdev option --export
as-is to the function opens up the possibility for a format string
injection.

Fixes: d542138868 ("zdev: use libutil provided path functions")
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-09 16:24:17 +02:00
Jens Remus
39520546c5 chcp: Use macro S_ISDIR() to test type of file
Testing whether a file is a directory by comparing the struct stat
field st_mode against S_IFDIR is wrong. If st_mode has any access
permission bits set along with the file type code the test will always
fail.

The file type encoded in the struct stat field st_mode is actually an
enumeration. To test whether a file is a directory either extract the
file type from st_mode using the mask S_IFMT and compare it against
S_IFDIR or simply use the macro S_ISDIR().

Fixes: b627b8d8e1 ("Initial s390-tools-2.0.0 import")
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-09 16:24:17 +02:00
Jens Remus
8d1a7fecd0 zkey: Use libutil provided path functions
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Acked-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-09 16:24:17 +02:00
Jens Remus
a6507b330d zkey: Use macro S_ISDIR() to test type of file
Testing whether a file is a directory by masking the struct stat field
st_mode with S_IFDIR is wrong. Depending on the values of the macros
S_IF* block special devices might be considered as directories.

The file type encoded in the struct stat field st_mode is actually an
enumeration. To test whether a file is a directory either extract the
file type from st_mode using the mask S_IFMT and compare it against
S_IFDIR or simply use the macro S_ISDIR().

Fixes: c944f23d7e ("zkey: Add keystore implementation")
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Acked-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-09 16:24:17 +02:00
Jens Remus
d37dc68693 util_path: Get rid of "? true : false"
The functions use the C99 _Bool type in form of the alias bool from
stdbool.h as return type. Scalars are implicitly converted to _Bool.
Values equal to zero to 0 (false). Nonzero values to 1 (true).
Therefore the explicit conversion using the ternary operator ?: with
true and false is not required.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-09 16:24:17 +02:00
Jens Remus
b0007fea98 util_path: Simplify logic and get rid of goto
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-09 16:24:17 +02:00
Jens Remus
1e248abd53 util_path: Use S_IS*() macros to test type of file
Testing whether a file is a directory or a regular file by masking the
struct stat field st_mode with S_IFDIR or S_IFREG is wrong. Depending
on the values of the macros S_IF* sockets and symbolic links might
erroneously be considered as regular files and block special files as
directories.

The file type encoded in the struct stat field st_mode is actually an
enumeration. To test whether a file is a directory or a regular file
either extract the file type from st_mode using the mask S_IFMT and
compare it against S_IFDIR or S_IFREG or simply use the macros S_ISDIR()
and S_ISREG().

Fixes: b627b8d8e1 ("Initial s390-tools-2.0.0 import")
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-09 16:24:17 +02:00
Jens Remus
61baa23e48 zdev: Fix reporting of read-only sysfs attributes
Since commit d542138868 ("zdev: use libutil provided path functions")
lszdev fails to correctly report most read-only sysfs attributes as such
in its detailed information output (options -i or -ii). This is because
the libutil function util_path_is_writable() is not equivalent to the
former function file_writable().
util_path_is_writable() always returns true (the underlying function
access() indicates the file is writable), if the path exists and the user
is root, regardless of the path's effective access permissions. This is
correct for most use cases, as root can effectively read/write any path
regardless of its effective access permissions). util_path_is_writable()
behaves exactly like Bash -w in this regard.
The former function file_writable() examined the file's access permissions
to check if one or more of user, group, and other have write permission.

For lszdev it is irrelevant whether a file is effectively writable by
the current user. Instead it needs to determine whether sysfs attributes
access permissions contain write access in any form. If not it lists
those sysfs attributes in a separate read-only section.

Use the new function util_path_is_readonly_file(), which does explicitly
check the file's effective read and write access permissions. It behaves
similar to the former function file_writable(), except that it does test
whether any of user, group, and other have read permission.

Fixes: d542138868 ("zdev: use libutil provided path functions")
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-09 16:24:17 +02:00
Jens Remus
261763f133 util_path_example: Add example for util_path_is_{read|write}only_file() functions
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-09 16:24:17 +02:00
Jens Remus
f4b2da6c9d util_path: Add functions to test path is read/write-only
For root the functions util_path_is_readable() and util_path_is_writable()
do not take the path's permissions into account. The function access()
succeeds as root is allowed to read/write any file regardless of its
permissions.

Introduce the functions util_path_is_readonly_file() and
util_path_is_writeonly_file() to test whether a path is a regular file and
is either read-only (neither user, group, nor other have write permission,
but one or more of user, group, and other have read permission) or
write-only (neither user, group, nor other have read permission, but one
or more of user, group, and other have write permission).

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-09 16:24:17 +02:00
Jan Höppner
1f607fed3d Prepare for next release
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-09 16:24:17 +02:00
41 changed files with 335 additions and 122 deletions

View File

@@ -1,5 +1,23 @@
Release history for s390-tools (MIT version)
--------------------------------------------
* __v2.10.0 (2019-07-31)__
For Linux kernel version: 5.2
Changes of existing tools:
- zdev: Add zfcp dix parameter handling
- cpumf: Add support for CPU-Measurement Facility counters SVN 6
Bug Fixes:
- libutil: Add functions to test path is read/write-only
- zdev: Fix reporting of read-only sysfs attributes
- zdev: Improve handling of invalid udev rules
- zipl: Fix stfle zero padding
- zipl: Fix build issues
- zipl: Remove trailing spaces from the fields defined in BLS files
- zipl: Do not overwrite BOOT_IMAGE entry
- zkey: Fix auto-detection of clear key bitsize for XTS keys
* __v2.9.0 (2019-05-21)__
For Linux kernel version: 5.0 / 5.1

View File

@@ -5,7 +5,7 @@ COMMON_INCLUDED = true
# The variable "DISTRELEASE" should be overwritten in rpm spec files with:
# "make DISTRELEASE=%{release}" and "make install DISTRELEASE=%{release}"
VERSION = 2
RELEASE = 9
RELEASE = 10
PATCHLEVEL = 0
DISTRELEASE = build-$(shell date +%Y%m%d)
S390_TOOLS_RELEASE = $(VERSION).$(RELEASE).$(PATCHLEVEL)-$(DISTRELEASE)

View File

@@ -6,7 +6,7 @@ include ../common.mak
CPUMF_DATADIR = $(TOOLS_DATADIR)/cpumf
DATA_FILES = cpum-cf-hw-counter.map \
cpum-cf-cfvn-1.ctr cpum-cf-cfvn-3.ctr \
cpum-cf-csvn-generic.ctr \
cpum-cf-csvn-12345.ctr cpum-cf-csvn-6.ctr \
cpum-cf-extended-z10.ctr cpum-cf-extended-z196.ctr \
cpum-cf-extended-zEC12.ctr cpum-sf-modes.ctr \
cpum-cf-extended-z13.ctr cpum-cf-extended-z14.ctr

View File

@@ -267,7 +267,12 @@ sub cpumf_load_ctrdef($;$)
# List of "generic" counter sets
my @def = ();
push @def, "cfvn-" . $version->{cfvn};
push @def, "csvn-generic";
if ($version->{csvn} >= 1 && $version->{csvn} <= 6) {
push @def, "csvn-12345";
}
if ($version->{csvn} == 6) {
push @def, "csvn-6";
}
my $h = {};
# Load counter set definition

View File

@@ -0,0 +1,33 @@
Counter: 80 Name:ECC_FUNCTION_COUNT
Short-Description:ECC Function Count
Description:
This counter counts the
total number of the elliptic-curve cryptography (ECC)
functions issued by the CPU.
.
Counter: 81 Name:ECC_CYCLES_COUNT
Short-Description:ECC Cycles Count
Description:
This counter counts the total
number of CPU cycles when the ECC coprocessor is
busy performing the elliptic-curve cryptography
(ECC) functions issued by the CPU.
.
Counter: 82 Name:ECC_BLOCKED_FUNCTION_COUNT
Short-Description:Ecc Blocked Function Count
Description:
This counter
counts the total number of the elliptic-curve
cryptography (ECC) functions that are issued by the CPU
and are blocked because the ECC coprocessor is
busy performing a function issued by another CPU.
.
Counter: 83 Name:ECC_BLOCKED_CYCLES_COUNT
Short-Description:ECC Blocked Cycles Count
Description:
This counter counts
the total number of CPU cycles blocked for the elliptic-curve
cryptography (ECC) functions issued by the
CPU because the ECC coprocessor is busy perform-
ing a function issued by another CPU.
.

View File

@@ -14,7 +14,8 @@
'cfvn-3' => 'cpum-cf-cfvn-3.ctr',
# CSVN
'csvn-generic' => 'cpum-cf-csvn-generic.ctr',
'csvn-12345' => 'cpum-cf-csvn-12345.ctr',
'csvn-6' => 'cpum-cf-csvn-6.ctr',
# Extended counters
2097 => 'cpum-cf-extended-z10.ctr',
@@ -27,4 +28,7 @@
2965 => 'cpum-cf-extended-z13.ctr',
3906 => 'cpum-cf-extended-z14.ctr',
3907 => 'cpum-cf-extended-z14.ctr',
# Identical with z14
8561 => 'cpum-cf-extended-z14.ctr',
8562 => 'cpum-cf-extended-z14.ctr',
};

View File

@@ -397,7 +397,7 @@ static void fdasd_error(fdasd_anchor_t *anc, enum fdasd_failure why, char *str)
fputc('\n', stderr);
fputs(err_str, stderr);
fdasd_exit(anc, -1);
fdasd_exit(anc, EXIT_FAILURE);
}
/*
@@ -3040,5 +3040,5 @@ int main(int argc, char *argv[])
}
}
return -1;
return EXIT_FAILURE;
}

View File

@@ -3,7 +3,7 @@
* @{
* @brief Work with paths
*
* Copyright IBM Corp. 2016, 2017
* Copyright IBM Corp. 2016, 2019
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
@@ -21,5 +21,7 @@ bool util_path_is_writable(const char *fmt, ...);
bool util_path_is_dir(const char *fmt, ...);
bool util_path_is_reg_file(const char *fmt, ...);
bool util_path_exists(const char *fmt, ...);
bool util_path_is_readonly_file(const char *fmt, ...);
bool util_path_is_writeonly_file(const char *fmt, ...);
#endif /** LIB_UTIL_PATH_H @} */

View File

@@ -112,6 +112,12 @@ int main(int argc, char *argv[])
case OPT_NOSHORT:
printf("Specified: --noshort\n");
break;
case 'l':
printf("Specified: -l\n");
break;
case 'm':
printf("Specified: --manual\n");
break;
default:
util_opt_print_parse_error(c, argv);
return EXIT_FAILURE;

View File

@@ -3,7 +3,7 @@
*
* Work with paths
*
* Copyright IBM Corp. 2016, 2017
* Copyright IBM Corp. 2016, 2019
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
@@ -107,7 +107,7 @@ bool util_path_is_readable(const char *fmt, ...)
bool rc;
UTIL_VASPRINTF(&path, fmt, ap);
rc = access(path, R_OK) == 0 ? true : false;
rc = access(path, R_OK) == 0;
free(path);
return rc;
@@ -131,7 +131,7 @@ bool util_path_is_writable(const char *fmt, ...)
bool rc;
UTIL_VASPRINTF(&path, fmt, ap);
rc = access(path, W_OK) == 0 ? true : false;
rc = access(path, W_OK) == 0;
free(path);
return rc;
@@ -150,18 +150,14 @@ bool util_path_is_writable(const char *fmt, ...)
*/
bool util_path_is_reg_file(const char *fmt, ...)
{
bool rc = false;
struct stat sb;
va_list ap;
char *path;
bool rc;
UTIL_VASPRINTF(&path, fmt, ap);
if (stat(path, &sb)) {
rc = false;
goto free_str;
}
rc = (sb.st_mode & S_IFREG) ? true : false;
free_str:
if (stat(path, &sb) == 0)
rc = S_ISREG(sb.st_mode);
free(path);
return rc;
}
@@ -179,18 +175,14 @@ free_str:
*/
bool util_path_is_dir(const char *fmt, ...)
{
bool rc = false;
struct stat sb;
va_list ap;
char *path;
bool rc;
UTIL_VASPRINTF(&path, fmt, ap);
if (stat(path, &sb)) {
rc = false;
goto free_str;
}
rc = (sb.st_mode & S_IFDIR) ? true : false;
free_str:
if (stat(path, &sb) == 0)
rc = S_ISDIR(sb.st_mode);
free(path);
return rc;
}
@@ -213,7 +205,62 @@ bool util_path_exists(const char *fmt, ...)
bool rc;
UTIL_VASPRINTF(&path, fmt, ap);
rc = access(path, F_OK) == 0 ? true : false;
rc = access(path, F_OK) == 0;
free(path);
return rc;
}
/**
* Test if path exists, is a regular file, and permission is read-only
*
* @param[in] fmt Format string for path to test
* @param[in] ... Variable arguments for format string
*
* @returns true Path exists, is a regular file, and permission does
* not allow any write but allows read
* false Otherwise
*/
bool util_path_is_readonly_file(const char *fmt, ...)
{
bool rc = false;
struct stat sb;
va_list ap;
char *path;
UTIL_VASPRINTF(&path, fmt, ap);
if (stat(path, &sb) == 0) {
rc = S_ISREG(sb.st_mode) &&
(sb.st_mode & 0222) == 0 &&
(sb.st_mode & 0444) != 0;
}
free(path);
return rc;
}
/**
* Test if path exists, is a regular file, and permission is write-only
*
* @param[in] fmt Format string for path to test
* @param[in] ... Variable arguments for format string
*
* @returns true Path exists, is a regular file, and permission does
* not allow any read but allows write
* false Otherwise
*/
bool util_path_is_writeonly_file(const char *fmt, ...)
{
bool rc = false;
struct stat sb;
va_list ap;
char *path;
UTIL_VASPRINTF(&path, fmt, ap);
if (stat(path, &sb) == 0) {
rc = S_ISREG(sb.st_mode) &&
(sb.st_mode & 0222) != 0 &&
(sb.st_mode & 0444) == 0;
}
free(path);
return rc;
}

View File

@@ -1,7 +1,7 @@
/**
* util_path_example - Example program for util_path
*
* Copyright IBM Corp. 2016, 2017
* Copyright IBM Corp. 2016, 2019
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
@@ -13,6 +13,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include "lib/util_path.h"
#include "lib/util_prg.h"
@@ -26,7 +27,7 @@ const struct util_prg prg = {
{
.owner = "IBM Corp.",
.pub_first = 2001,
.pub_last = 2017,
.pub_last = 2019,
},
UTIL_PRG_COPYRIGHT_END
}
@@ -72,9 +73,17 @@ static void test_path(const char *path)
else
printf("reg_file=no ");
if (util_path_is_dir(path))
printf("dir=yes");
printf("dir=yes ");
else
printf("dir=no ");
printf("dir=no ");
if (util_path_is_readonly_file(path))
printf("read-only_file=yes ");
else
printf("read-only_file=no ");
if (util_path_is_writeonly_file(path))
printf("write-only_file=yes");
else
printf("write-only_file=no ");
printf("\n");
}

View File

@@ -3,7 +3,7 @@
*
* Provide main function and command line parsing.
*
* Copyright IBM Corp. 2016, 2017
* Copyright IBM Corp. 2016, 2019
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
@@ -57,7 +57,7 @@ const struct util_prg prg = {
{
.owner = "IBM Corp.",
.pub_first = 2016,
.pub_last = 2017,
.pub_last = 2019,
},
UTIL_PRG_COPYRIGHT_END
}
@@ -236,7 +236,7 @@ static char *get_chp_dir(int css, int id)
char *path;
path = util_path_sysfs("devices/css%x/chp%x.%x", css, css, id);
if ((stat(path, &sb) == 0) && (sb.st_mode == S_IFDIR))
if ((stat(path, &sb) == 0) && S_ISDIR(sb.st_mode))
return path;
free(path);
return util_path_sysfs("devices/css%x/chp%x.%02x", css, css, id);
@@ -296,7 +296,7 @@ static void perform_command(int css, int id)
char *path;
path = get_chp_dir(css, id);
if ((stat(path, &sb) != 0) || ((sb.st_mode & S_IFMT) != S_IFDIR)) {
if ((stat(path, &sb) != 0) || !S_ISDIR(sb.st_mode)) {
printf("Skipping unknown channel-path %x.%02x\n", css, id);
goto out_free_path;
}

View File

@@ -72,6 +72,11 @@ the parallel execution of cryptographic operations.
Cryptographic performance measurement data might not be available when Linux
is running as guest under z/VM or under KVM. \fBzcryptstats\fP then displays an
error message and exits.
.PP
.B Note:
\fBzcryptstats\fP utilizes the device node \fB/dev/chsc\fP. When this device
node is not available, you might have to load kernel module \fBchsc_sch\fP using
\fBmodprobe chsc_sch\fP to make it available.
.
.
.

View File

@@ -2393,7 +2393,11 @@ int main(int argc, char *argv[])
g.chsc_fd = open(CHSC_DEVICE, O_RDWR);
if (g.chsc_fd < 0) {
rc = errno;
warnx("File '%s:' %s", CHSC_DEVICE, strerror(errno));
if (rc == ENOENT)
warnx("You might have to load kernel module 'chsc_sch' "
"using 'modprobe chsc_sch'");
return EXIT_FAILURE;
}
pr_verbose("Device '%s' has been opened successfully", CHSC_DEVICE);

View File

@@ -1128,12 +1128,6 @@ then
exit 1
fi
# check existence of ccwgroup devices
if ! [ -d $CCWGROUPBUS_DIR ]; then
print_error "There are no ccwgroup devices"
exit $RC_NO_CCWGROUP
fi
# determine environment
check_vm_env
@@ -1298,6 +1292,12 @@ then
exit $RC_TOO_MUCH_ARGUMENTS
fi
# check existence of ccwgroup devices
if ! [ -d $CCWGROUPBUS_DIR ]; then
print_error "There are no ccwgroup devices"
exit $RC_NO_CCWGROUP
fi
# react to parsed options
if [ $DO_ADD -eq 1 ]
then

View File

@@ -136,6 +136,12 @@ void _warn(const char *, ...);
fprintf(stderr, "%s:%d: ", __FILE__, __LINE__); \
_warn(__VA_ARGS__); \
} while (0)
void _warn_once(const char *, ...);
#define warn_once(...) do { \
if (debug_enabled) \
fprintf(stderr, "%s:%d: ", __FILE__, __LINE__); \
_warn_once(__VA_ARGS__); \
} while (0)
#define info(...) do { if (!quiet) fprintf(stdout_data ? stderr : stdout, \
__VA_ARGS__); } while (0)
#define verb(...) do { if (verbose) fprintf(stdout_data ? stderr : stdout, \

View File

@@ -40,6 +40,7 @@ struct udev_file {
};
exit_code_t udev_read_file(const char *, struct udev_file **);
bool udev_file_is_empty(struct udev_file *file);
void udev_free_file(struct udev_file *);
void udev_file_print(struct udev_file *);

View File

@@ -1,7 +1,7 @@
/*
* zdev - Modify and display the persistent configuration of devices
*
* Copyright IBM Corp. 2016, 2017
* Copyright IBM Corp. 2016, 2019
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
@@ -12,6 +12,8 @@
#include <stdint.h>
#include "ccw.h"
#include "exit_code.h"
#include "misc.h"
#define ZFCP_LUN_NAME "zfcp-lun"
#define SCSI_ATTR_PREFIX "scsi_dev"

View File

@@ -3,7 +3,7 @@
*
* chzdev: Configure z Systems specific devices
*
* Copyright IBM Corp. 2016, 2017
* Copyright IBM Corp. 2016, 2019
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
@@ -2573,7 +2573,7 @@ static exit_code_t do_export(struct options *opts)
info("Exporting data to standard output\n");
} else {
info("Exporting data to %s\n", opts->export);
if (!util_path_exists(opts->export)) {
if (!util_path_exists("%s", opts->export)) {
rc = path_create(opts->export);
if (rc)
return rc;

View File

@@ -1,7 +1,7 @@
/*
* zdev - Modify and display the persistent configuration of devices
*
* Copyright IBM Corp. 2016, 2017
* Copyright IBM Corp. 2016, 2019
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
@@ -10,6 +10,7 @@
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include "lib/util_path.h"
@@ -521,7 +522,7 @@ void device_read_active_settings(struct device *dev, read_scope_t scope)
s = setting_list_apply_actual(dev->active.settings, a, name,
value);
if (link || (scope == scope_all &&
!util_path_is_writable(path)))
util_path_is_readonly_file("%s", path)))
s->readonly = 1;
if (link)
free(link);

View File

@@ -57,6 +57,7 @@ unsigned long longrun_total;
unsigned long longrun_current;
static struct util_list *delayed_messages;
static struct util_list *warn_once_messages;
static FILE *dryrun_file;
static FILE *dryrun_get_file(void)
@@ -245,6 +246,7 @@ static void dryrun_print(void)
void misc_exit(void)
{
strlist_free(delayed_messages);
strlist_free(warn_once_messages);
if (dryrun_file) {
if (verbose)
dryrun_print();
@@ -362,6 +364,29 @@ void _warn(const char *format, ...)
va_end(args);
}
/* Report a warning: print an error message to standard error. Only print each
* warning once. */
void _warn_once(const char *format, ...)
{
va_list args;
char *str;
va_start(args, format);
if (vasprintf(&str, format, args) == -1)
oom();
va_end(args);
/* Check if message was printed before. */
if (!warn_once_messages)
warn_once_messages = strlist_new();
if (!strlist_find(warn_once_messages, str)) {
fprintf(stderr, "%s", str);
strlist_add(warn_once_messages, "%s", str);
}
free(str);
}
/* Print an error message indicating an out-of-memory situation and exit. */
void oom(void)
{

View File

@@ -10,6 +10,7 @@
#include <dirent.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "lib/util_path.h"
@@ -259,7 +260,7 @@ bool module_set_params(const char *mod, struct setting_list *settings)
struct setting *s;
char *path;
const char *value;
bool result;
bool readonly;
exit_code_t rc;
/* First check if all modified settings can be applied this way. */
@@ -277,9 +278,9 @@ bool module_set_params(const char *mod, struct setting_list *settings)
return false;
}
path = path_get_sys_module_param(mod, s->name);
result = util_path_is_writable(path);
readonly = util_path_is_readonly_file("%s", path);
free(path);
if (!result) {
if (readonly) {
/* Sysfs file is not writable. */
return false;
}

View File

@@ -346,6 +346,21 @@ exit_code_t udev_read_file(const char *path, struct udev_file **file_ptr)
return EXIT_OK;
}
/* Check if a udev file does not contain any statements. */
bool udev_file_is_empty(struct udev_file *file)
{
struct udev_line_node *l;
if (!file)
return true;
util_list_iterate(&file->lines, l) {
if (l->line[0])
return false;
}
return true;
}
static bool get_ids_cb(const char *filename, void *data)
{
char *prefix = data;

View File

@@ -108,8 +108,13 @@ exit_code_t udev_ccw_read_device(struct device *dev, bool autoconf)
rc = udev_read_file(path, &file);
if (rc)
goto out;
udev_file_get_settings(file, st->dev_attribs, state->settings);
state->exists = 1;
if (udev_file_is_empty(file)) {
warn_once("Warning: Invalid udev rule: %s\n", path);
state->exists = 0;
} else {
udev_file_get_settings(file, st->dev_attribs, state->settings);
state->exists = 1;
}
udev_free_file(file);
out:

View File

@@ -163,9 +163,14 @@ exit_code_t udev_ccwgroup_read_device(struct device *dev, bool autoconf)
rc = udev_read_file(path, &file);
if (rc)
goto out;
udev_file_get_settings(file, st->dev_attribs, state->settings);
expand_id(dev, file);
state->exists = 1;
if (udev_file_is_empty(file)) {
warn_once("Warning: Invalid udev rule: %s\n", path);
state->exists = 0;
} else {
udev_file_get_settings(file, st->dev_attribs, state->settings);
expand_id(dev, file);
state->exists = 1;
}
udev_free_file(file);
out:
@@ -344,6 +349,9 @@ static char *read_full_id(const char *path)
out:
free(text);
if (!id)
warn_once("Warning: Invalid udev rule: %s\n", path);
return id;
}

View File

@@ -393,6 +393,9 @@ static exit_code_t udev_read_zfcp_lun_rule(const char *filename,
out:
udev_free_file(file);
if (!node)
warn_once("Warning: Invalid udev rule: %s\n", filename);
return rc;
}
@@ -475,11 +478,17 @@ static void zfcp_lun_node_to_state(struct zfcp_lun_node *node,
struct attrib *a;
char *name;
state->exists = 1;
state->modified = 0;
state->deconfigured = 0;
state->definable = 0;
if (!node) {
state->exists = 0;
return;
}
state->exists = 1;
util_list_iterate(&node->fc_settings->list, s) {
a = attrib_find(attribs, s->name);
setting_list_add(state->settings,
@@ -519,10 +528,7 @@ exit_code_t udev_zfcp_lun_read_device(struct device *dev, bool autoconf)
goto out;
node = zfcp_lun_node_find(luns, dev->devid);
if (node)
zfcp_lun_node_to_state(node, st->dev_attribs, state);
else
rc = EXIT_DEVICE_NOT_FOUND;
zfcp_lun_node_to_state(node, st->dev_attribs, state);
out:
zfcp_lun_node_list_free(luns);

View File

@@ -1,7 +1,7 @@
/*
* zdev - Modify and display the persistent configuration of devices
*
* Copyright IBM Corp. 2016, 2017
* Copyright IBM Corp. 2016, 2019
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
@@ -67,7 +67,7 @@ static struct attrib zfcp_tattr_allow_lun_scan = {
"Control the use of the automatic LUN scanning feature for FCP\n"
"devices that are configured in N_PORT ID Virtualization mode.\n"
" 0: Automatic LUN scanning is disabled\n"
" 1: Automatic LUN scanning is enabled\n\n",
" 1: Automatic LUN scanning is enabled\n",
.nounload = 1,
.defval = "1",
.accept = ACCEPT_ARRAY(ACCEPT_RANGE(0, 1)),
@@ -75,16 +75,28 @@ static struct attrib zfcp_tattr_allow_lun_scan = {
static struct attrib zfcp_tattr_dif = {
.name = "dif",
.title = "Enable DIF/DIX data consistency checking",
.title = "Enable DIF data consistency checking",
.desc =
"Control the use of the end-to-end data consistency checking\n"
"mechanism (DIF/DIX):\n"
"Control the use of the DIF data consistency checking\n"
"mechanism:\n"
" 0: DIF is disabled\n"
" 1: DIF is enabled when supported by the FCP device hardware\n",
.defval = "0",
.accept = ACCEPT_ARRAY(ACCEPT_RANGE(0, 1)),
};
static struct attrib zfcp_tattr_dix = {
.name = "dix",
.title = "Enable DIF&DIX data consistency checking",
.desc =
"Control the use of the end-to-end data consistency checking\n"
"mechanism (DIF&DIX):\n"
" 0: DIF&DIX is disabled\n"
" 1: DIF&DIX is enabled when supported by the FCP device hardware\n",
.defval = "0",
.accept = ACCEPT_ARRAY(ACCEPT_RANGE(0, 1)),
};
static struct attrib zfcp_tattr_datarouter = {
.name = "datarouter",
.title = "Enable hardware data routing",
@@ -160,6 +172,7 @@ static void all_bools_to_num(struct setting_list *list)
util_list_iterate(&list->list, s) {
if (s->attrib == &zfcp_tattr_allow_lun_scan ||
s->attrib == &zfcp_tattr_dif ||
s->attrib == &zfcp_tattr_dix ||
s->attrib == &zfcp_tattr_datarouter ||
s->attrib == &zfcp_tattr_no_auto_port_rescan) {
/* Convert Y to 1 and N to 0. */
@@ -295,6 +308,7 @@ struct devtype zfcp_devtype = {
&zfcp_tattr_queue_depth,
&zfcp_tattr_allow_lun_scan,
&zfcp_tattr_dif,
&zfcp_tattr_dix,
&zfcp_tattr_datarouter,
&zfcp_tattr_no_auto_port_rescan,
&zfcp_tattr_port_scan_ratelimit,

View File

@@ -1,7 +1,7 @@
/*
* zdev - Modify and display the persistent configuration of devices
*
* Copyright IBM Corp. 2016, 2017
* Copyright IBM Corp. 2016, 2019
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
@@ -64,7 +64,7 @@ static struct attrib zfcp_host_attr_port_rescan = {
.title = "Trigger a port rescan for the FCP device",
.desc =
"Rescan FCP device for available remote ports by writing the value 1\n"
"to this attribute\n",
"to this attribute.\n",
.activeonly = 1,
.writeonly = 1,
.accept = ACCEPT_ARRAY(ACCEPT_NUM(1)),

View File

@@ -1,7 +1,7 @@
/*
* zdev - Modify and display the persistent configuration of devices
*
* Copyright IBM Corp. 2016, 2017
* Copyright IBM Corp. 2016, 2019
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
@@ -246,6 +246,7 @@ static unsigned long zfcp_lun_num_ids_in_range(const char *range)
static bool zfcp_lun_is_id_in_range(const char *id, const char *range)
{
/* No ranges are supported on zfcp lun IDs. */
return false;
}
@@ -317,6 +318,7 @@ struct namespace zfcp_lun_namespace = {
/*
* zfcp lun device attributes.
*/
static struct attrib zfcp_lun_attr_failed = {
.name = "failed",
.title = "Check and restart FCP SCSI device recovery",
@@ -1080,6 +1082,7 @@ static exit_code_t zfcp_lun_st_detect_definable(struct subtype *st,
/*
* zfcp lun subtype.
*/
struct subtype zfcp_lun_subtype = {
.super = &subtype_base,

View File

@@ -6,7 +6,7 @@ CFLAGS_BOOT = $(NO_PIE_CFLAGS) -Os -g -I../include -D__ASSEMBLY__ \
-fno-builtin -ffreestanding -fno-asynchronous-unwind-tables \
-fno-delete-null-pointer-checks \
-fexec-charset=IBM1047 -m64 -mpacked-stack \
-mstack-size=8192 -mstack-guard=128 -msoft-float \
-mstack-size=4096 -mstack-guard=128 -msoft-float \
-W -Wall -Wformat-security
FILES = fba0.bin fba1b.bin fba2.bin \
@@ -46,7 +46,7 @@ stage3.exec: head.o stage3.o kdump3.o libc.o sclp.o sclp_stage3.o \
kdump.o entry.o stage3.lds
%.exec: %.o
@STAGE=$$( \
STAGE=$$( \
echo $@ | awk ' \
match($$0,/[0-9]+b*/){ \
print substr($$0,RSTART,RLENGTH) \
@@ -59,7 +59,7 @@ stage3.exec: head.o stage3.o kdump3.o libc.o sclp.o sclp_stage3.o \
2) SFLAGS="$(NO_PIE_LINKFLAGS) -nostdlib -Wl,-T,stage2.lds";; \
3) SFLAGS="$(NO_PIE_LINKFLAGS) -nostdlib -Wl,-T,stage3.lds";; \
esac; \
$(LINK) $$SFLAGS -m64 $^ -o $@
$(LINK) $$SFLAGS -m64 $(filter %.o, $^) -o $@
%.bin: %.exec
$(OBJCOPY) -O binary \
@@ -91,7 +91,7 @@ stage3.bin: stage3.exec
--only-section=.stage2dump.tail \
--only-section=.eckd2dump_mv.tail \
--only-section=.fixup \
--pad-to=0xf000 \
--pad-to=0xe000 \
$< $@
data.o: $(FILES)

View File

@@ -15,7 +15,7 @@
#include "stage2.h"
/* address of extra command line */
#define COMMAND_LINE_EXTRA (0xA000-0x400)
#define COMMAND_LINE_EXTRA 0xE000
/* max command line length */
#define COMMAND_LINE_SIZE 896

View File

@@ -452,6 +452,18 @@ static inline int test_facility(unsigned long nr)
return __test_facility(nr, &S390_lowcore.stfle_fac_list);
}
static inline unsigned long __stfle_asm(u64 *stfle_fac_list, int size)
{
register unsigned long reg0 asm("0") = size - 1;
asm volatile(
".insn s,0xb2b00000,0(%1)" /* stfle */
: "+d" (reg0)
: "a" (stfle_fac_list)
: "memory", "cc");
return reg0;
}
/**
* stfle - Store facility list extended
* @stfle_fac_list: array where facility list can be stored
@@ -470,13 +482,8 @@ static inline void stfle(u64 *stfle_fac_list, int size)
memcpy(stfle_fac_list, &S390_lowcore.stfl_fac_list, 4);
if (S390_lowcore.stfl_fac_list & 0x01000000) {
/* More facility bits available with stfle */
register unsigned long reg0 asm("0") = size - 1;
asm volatile(".insn s,0xb2b00000,0(%1)" /* stfle */
: "+d" (reg0)
: "a" (stfle_fac_list)
: "memory", "cc");
nr = (reg0 + 1) * 8; /* # bytes stored by stfle */
nr = __stfle_asm(stfle_fac_list, size);
nr = MIN((nr + 1) * 8, size * 8UL);
}
memset((char *) stfle_fac_list + nr, 0, size * 8 - nr);
}

View File

@@ -12,7 +12,8 @@
* 0x6000-0x8fff Memory allocation (heap)
* 0x9000-0x9fff Memory to load stage3 parameter to
* 0xa000-0xdfff Memory to load stage3 to
* 0xe000-0xffff Stack
* 0xe000-0xe3ff command line extra
* 0xe400-0xffff Stack
*
* Special memory locations
* ------------------------

View File

@@ -22,7 +22,7 @@
#define OLDMEM_SIZE 0x10420
#define COMMAND_LINE 0x10480
#define COMMAND_LINE_SIZE 896
#define COMMAND_LINE_EXTRA (0xA000-0x400)
#define COMMAND_LINE_EXTRA 0xE000
#define STAGE3_FLAG_SCSI 0x0001000000000000ULL
#define STAGE3_FLAG_KDUMP 0x0002000000000000ULL

View File

@@ -360,11 +360,11 @@ Control the zIPL secure boot support.
auto (default)
Write signatures if available and supported by the system.
1
Signatures are written independent of support indicated by the local
system. Also missing signatures for stage 3 and kernel IPL files
Write signatures regardless of support indicated by the local
system. Missing signatures for stage 3 and kernel IPL files
will result in an error.
0
No signatures will be written.
Do not write signatures.
.SH EXAMPLE

View File

@@ -527,17 +527,17 @@ non-default memory location.
.B Configuration section:
.br
Control the zIPL secure boot support.
Set this option to one of the following:
Set this option to one of the following values:
.IP " - " 12
.BR auto:
Write signatures if available and supported by the system.
.IP " - " 12
.BR 1:
Signatures are written independent of support indicated by the local system.
Also missing signatures for stage 3 and kernel IPL files will result in an error.
Write signatures regardless of support indicated by the local system.
Missing signatures for stage 3 and kernel IPL files will result in an error.
.IP " - " 12
.BR 0:
No signatures will be written.
Do not write signatures.
The default value for
.B 'secure'

View File

@@ -699,6 +699,10 @@ scan_bls_field(struct misc_file_buffer *file, struct scan_token* scan,
}
val_end = file->pos;
while (val_end > val_start && isblank(file->buffer[val_end - 1]))
val_end--;
file->buffer[key_end] = '\0';
file->buffer[val_end] = '\0';
@@ -780,6 +784,7 @@ scan_bls(const char* blsdir, struct scan_token** token, int scan_size)
case EOF:
break;
case '\t':
case '\n':
case '\0':
case ' ':
file.pos++;

View File

@@ -3,7 +3,7 @@
*
* Keystore handling functions
*
* Copyright IBM Corp. 2018
* Copyright IBM Corp. 2018, 2019
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
@@ -133,14 +133,7 @@ static int _keystore_get_key_filenames(struct keystore *keystore,
*/
static int _keystore_reencipher_key_exists(struct key_filenames *file_names)
{
struct stat sb;
int rc;
rc = stat(file_names->renc_filename, &sb);
if (rc == 0 && !S_ISREG(sb.st_mode))
rc = 1;
return !rc;
return util_path_is_reg_file("%s", file_names->renc_filename);
}
/**
@@ -153,20 +146,14 @@ static int _keystore_reencipher_key_exists(struct key_filenames *file_names)
*/
static int _keystore_exists_keyfiles(struct key_filenames *file_names)
{
struct stat sb_skey, sb_info;
int rc_skey, rc_info;
bool rc_skey, rc_info;
rc_skey = stat(file_names->skey_filename, &sb_skey);
if (rc_skey == 0 && !S_ISREG(sb_skey.st_mode))
rc_skey = 1;
rc_skey = util_path_is_reg_file("%s", file_names->skey_filename);
rc_info = util_path_is_reg_file("%s", file_names->info_filename);
rc_info = stat(file_names->info_filename, &sb_info);
if (rc_info == 0 && !S_ISREG(sb_info.st_mode))
rc_info = 1;
if (rc_skey == 0 && rc_info == 0)
if (rc_skey && rc_info)
return 1;
if (rc_skey != 0 && rc_info != 0 &&
if (!rc_skey && !rc_info &&
_keystore_reencipher_key_exists(file_names) == 0)
return 0;
return -1;
@@ -1378,7 +1365,7 @@ struct keystore *keystore_new(const char *directory, bool verbose)
warnx("Can not access '%s': %s", directory, strerror(errno));
return NULL;
}
if (!(sb.st_mode & S_IFDIR)) {
if (!S_ISDIR(sb.st_mode)) {
warnx("'%s' is not a directory", directory);
return NULL;
}
@@ -3063,7 +3050,7 @@ out:
* @returnd 0 if the user confirmed the deletion, a negative errno value
* otherwise
*/
static int _keystore_propmp_for_remove(struct keystore *keystore,
static int _keystore_prompt_for_remove(struct keystore *keystore,
const char *name,
struct key_filenames *file_names)
{
@@ -3129,7 +3116,7 @@ int keystore_remove_key(struct keystore *keystore, const char *name,
goto out;
if (!quiet) {
if (_keystore_propmp_for_remove(keystore, name,
if (_keystore_prompt_for_remove(keystore, name,
&file_names) != 0)
goto out;
}

View File

@@ -267,7 +267,7 @@ static u8 *read_clear_key(const char *keyfile, size_t keybits, bool xts,
return NULL;
}
} else {
keybits = DOUBLE_KEYSIZE_FOR_XTS(size * 8, xts);
keybits = HALF_KEYSIZE_FOR_XTS(size * 8, xts);
}
switch (keybits) {

View File

@@ -1067,7 +1067,7 @@ static int command_generate(void)
return EXIT_FAILURE;
}
if (g.apqns == NULL && g.noapqncheck) {
warnx("Option '--noapqncheck' is only valid together with "
warnx("Option '--no-apqn-check' is only valid together with "
"the '--apqns|-a' option");
util_prg_print_parse_error();
return EXIT_FAILURE;
@@ -1088,7 +1088,7 @@ static int command_generate(void)
return EXIT_FAILURE;
}
if (g.noapqncheck) {
warnx("Option '--noapqncheck' is not valid for "
warnx("Option '--no-apqn-check' is not valid for "
"generating a key outside of the repository");
util_prg_print_parse_error();
return EXIT_FAILURE;
@@ -1317,7 +1317,7 @@ static int command_validate_file(void)
return EXIT_FAILURE;
}
if (g.noapqncheck) {
warnx("Option '--noapqncheck' is not valid for "
warnx("Option '--no-apqn-check' is not valid for "
"validating a key outside of the repository");
util_prg_print_parse_error();
return EXIT_FAILURE;
@@ -1375,13 +1375,6 @@ static int command_validate_repository(void)
{
int rc;
if (g.apqns == NULL && g.noapqncheck) {
warnx("Option '--noapqncheck' is only valid together with "
"the '--apqns|-a' option");
util_prg_print_parse_error();
return EXIT_FAILURE;
}
rc = keystore_validate_key(g.keystore, g.name, g.apqns, g.noapqncheck,
g.pkey_fd);
@@ -1421,7 +1414,7 @@ static int command_import(void)
g.sector_size = 0;
if (g.apqns == NULL && g.noapqncheck) {
warnx("Option '--noapqncheck' is only valid together with "
warnx("Option '--no-apqn-check' is only valid together with "
"the '--apqns|-a' option");
util_prg_print_parse_error();
return EXIT_FAILURE;
@@ -1501,7 +1494,7 @@ static int command_change(void)
return EXIT_FAILURE;
}
if (g.apqns == NULL && g.noapqncheck) {
warnx("Option '--noapqncheck' is only valid together with "
warnx("Option '--no-apqn-check' is only valid together with "
"the '--apqns|-a' option");
util_prg_print_parse_error();
return EXIT_FAILURE;