Fix a possible buffer overflow.
The buffer overflow is only theoretical since the device name is max
8 characters in length.
This fixes following gcc 7 warning:
dasdinfo.c: In function 'main':
dasdinfo.c:576:33: warning: '%s' directive writing up to 255 bytes into a
region of size 69 [-Wformat-overflow=]
sprintf(*uidfile,"/sys/block/%s/device/uid",
^~
In file included from /usr/include/stdio.h:862:0,
from dasdinfo.c:15:
/usr/include/bits/stdio2.h:33:10: note: '__builtin___sprintf_chk' output
between 23 and 278 bytes into a destination of size 80
return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__bos (__s), __fmt, __va_arg_pack ());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
The information shown with the --help option did not mention the -v or
--version option which can be used to retrieve the version information.
This patch fixes it.
Fixes: 7179f5de2a1582 ("cpi: Introduce new udev rule and integrate with systemd unit")
Signed-off-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
Reference-ID: VS1706
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
This patch fixes a segfault in the qeth get_layer function that occurs
when an unknown attribute is used in combination with the force option.
Signed-off-by: Hans Wippel <hwippel@linux.vnet.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
This patch adds support for the qeth attributes that are used to
configure VNIC Characteristics.
VNIC Characteristics and BridgePort are mutually exclusive. Thus, this
patch also adds a check function for conflicting settings to the qeth
code. Also, the output when VNIC Characteristics is active is added to
the BridgePort attribute descriptions.
Signed-off-by: Hans Wippel <hwippel@linux.vnet.ibm.com>
Acked-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Re-add a missing line that was removed by accident when creating the
new s390-tools-2.0.0 release from s390-tools-1.39.0.
Fixes: b627b8d8e1 ("Initial s390-tools-2.0.0 import")
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
With GCC 7 we get the following warning as a potential overflow might
happen, if d_name gets too big:
dasdinfo.c: In function 'main':
dasdinfo.c:611:37: warning: '%s' directive writing up to 255 bytes into
a region of size 69 [-Wformat-overflow=]
sprintf(sys_dev_path, "/sys/block/%s/dev", dir_entry->d_name);
^~
dasdinfo.c:611:3: note: 'sprintf' output between 16 and 271 bytes into a
destination of size 80
sprintf(sys_dev_path, "/sys/block/%s/dev", dir_entry->d_name);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This could be fixed by simply increasing the buffer size. However, there
is a little bit more to it and the way files are currently read can be
simplified.
Do this by using the libutil functions to read files and clean up a
little along the way.
Reviewed-by: Stefan Haberland <sth@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Before writing data to the disk, fdasd always checks whether a partition
is specified to prevent writing partition tables to a partition.
However, this also prevents the user from writing partition tables to
loop devices > loop0, even when the force option is specified.
Technically, those are not partitions.
Therefore, allow writing partition tables to partitions when the force
option is specified.
Fixes: #4
Reviewed-by: Stefan Haberland <sth@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
This patch adds the qeth attributes that are used to configure
VNIC Characteristics to lsqeth.
The output of lsqeth comprises two columns: one for attribute names, one
for attribute values. Not all VNIC Characteristics attribute names fit
in the corresponding column. Thus, this patch also increases the width
of the attribute names column by 2 characters.
Signed-off-by: Hans Wippel <hwippel@linux.vnet.ibm.com>
Reviewed-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Currently, the qeth attributes that are used to configure IPv6 NDP proxy
are described as ARP proxy attributes. This patch changes the titles and
descriptions from ARP to NDP.
Signed-off-by: Hans Wippel <hwippel@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Add a new udev rule that is triggered when a KVM VM is started
on the system the very first time. This rule reports over the
sysfs CPI kernel interface that the system is a KVM host.
Currently the cpi.service systemd unit already works with
the CPI sysfs interface. Introduce a new internal utility
script "cpictl" that is used by both the udev rule and
the systemd unit to guarantee coordinated access to the
kernel CPU interface.
Signed-off-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
Reviewed-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Reviewed-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
With gcc 7 we get warnings for code like the following:
44 #define MAX_BUFFER_SIZE_FOR_SUBCHANNEL_ATTRIBUTES 37
406 char buf[MAX_BUFFER_SIZE_FOR_SUBCHANNEL_ATTRIBUTES];
416 device = de_vec[0]->d_name;
417 snprintf(buf, sizeof(buf), "%s", device);
$ grep -r 'd_name\[' /usr/include/
/usr/include/bits/dirent.h: char d_name[256];
The compiler assumes that d_name can be up to 255 characters. Therefore
it produces the following warning:
CC zconf/css/lscss.o
lscss.c: In function 'print_sch_io':
lscss.c:417:31: warning: '%s' directive output may be truncated writing
up to 255 bytes into a region of size 37 [-Wformat-truncation=]
snprintf(buf, sizeof(buf), "%s", device);
^~
In file included from /usr/include/stdio.h:936:0,
from lscss.c:10:
/usr/include/bits/stdio2.h:64:10: note: '__builtin_snprintf' output
between 1 and 256 bytes into a destination of size 37
return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__bos (__s), __fmt, __va_arg_pack ());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fix this and use larger buffer sizes to keep gcc quiet.
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
With gcc 7 we get warnings like the following:
fdasd.c: In function 'main':
fdasd.c:3055:4: warning: this statement may fall through
[-Wimplicit-fallthrough=]
fdasd_exit(&anchor, 0);
^~~~~~~~~~~~~~~~~~~~~~
fdasd.c:3056:3: note: here
default:
^~~~~~~
Fix this by marking functions with "__noreturn" to help gcc.
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
With gcc 7 the compiler checks for sprintf() the maxium possible resulting
string based on the used datatypes.
Example:
struct vol {
...
char bus_id[9];
...
}
sprintf(vol->bus_id, "0.%x.%04x", ssid, vol_parm->devno);
The compiler can prove that "ssid" comes from "u8" and "vol_parm->devno"
from "u16". Therefore the resulting maximum string can be 0.ff.ffff which
requires 10 bytes.
This leads to the following warning:
dfi_s390mv.c: In function 'volumes_init':
dfi_s390mv.c:243:45: warning: '__builtin___snprintf_chk' output may be
truncated before the last format character [-Wformat-truncation=]
snprintf(vol->bus_id, sizeof(vol->bus_id), "0.%x.%04x", ssid,
^~~~~~~~~~~
In file included from /usr/include/stdio.h:936:0,
from dfi_s390mv.c:15:
/usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output
between 9 and 10 bytes into a destination of size 9
return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__bos (__s), __fmt, __va_arg_pack ());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get rid of the warning use 10 instead of 9 bytes for the bus_id.
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
The newer perf_event_open syscall needs a struct
perf_event_attr with the size field set correctly. Older
versions did not even provide this field. However, this
field is now set to the correct size value.
Signed-off-by: Harald Freudenberger <freude@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
There was a too tight buffer allocated on the stack
which was overwritten by just one byte caused to
dump the application on function exit's stack check.
Reviewed all the buffer sizes and adapted them
to the need of the functions.
Signed-off-by: Harald Freudenberger <freude@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
If called without parameters it updates the authors file with new authors
since last release tag. With the -t option a specific tag can be specified.
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
A set of scripts and a short documentation describing how to build
a network boot image simulating a PXELINUX-style boot process.
Starting with QEMU 2.10 it is possible to boot a KVM guest over a
network interface using DHCP/BOOTP. The boot process is triggered by
the network boot firmware that is part of QEMU and follows the usual
network boot pattern: a DHCP request is issued by the client and
answered by a DHCP/BOOTP server. The DHCP reply will contain a
TFPT server identification and a bootfile name. The client will
retrieve the bootfile from the TFTP server, load it into memory
and IPL it.
A very common way of setting up a boot server has been defined
by PXELINUX, an open source implementation of PXE. With PXELINUX
the bootfile is a small network boot loader that will retrieve
a potentially client-specific configuration file containing
further instructions for the final boot process (kernel, ramdisk,...).
The set of sample scripts contained in the netboot directory provide
directions for a Linux distributor or a boot server administrator
on how to build a network boot image usable for a simplified
PXELINUX-style network boot setup for s390.
Note that the sample scripts are implementing only a subset of PXELINUX
functionality, specifically the config file parsing. In order to
get full functionality, a more specialized boot loader program
like petitboot or pxe-kexec must be used in the ramdisk.
Further, a sample Dockerfile is provided along with instructions on how
to build the network boot image in a Docker container.
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
The -d and -e options did not show any failure message when
executed with insufficient permissions (e.g. not root user).
Now the behaviour is equal to the other options: A message
'chzcrypt: Error - can't write to xxx. Wrong permissions or
wrong tools version' is printed.
Signed-off-by: Harald Freudenberger <freude@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
The -c option was listed with <device-id> and the text
explained that device id may be a card or queue device id.
The --capability option only allows a card as argument so
the man page has been corrected to show this now correctly.
Signed-off-by: Harald Freudenberger <freude@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
The sysfs files ap_control_domain_mask and ap_usage_domain_mask
may hold just a string "not supported" if there's no crypto
configuration available. However, lszcrypt always processed
the content of these files as hex number and so produced funny
output if there's no configuration data available.
Signed-off-by: Harald Freudenberger <freude@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
During processing, the zdev-provided dracut module creates a temporary
file using the mktemp tool. Due to a missing path specification
in the filename template, mktemp tries to create the temporary file
in the current working directory which fails if that directory is not
writable:
# cd /sys
# dracut -Nf
mktemp: failed to create file via template 'dracut-zdev.XXXX': No such
file or directory
chzdev: Could not write to file : No such file or directory
sed: can't read : No such file or directory
chzdev: Could not open file : No such file or directory
Fix this by specifying option --tmpdir when calling mktemp.
Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Abbreviated commands are not recognized and zkey issues an invalid
command error.
In is_command(), the abbreviated command string is copied into the
command_str variable. Because this variable is not initialized and,
thus, might contain arbitrary data, a NUL-terminated is not guaranteed.
The following string comparison is very likely to fail. Correct this
problem by comparing up to the length of the command string only.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Few options are displayed with their argument concatenated. This
is due to the nature of the .BR roff macro. Ensure to separate them
with a blank (using "\~" which is an unbreakable space that stretches
like a normal inter-word space when a line is adjusted).
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
When validating an XTS key, the 2 key parts are validated separately.
This can happen on different crypto cards, when more than one crypto
card is available to the system. Each key part can be validated on
a different card, however, the 2 cards need to have the same master
key, thus the master key validation pattern contained in the 2 key
parts are checked.
Signed-off-by: Ingo Franzki <ifranzki@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Set the umask for the zkey process to clear permissions for genernated
secure key files for group and others.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
The LDFLAGS content is added before the object files causing unresolved
symbol dereferences during the build. This actually happens so far on
Debian/Ubuntu instances.
Hence, use LDLIBS instead.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
This commit is based on the s390-tools-1.39.0 version.
Changes on top of s390-tools-1.39.0:
- Add MIT license to all source files
- Add LICENSE file
- Transform REAMDE to README.md (markdown)
- Add AUTHORS.md file
- Add CONTRIBUTING.md file
- Move changelog from README to CHANGELOG.md file
Reviewed-by: Stefan Haberland <sth@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>