Open srorso opened 6 years ago
I was content to leave this issue be once I saw that it was not caused by a CMake build. I am not skilled in the ways of cckddasd.c and had no wish to be distracted from completing a working CMake build for Hercules.
But the research needed to correct the CMake build also revealed what caused this issue in the first place. It would be churlish of me not to share.
File hmacro.h at line 364 deciphers what kind of large file support should be used by Hercules. Options include full support (off_t
> 4, which means for the moment off_t
= 8), transitional support, which uses alternative functions and an alternative offset type (off64_t
) for file access, or no support.
See the document http://www.unix.org/version2/whatsnew/lfs20mar.html for a description of the standards defined by the Large File Summit, in particular the macros _LFS_LARGEFILE
and _LFS64_LARGEFILE
. Neither macro enables large file support; they just advertise availability of that support.
Unfortunately, hmacros,h only tests whether the target system has large file support available. It does not test whether that support is enabled. On 64-bit systems, on FreeBSD 32-bit systems since FreeBSD 2.0 (ca. 1994), and (I think) Apple Darwin systems since mac OS 10.0, that support is always enabled, so no problem.
On 32-bit GNU/Linux and Solaris systems, large file support is enabled only when _FILE_OFFSET_BITS
is set to 64. Absent that define, 32-bit GNU/Linux and Solaris systems expose a 32-bit off_t
and do not support large files. Header file hmacros.h assumes that such 32-bit GNU/Linux and Solaris systems do support large files when _LFS_LARGEFILE
is present even though _FILE_OFFSET_BITS
is missing and large file support is not enabled. This sets up Hercules to fail.
AIX uses a different macro for large file enablement, but the concept is the same.
I will craft an update to hmacros.h.
Steps to reproduce:
1) clone Hercules 2) ./1Stop --disable-largefile 3) Start Hercules with any operating system 4) at the Hercules console, issue
sfd <ipl-addr>
where is the cuu or subchannel of the system residence volume being ipl'd.
The result is a segment fault. See the following gdb session log excerpt:
(The addressing exception in the above log is a normal result of the operating system finding the end of installed main storage.)
The gdb console log above was created on Ubuntu 16.04 LTS; emulated operating system is DOS/360. The working assumption is that the issue is operating system-independent and occurs when there are non-zero I/O counts for a device queried by the
sfd
console command, or whenquit
is issued and any compressed disk device has a non-zere I/O count.A look at local variables in frame 3, above, (vfwritemsg), shows a partially-built device compression statistics message with really interesting values (see the variable
bfr
):Repeatable on Debian 8.6 (jessie, 32-bit), Debian 9.0 (stretch, 32-bit), Ubuntu 16.04 LTS (Xenial Xerus, 32-bit). Hercules does not segment fault or
sfd <dev-addr>
when built on FreeBSD 11.0 (32-bit) without large file support. 64-bit systems always (?) include large file support.This issue was first revealed because the CMake build for Hercules did not correctly set variables needed for large file support on 32-bit systems. But the issue exists when Hercules is built using GNU autotools and --disable-largefile.
I leave the question of how much attention this requires to others. I am uncertain how many 32-bit systems do not support LFS, nor do I know if the segment fault arises on a 32-bit system that actually does not support LFS, as opposed to trying to turn it off.