mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
chreipl could only be used as root (effective userid 0), which is explicitly checked upon invocation. "access" call is a wrong method to check super user read/write access for sysfs files, because it is simply always returns 0 (success), despite actual sysfs file permissions or underlying sysfs file callbacks setup. The only guaranteed way of checking sysfs file super user access is an actual open call with the corresponding access mode. The problem is that chreipl always tries to update some sysfs attributes even through they are not specified as command line arguments. Together with a broken sysfs file access checks this leads to inability to use the tool, when some sysfs attributes are read-only (which is the case on older systems where diag308 set does not work). $ chreipl ccw -d 0.0.ec5a chreipl: Could not open "reipl/ccw/parm" (Permission denied) The change fixes access checks, which are in place to handle "diag308 set does not work" case (presence of read-only sysfs attributes). Also replaces R_OK with F_OK in "set_target_type_auto" to underline that only file presence is checked, not an actual read access. Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>