Compare commits
No commits in common. 'c9' and 'cs10' have entirely different histories.
@ -1 +1 @@
|
|||||||
SOURCES/smartmontools-7.2.tar.gz
|
SOURCES/smartmontools-7.4.tar.gz
|
||||||
|
@ -1 +1 @@
|
|||||||
8d68241096f6ed5b1bbcd8b427fa4a881c1f3e33 SOURCES/smartmontools-7.2.tar.gz
|
b0d7c9ca80768059607b92bf4e373e2822300d3f SOURCES/smartmontools-7.4.tar.gz
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,11 @@
|
|||||||
|
/etc/rc\.d/init\.d/(smartd|smartmontools) -- gen_context(system_u:object_r:fsdaemon_initrc_exec_t,s0)
|
||||||
|
|
||||||
|
/usr/sbin/smartd -- gen_context(system_u:object_r:fsdaemon_exec_t,s0)
|
||||||
|
|
||||||
|
/var/run/smartd\.pid -- gen_context(system_u:object_r:fsdaemon_var_run_t,s0)
|
||||||
|
|
||||||
|
/var/lib/smartmontools(/.*)? gen_context(system_u:object_r:fsdaemon_var_lib_t,s0)
|
||||||
|
|
||||||
|
/etc/smartmontools/smartd_warning.(sh|d/.*) gen_context(system_u:object_r:smartdwarn_script_t,s0)
|
||||||
|
/usr/libexec/smartmontools/smartdnotify -- gen_context(system_u:object_r:smartdwarn_script_t,s0)
|
||||||
|
|
@ -0,0 +1,68 @@
|
|||||||
|
## <summary>Smart disk monitoring daemon.</summary>
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
## <summary>
|
||||||
|
## Read smartmon temporary files.
|
||||||
|
## </summary>
|
||||||
|
## <param name="domain">
|
||||||
|
## <summary>
|
||||||
|
## Domain allowed access.
|
||||||
|
## </summary>
|
||||||
|
## </param>
|
||||||
|
#
|
||||||
|
interface(`smartmon_read_tmp_files',`
|
||||||
|
gen_require(`
|
||||||
|
type fsdaemon_tmp_t;
|
||||||
|
')
|
||||||
|
|
||||||
|
files_search_tmp($1)
|
||||||
|
allow $1 fsdaemon_tmp_t:file read_file_perms;
|
||||||
|
')
|
||||||
|
|
||||||
|
########################################
|
||||||
|
## <summary>
|
||||||
|
## All of the rules required to
|
||||||
|
## administrate an smartmon environment.
|
||||||
|
## </summary>
|
||||||
|
## <param name="domain">
|
||||||
|
## <summary>
|
||||||
|
## Domain allowed access.
|
||||||
|
## </summary>
|
||||||
|
## </param>
|
||||||
|
## <param name="role">
|
||||||
|
## <summary>
|
||||||
|
## Role allowed access.
|
||||||
|
## </summary>
|
||||||
|
## </param>
|
||||||
|
## <rolecap/>
|
||||||
|
#
|
||||||
|
interface(`smartmon_admin',`
|
||||||
|
gen_require(`
|
||||||
|
type fsdaemon_t, fsdaemon_tmp_t, fsdaemon_var_run_t;
|
||||||
|
type fsdaemon_var_lib_t, fsdaemon_initrc_exec_t;
|
||||||
|
type smartdwarn_t, smartdwarn_script_t;
|
||||||
|
')
|
||||||
|
|
||||||
|
allow $1 fsdaemon_t:process signal_perms;
|
||||||
|
ps_process_pattern($1, fsdaemon_t)
|
||||||
|
|
||||||
|
tunable_policy(`deny_ptrace',`',`
|
||||||
|
allow $1 fsdaemon_t:process ptrace;
|
||||||
|
')
|
||||||
|
|
||||||
|
init_labeled_script_domtrans($1, fsdaemon_initrc_exec_t)
|
||||||
|
domain_system_change_exemption($1)
|
||||||
|
role_transition $2 fsdaemon_initrc_exec_t system_r;
|
||||||
|
allow $2 system_r;
|
||||||
|
|
||||||
|
admin_pattern($1, smartdwarn_script_t)
|
||||||
|
|
||||||
|
files_list_tmp($1)
|
||||||
|
admin_pattern($1, fsdaemon_tmp_t)
|
||||||
|
|
||||||
|
files_list_pids($1)
|
||||||
|
admin_pattern($1, fsdaemon_var_run_t)
|
||||||
|
|
||||||
|
files_list_var_lib($1)
|
||||||
|
admin_pattern($1, fsdaemon_var_lib_t)
|
||||||
|
')
|
@ -0,0 +1,195 @@
|
|||||||
|
policy_module(smartmon, 1.13.0)
|
||||||
|
|
||||||
|
########################################
|
||||||
|
#
|
||||||
|
# Declarations
|
||||||
|
#
|
||||||
|
|
||||||
|
## <desc>
|
||||||
|
## <p>
|
||||||
|
## Determine whether smartmon can support
|
||||||
|
## devices on 3ware controllers.
|
||||||
|
## </p>
|
||||||
|
## </desc>
|
||||||
|
gen_tunable(smartmon_3ware, false)
|
||||||
|
|
||||||
|
require {
|
||||||
|
class capability dac_override;
|
||||||
|
type tty_device_t, user_devpts_t, system_mail_t;
|
||||||
|
}
|
||||||
|
|
||||||
|
type fsdaemon_t;
|
||||||
|
type fsdaemon_exec_t;
|
||||||
|
init_daemon_domain(fsdaemon_t, fsdaemon_exec_t)
|
||||||
|
|
||||||
|
type fsdaemon_initrc_exec_t;
|
||||||
|
init_script_file(fsdaemon_initrc_exec_t)
|
||||||
|
|
||||||
|
# runs smartd_warning.sh and smartd_warning.d/*
|
||||||
|
type smartdwarn_t;
|
||||||
|
type smartdwarn_script_t;
|
||||||
|
type_transition fsdaemon_t smartdwarn_script_t:process smartdwarn_t;
|
||||||
|
role system_r types smartdwarn_t;
|
||||||
|
|
||||||
|
files_type(smartdwarn_script_t)
|
||||||
|
|
||||||
|
application_domain(smartdwarn_t, smartdwarn_script_t)
|
||||||
|
domtrans_pattern(fsdaemon_t, smartdwarn_script_t, smartdwarn_t)
|
||||||
|
|
||||||
|
corecmd_exec_bin(smartdwarn_t)
|
||||||
|
corecmd_exec_shell(smartdwarn_t)
|
||||||
|
|
||||||
|
# reads list of users
|
||||||
|
auth_read_passwd_file(smartdwarn_t)
|
||||||
|
|
||||||
|
hostname_domtrans(smartdwarn_t)
|
||||||
|
|
||||||
|
# smartd_warning.sh to run smartd_warning.d/* scripts
|
||||||
|
allow smartdwarn_t smartdwarn_script_t:file execute_no_trans;
|
||||||
|
|
||||||
|
# for wall cmd
|
||||||
|
init_read_utmp(smartdwarn_t)
|
||||||
|
allow smartdwarn_t tty_device_t:chr_file { open write };
|
||||||
|
allow smartdwarn_t user_devpts_t:chr_file { open write };
|
||||||
|
allow smartdwarn_t self:capability { setgid dac_override };
|
||||||
|
files_manage_generic_tmp_files(smartdwarn_t)
|
||||||
|
term_open_unallocated_ttys(smartdwarn_t)
|
||||||
|
term_search_ptys(smartdwarn_t)
|
||||||
|
userdom_use_user_terminals(smartdwarn_t)
|
||||||
|
|
||||||
|
|
||||||
|
optional_policy(`
|
||||||
|
systemd_exec_systemctl(smartdwarn_t)
|
||||||
|
')
|
||||||
|
|
||||||
|
optional_policy(`
|
||||||
|
mta_send_mail(smartdwarn_t)
|
||||||
|
mta_manage_home_rw(smartdwarn_t)
|
||||||
|
')
|
||||||
|
|
||||||
|
# optional_policy(`
|
||||||
|
# unconfined_domain(smartdwarn_t)
|
||||||
|
# ')
|
||||||
|
|
||||||
|
|
||||||
|
type fsdaemon_var_run_t;
|
||||||
|
files_pid_file(fsdaemon_var_run_t)
|
||||||
|
|
||||||
|
type fsdaemon_var_lib_t;
|
||||||
|
files_type(fsdaemon_var_lib_t)
|
||||||
|
|
||||||
|
type fsdaemon_tmp_t;
|
||||||
|
files_tmp_file(fsdaemon_tmp_t)
|
||||||
|
|
||||||
|
ifdef(`enable_mls',`
|
||||||
|
init_ranged_daemon_domain(fsdaemon_t, fsdaemon_exec_t, mls_systemhigh)
|
||||||
|
')
|
||||||
|
|
||||||
|
########################################
|
||||||
|
#
|
||||||
|
# Local policy
|
||||||
|
#
|
||||||
|
|
||||||
|
allow fsdaemon_t self:capability { dac_read_search dac_override kill setpcap setgid sys_rawio sys_admin };
|
||||||
|
dontaudit fsdaemon_t self:capability sys_tty_config;
|
||||||
|
allow fsdaemon_t self:process { getcap setcap signal_perms };
|
||||||
|
allow fsdaemon_t self:fifo_file rw_fifo_file_perms;
|
||||||
|
allow fsdaemon_t self:unix_stream_socket { accept listen };
|
||||||
|
|
||||||
|
manage_dirs_pattern(fsdaemon_t, fsdaemon_tmp_t, fsdaemon_tmp_t)
|
||||||
|
manage_files_pattern(fsdaemon_t, fsdaemon_tmp_t, fsdaemon_tmp_t)
|
||||||
|
files_tmp_filetrans(fsdaemon_t, fsdaemon_tmp_t, { file dir })
|
||||||
|
|
||||||
|
manage_files_pattern(fsdaemon_t, fsdaemon_var_run_t, fsdaemon_var_run_t)
|
||||||
|
files_pid_filetrans(fsdaemon_t, fsdaemon_var_run_t, file)
|
||||||
|
|
||||||
|
manage_dirs_pattern(fsdaemon_t, fsdaemon_var_lib_t, fsdaemon_var_lib_t)
|
||||||
|
manage_files_pattern(fsdaemon_t, fsdaemon_var_lib_t, fsdaemon_var_lib_t)
|
||||||
|
files_var_lib_filetrans(fsdaemon_t, fsdaemon_var_lib_t, { dir file })
|
||||||
|
|
||||||
|
kernel_read_kernel_sysctls(fsdaemon_t)
|
||||||
|
kernel_read_network_state(fsdaemon_t)
|
||||||
|
kernel_read_software_raid_state(fsdaemon_t)
|
||||||
|
kernel_read_system_state(fsdaemon_t)
|
||||||
|
|
||||||
|
auth_use_nsswitch(fsdaemon_t)
|
||||||
|
|
||||||
|
corecmd_exec_all_executables(fsdaemon_t)
|
||||||
|
|
||||||
|
corenet_all_recvfrom_netlabel(fsdaemon_t)
|
||||||
|
corenet_udp_sendrecv_generic_if(fsdaemon_t)
|
||||||
|
corenet_udp_sendrecv_generic_node(fsdaemon_t)
|
||||||
|
corenet_udp_sendrecv_all_ports(fsdaemon_t)
|
||||||
|
|
||||||
|
dev_read_sysfs(fsdaemon_t)
|
||||||
|
dev_read_urand(fsdaemon_t)
|
||||||
|
|
||||||
|
domain_use_interactive_fds(fsdaemon_t)
|
||||||
|
|
||||||
|
files_exec_etc_files(fsdaemon_t)
|
||||||
|
files_read_etc_runtime_files(fsdaemon_t)
|
||||||
|
|
||||||
|
fs_getattr_all_fs(fsdaemon_t)
|
||||||
|
fs_search_auto_mountpoints(fsdaemon_t)
|
||||||
|
fs_read_removable_files(fsdaemon_t)
|
||||||
|
|
||||||
|
mls_file_read_all_levels(fsdaemon_t)
|
||||||
|
|
||||||
|
storage_create_fixed_disk_dev(fsdaemon_t)
|
||||||
|
storage_dev_filetrans_named_fixed_disk(fsdaemon_t)
|
||||||
|
storage_raw_read_fixed_disk(fsdaemon_t)
|
||||||
|
storage_raw_write_fixed_disk(fsdaemon_t)
|
||||||
|
storage_raw_read_removable_device(fsdaemon_t)
|
||||||
|
storage_read_scsi_generic(fsdaemon_t)
|
||||||
|
storage_write_scsi_generic(fsdaemon_t)
|
||||||
|
|
||||||
|
term_dontaudit_search_ptys(fsdaemon_t)
|
||||||
|
|
||||||
|
domain_signull_all_domains(fsdaemon_t)
|
||||||
|
|
||||||
|
auth_read_passwd(fsdaemon_t)
|
||||||
|
|
||||||
|
init_read_utmp(fsdaemon_t)
|
||||||
|
|
||||||
|
libs_exec_ld_so(fsdaemon_t)
|
||||||
|
libs_exec_lib_files(fsdaemon_t)
|
||||||
|
|
||||||
|
logging_send_syslog_msg(fsdaemon_t)
|
||||||
|
|
||||||
|
seutil_sigchld_newrole(fsdaemon_t)
|
||||||
|
|
||||||
|
sysnet_dns_name_resolve(fsdaemon_t)
|
||||||
|
|
||||||
|
userdom_dontaudit_use_unpriv_user_fds(fsdaemon_t)
|
||||||
|
userdom_dontaudit_search_user_home_dirs(fsdaemon_t)
|
||||||
|
userdom_dontaudit_manage_admin_dir(fsdaemon_t)
|
||||||
|
userdom_use_user_terminals(fsdaemon_t)
|
||||||
|
|
||||||
|
tunable_policy(`smartmon_3ware',`
|
||||||
|
allow fsdaemon_t self:process setfscreate;
|
||||||
|
|
||||||
|
storage_create_fixed_disk_dev(fsdaemon_t)
|
||||||
|
storage_delete_fixed_disk_dev(fsdaemon_t)
|
||||||
|
storage_dev_filetrans_fixed_disk(fsdaemon_t)
|
||||||
|
|
||||||
|
selinux_validate_context(fsdaemon_t)
|
||||||
|
|
||||||
|
seutil_read_file_contexts(fsdaemon_t)
|
||||||
|
')
|
||||||
|
|
||||||
|
# this should be no longer needed with smartdwarn_t
|
||||||
|
# optional_policy(`
|
||||||
|
# mta_send_mail(fsdaemon_t)
|
||||||
|
# mta_manage_home_rw(fsdaemon_t)
|
||||||
|
# ')
|
||||||
|
# still creator of the pipe (stdout, stderr) for smartd_warning and mail
|
||||||
|
allow system_mail_t fsdaemon_t:fifo_file { getattr read write append ioctl lock };
|
||||||
|
|
||||||
|
|
||||||
|
optional_policy(`
|
||||||
|
udev_read_db(fsdaemon_t)
|
||||||
|
')
|
||||||
|
|
||||||
|
optional_policy(`
|
||||||
|
virt_read_images(fsdaemon_t)
|
||||||
|
')
|
@ -1,32 +0,0 @@
|
|||||||
diff -up smartmontools-7.2/smartd.cpp.capnotify smartmontools-7.2/smartd.cpp
|
|
||||||
--- smartmontools-7.2/smartd.cpp.capnotify 2020-11-23 19:25:16.000000000 +0100
|
|
||||||
+++ smartmontools-7.2/smartd.cpp 2021-06-16 12:06:03.985526022 +0200
|
|
||||||
@@ -1020,6 +1020,8 @@ static void capabilities_drop_now()
|
|
||||||
capng_clear(CAPNG_SELECT_BOTH);
|
|
||||||
capng_updatev(CAPNG_ADD, (capng_type_t)(CAPNG_EFFECTIVE|CAPNG_PERMITTED),
|
|
||||||
CAP_SYS_ADMIN, CAP_MKNOD, CAP_SYS_RAWIO, -1);
|
|
||||||
+ capng_updatev(CAPNG_ADD, (capng_type_t)(CAPNG_BOUNDING_SET),
|
|
||||||
+ CAP_SETGID, CAP_SETUID, CAP_CHOWN, CAP_FOWNER, CAP_DAC_OVERRIDE, -1);
|
|
||||||
capng_apply(CAPNG_SELECT_BOTH);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1030,9 +1032,8 @@ static void capabilities_check_config(de
|
|
||||||
for (unsigned i = 0; i < configs.size(); i++) {
|
|
||||||
dev_config & cfg = configs[i];
|
|
||||||
if (!cfg.emailaddress.empty() || !cfg.emailcmdline.empty()) {
|
|
||||||
- PrintOut(LOG_INFO, "Device: %s, --capabilites is set, mail will be suppressed.\n",
|
|
||||||
+ PrintOut(LOG_INFO, "Device: %s, --capabilites is set, mail notification may not work.\n",
|
|
||||||
cfg.name.c_str());
|
|
||||||
- cfg.emailaddress.clear(); cfg.emailcmdline.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1633,7 +1634,7 @@ static void Usage()
|
|
||||||
#ifdef HAVE_LIBCAP_NG
|
|
||||||
PrintOut(LOG_INFO," -C, --capabilities\n");
|
|
||||||
PrintOut(LOG_INFO," Drop unneeded Linux process capabilities.\n"
|
|
||||||
- " Warning: Mail notification does not work when used.\n\n");
|
|
||||||
+ " Warning: Mail notification may not work when used.\n\n");
|
|
||||||
#endif
|
|
||||||
PrintOut(LOG_INFO," -d, --debug\n");
|
|
||||||
PrintOut(LOG_INFO," Start smartd in debug mode\n\n");
|
|
@ -1,231 +0,0 @@
|
|||||||
From 7c207dd5d06efccdee7258f832d4216fe5d1d998 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Milan P. Gandhi" <mgandhi@redhat.com>
|
|
||||||
Date: Mon, 17 Oct 2022 14:25:34 +0530
|
|
||||||
Subject: [PATCH 3/3] scsiprint.cpp: applied patch proposed by Yannick Hemery
|
|
||||||
to merge both 'supported' log pages
|
|
||||||
|
|
||||||
---
|
|
||||||
smartmontools-7.1/scsicmds.h | 5 ++
|
|
||||||
smartmontools-7.1/scsiprint.cpp | 103 +++++++++++++++++---------------
|
|
||||||
2 files changed, 59 insertions(+), 49 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/smartmontools-7.1/scsicmds.h b/smartmontools-7.1/scsicmds.h
|
|
||||||
index 516f773..9bd8b21 100644
|
|
||||||
--- a/smartmontools-7.1/scsicmds.h
|
|
||||||
+++ b/smartmontools-7.1/scsicmds.h
|
|
||||||
@@ -167,6 +167,11 @@ struct scsi_readcap_resp {
|
|
||||||
uint16_t l_a_lba; /* Lowest Aligned Logical Block Address */
|
|
||||||
};
|
|
||||||
|
|
||||||
+struct scsi_supp_log_pages {
|
|
||||||
+ uint8_t page_code;
|
|
||||||
+ uint8_t subpage_code;
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
/* SCSI Peripheral types (of interest) */
|
|
||||||
#define SCSI_PT_DIRECT_ACCESS 0x0
|
|
||||||
#define SCSI_PT_SEQUENTIAL_ACCESS 0x1
|
|
||||||
diff --git a/smartmontools-7.1/scsiprint.cpp b/smartmontools-7.1/scsiprint.cpp
|
|
||||||
index 81bed88..21a4929 100644
|
|
||||||
--- a/smartmontools-7.1/scsiprint.cpp
|
|
||||||
+++ b/smartmontools-7.1/scsiprint.cpp
|
|
||||||
@@ -39,6 +39,9 @@ uint8_t gBuf[GBUF_SIZE];
|
|
||||||
#define LOG_RESP_LONG_LEN ((62 * 256) + 252)
|
|
||||||
#define LOG_RESP_TAPE_ALERT_LEN 0x144
|
|
||||||
|
|
||||||
+/* Supported log pages + Supported log pages and subpages maximum count */
|
|
||||||
+#define SCSI_SUPP_LOG_PAGES_MAX_COUNT (252 + (62 * 128) + 126)
|
|
||||||
+
|
|
||||||
/* Log pages supported */
|
|
||||||
static bool gSmartLPage = false; /* Informational Exceptions log page */
|
|
||||||
static bool gTempLPage = false;
|
|
||||||
@@ -118,14 +121,17 @@ static void
|
|
||||||
scsiGetSupportedLogPages(scsi_device * device)
|
|
||||||
{
|
|
||||||
bool got_subpages = false;
|
|
||||||
- int k, bump, err, resp_len, num_unreported, num_unreported_spg;
|
|
||||||
- int resp_len_pg0_0 = 0;
|
|
||||||
- int resp_len_pg0_ff = 0; /* in SPC-4, response length of supported
|
|
||||||
- * log pages _and_ log subpages */
|
|
||||||
+ int k, err, resp_len, num_unreported, num_unreported_spg;
|
|
||||||
+ int supp_lpg_and_spg_count = 0;
|
|
||||||
+
|
|
||||||
const uint8_t * up;
|
|
||||||
uint8_t sup_lpgs[LOG_RESP_LEN];
|
|
||||||
+ struct scsi_supp_log_pages supp_lpg_and_spg[SCSI_SUPP_LOG_PAGES_MAX_COUNT];
|
|
||||||
|
|
||||||
memset(gBuf, 0, LOG_RESP_LEN);
|
|
||||||
+ memset(supp_lpg_and_spg, 0, sizeof(supp_lpg_and_spg));
|
|
||||||
+
|
|
||||||
+ /* Get supported log pages */
|
|
||||||
if ((err = scsiLogSense(device, SUPPORTED_LPAGES, 0, gBuf,
|
|
||||||
LOG_RESP_LEN, 0 /* do double fetch */))) {
|
|
||||||
if (scsi_debugmode > 0)
|
|
||||||
@@ -140,12 +146,23 @@ scsiGetSupportedLogPages(scsi_device * device)
|
|
||||||
logSenStr, scsiErrString(err));
|
|
||||||
if (err)
|
|
||||||
return;
|
|
||||||
- memcpy(sup_lpgs, gBuf, LOG_RESP_LEN);
|
|
||||||
- } else if ((scsi_version >= SCSI_VERSION_SPC_4) &&
|
|
||||||
- (scsi_version <= SCSI_VERSION_HIGHEST)) {
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ memcpy(sup_lpgs, gBuf, LOG_RESP_LEN);
|
|
||||||
+ resp_len = gBuf[3];
|
|
||||||
+ up = gBuf + LOGPAGEHDRSIZE;
|
|
||||||
+
|
|
||||||
+ for (k = 0; k < resp_len; k += 1) {
|
|
||||||
+ uint8_t page_code = 0x3f & up[k];
|
|
||||||
+ supp_lpg_and_spg[supp_lpg_and_spg_count++] = {page_code, 0};
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* Get supported log pages and subpages. Most drives seems to include the
|
|
||||||
+ supported log pages here as well, but some drives such as the Samsung
|
|
||||||
+ PM1643a will only report the additional log pages with subpages here */
|
|
||||||
+ if ((scsi_version >= SCSI_VERSION_SPC_4) &&
|
|
||||||
+ (scsi_version <= SCSI_VERSION_HIGHEST)) {
|
|
||||||
/* unclear what code T10 will choose for SPC-6 */
|
|
||||||
- memcpy(sup_lpgs, gBuf, LOG_RESP_LEN);
|
|
||||||
- resp_len_pg0_0 = sup_lpgs[3];
|
|
||||||
if ((err = scsiLogSense(device, SUPPORTED_LPAGES, SUPP_SPAGE_L_SPAGE,
|
|
||||||
gBuf, LOG_RESP_LONG_LEN,
|
|
||||||
-1 /* just single not double fetch */))) {
|
|
||||||
@@ -153,6 +170,7 @@ scsiGetSupportedLogPages(scsi_device * device)
|
|
||||||
pout("%s for supported pages and subpages failed [%s]\n",
|
|
||||||
logSenStr, scsiErrString(err));
|
|
||||||
} else {
|
|
||||||
+ /* Ensure we didn't get the same answer than without the subpages */
|
|
||||||
if (0 == memcmp(gBuf, sup_lpgs, LOG_RESP_LEN)) {
|
|
||||||
if (scsi_debugmode > 0)
|
|
||||||
pout("%s: %s ignored subpage field, bad\n",
|
|
||||||
@@ -163,48 +181,34 @@ scsiGetSupportedLogPages(scsi_device * device)
|
|
||||||
pout("%s supported subpages is bad SPF=%u SUBPG=%u\n",
|
|
||||||
logSenRspStr, !! (0x40 & gBuf[0]), gBuf[2]);
|
|
||||||
} else {
|
|
||||||
- resp_len_pg0_ff = sg_get_unaligned_be16(gBuf + 2);
|
|
||||||
got_subpages = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- } else {
|
|
||||||
- memcpy(sup_lpgs, gBuf, LOG_RESP_LEN);
|
|
||||||
- resp_len_pg0_0 = sup_lpgs[3];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (got_subpages) {
|
|
||||||
resp_len = sg_get_unaligned_be16(gBuf + 2);
|
|
||||||
- if (resp_len_pg0_ff <= resp_len_pg0_0) {
|
|
||||||
- /* something is rotten ....., ignore SUPP_SPAGE_L_SPAGE */
|
|
||||||
- resp_len = resp_len_pg0_0;
|
|
||||||
- bump = 1;
|
|
||||||
- up = sup_lpgs + LOGPAGEHDRSIZE;
|
|
||||||
- got_subpages = false;
|
|
||||||
- (void)got_subpages; // not yet used below, suppress warning
|
|
||||||
- } else {
|
|
||||||
- resp_len = resp_len_pg0_ff;
|
|
||||||
- bump = 2;
|
|
||||||
- up = gBuf + LOGPAGEHDRSIZE;
|
|
||||||
+ up = gBuf + LOGPAGEHDRSIZE;
|
|
||||||
+ for (k = 0; k < resp_len; k += 2) {
|
|
||||||
+ uint8_t page_code = 0x3f & up[k];
|
|
||||||
+ uint8_t subpage_code = up[k+1];
|
|
||||||
+ supp_lpg_and_spg[supp_lpg_and_spg_count++] = {page_code, subpage_code};
|
|
||||||
}
|
|
||||||
- } else {
|
|
||||||
- resp_len = resp_len_pg0_0;
|
|
||||||
- bump = 1;
|
|
||||||
- up = sup_lpgs + LOGPAGEHDRSIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ num_unreported = 0;
|
|
||||||
num_unreported_spg = 0;
|
|
||||||
- for (num_unreported = 0, k = 0; k < resp_len; k += bump, up += bump) {
|
|
||||||
- uint8_t pg_num = 0x3f & up[0];
|
|
||||||
- uint8_t sub_pg_num = (0x40 & up[0]) ? up[1] : 0;
|
|
||||||
+ for (k = 0; k < supp_lpg_and_spg_count; k += 1) {
|
|
||||||
+ struct scsi_supp_log_pages supp_lpg = supp_lpg_and_spg[k];
|
|
||||||
|
|
||||||
- switch (pg_num)
|
|
||||||
+ switch (supp_lpg.page_code)
|
|
||||||
{
|
|
||||||
case SUPPORTED_LPAGES:
|
|
||||||
- if (! ((NO_SUBPAGE_L_SPAGE == sub_pg_num) ||
|
|
||||||
- (SUPP_SPAGE_L_SPAGE == sub_pg_num))) {
|
|
||||||
+ if (! ((NO_SUBPAGE_L_SPAGE == supp_lpg.subpage_code) ||
|
|
||||||
+ (SUPP_SPAGE_L_SPAGE == supp_lpg.subpage_code))) {
|
|
||||||
if (scsi_debugmode > 1)
|
|
||||||
pout("%s: Strange Log page number: 0x0,0x%x\n",
|
|
||||||
- __func__, sub_pg_num);
|
|
||||||
+ __func__, supp_lpg.subpage_code);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case READ_ERROR_COUNTER_LPAGE:
|
|
||||||
@@ -223,13 +227,13 @@ scsiGetSupportedLogPages(scsi_device * device)
|
|
||||||
gNonMediumELPage = true;
|
|
||||||
break;
|
|
||||||
case TEMPERATURE_LPAGE:
|
|
||||||
- if (NO_SUBPAGE_L_SPAGE == sub_pg_num)
|
|
||||||
+ if (NO_SUBPAGE_L_SPAGE == supp_lpg.subpage_code)
|
|
||||||
gTempLPage = true;
|
|
||||||
- else if (ENVIRO_REP_L_SPAGE == sub_pg_num)
|
|
||||||
+ else if (ENVIRO_REP_L_SPAGE == supp_lpg.subpage_code)
|
|
||||||
gEnviroReportingLPage = true;
|
|
||||||
- else if (ENVIRO_LIMITS_L_SPAGE == sub_pg_num)
|
|
||||||
+ else if (ENVIRO_LIMITS_L_SPAGE == supp_lpg.subpage_code)
|
|
||||||
gEnviroLimitsLPage = true;
|
|
||||||
- else if (SUPP_SPAGE_L_SPAGE != sub_pg_num) {
|
|
||||||
+ else if (SUPP_SPAGE_L_SPAGE != supp_lpg.subpage_code) {
|
|
||||||
++num_unreported;
|
|
||||||
++num_unreported_spg;
|
|
||||||
}
|
|
||||||
@@ -238,11 +242,11 @@ scsiGetSupportedLogPages(scsi_device * device)
|
|
||||||
reporting of <lpage>,0xff so it is not an error. */
|
|
||||||
break;
|
|
||||||
case STARTSTOP_CYCLE_COUNTER_LPAGE:
|
|
||||||
- if (NO_SUBPAGE_L_SPAGE == sub_pg_num)
|
|
||||||
+ if (NO_SUBPAGE_L_SPAGE == supp_lpg.subpage_code)
|
|
||||||
gStartStopLPage = true;
|
|
||||||
- else if (UTILIZATION_L_SPAGE == sub_pg_num)
|
|
||||||
+ else if (UTILIZATION_L_SPAGE == supp_lpg.subpage_code)
|
|
||||||
gUtilizationLPage = true;
|
|
||||||
- else if (SUPP_SPAGE_L_SPAGE != sub_pg_num) {
|
|
||||||
+ else if (SUPP_SPAGE_L_SPAGE != supp_lpg.subpage_code) {
|
|
||||||
++num_unreported;
|
|
||||||
++num_unreported_spg;
|
|
||||||
}
|
|
||||||
@@ -254,15 +258,15 @@ scsiGetSupportedLogPages(scsi_device * device)
|
|
||||||
gSmartLPage = true;
|
|
||||||
break;
|
|
||||||
case BACKGROUND_RESULTS_LPAGE:
|
|
||||||
- if (NO_SUBPAGE_L_SPAGE == sub_pg_num)
|
|
||||||
+ if (NO_SUBPAGE_L_SPAGE == supp_lpg.subpage_code)
|
|
||||||
gBackgroundResultsLPage = true;
|
|
||||||
- else if (PEND_DEFECTS_L_SPAGE == sub_pg_num)
|
|
||||||
+ else if (PEND_DEFECTS_L_SPAGE == supp_lpg.subpage_code)
|
|
||||||
gPendDefectsLPage = true;
|
|
||||||
- else if (BACKGROUND_OP_L_SPAGE == sub_pg_num)
|
|
||||||
+ else if (BACKGROUND_OP_L_SPAGE == supp_lpg.subpage_code)
|
|
||||||
gBackgroundOpLPage = true;
|
|
||||||
- else if (LPS_MISALIGN_L_SPAGE == sub_pg_num)
|
|
||||||
+ else if (LPS_MISALIGN_L_SPAGE == supp_lpg.subpage_code)
|
|
||||||
gLPSMisalignLPage = true;
|
|
||||||
- else if (SUPP_SPAGE_L_SPAGE != sub_pg_num) {
|
|
||||||
+ else if (SUPP_SPAGE_L_SPAGE != supp_lpg.subpage_code) {
|
|
||||||
++num_unreported;
|
|
||||||
++num_unreported_spg;
|
|
||||||
}
|
|
||||||
@@ -296,9 +300,10 @@ scsiGetSupportedLogPages(scsi_device * device)
|
|
||||||
gSeagateFactoryLPage = true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
- if (pg_num < 0x30) { /* don't count VS pages */
|
|
||||||
+ if (supp_lpg.page_code < 0x30) { /* don't count VS pages */
|
|
||||||
++num_unreported;
|
|
||||||
- if ((sub_pg_num > 0) && (SUPP_SPAGE_L_SPAGE != sub_pg_num))
|
|
||||||
+ if ((supp_lpg.subpage_code > 0) &&
|
|
||||||
+ (SUPP_SPAGE_L_SPAGE != supp_lpg.subpage_code))
|
|
||||||
++num_unreported_spg;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
--
|
|
||||||
2.35.1
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
|||||||
diff -up smartmontools-7.2/os_linux.cpp.permsfix smartmontools-7.2/os_linux.cpp
|
|
||||||
--- smartmontools-7.2/os_linux.cpp.permsfix 2021-11-02 22:08:51.956425716 +0100
|
|
||||||
+++ smartmontools-7.2/os_linux.cpp 2021-11-02 22:09:55.928583584 +0100
|
|
||||||
@@ -1022,7 +1022,7 @@ bool linux_aacraid_device::open()
|
|
||||||
return set_err(ENOENT, "aac entry not found in /proc/devices");
|
|
||||||
|
|
||||||
//Create misc device file in /dev/ used for communication with driver
|
|
||||||
- if(mknod(dev_name,S_IFCHR,makedev(mjr,aHost)))
|
|
||||||
+ if(mknod(dev_name,S_IFCHR|0600,makedev(mjr,aHost)))
|
|
||||||
return set_err(errno,"cannot create %s:%s",dev_name,strerror(errno));
|
|
||||||
|
|
||||||
afd = ::open(dev_name,O_RDWR);
|
|
||||||
@@ -1298,14 +1298,14 @@ bool linux_megaraid_device::open()
|
|
||||||
while (fgets(line, sizeof(line), fp) != NULL) {
|
|
||||||
int n1 = 0;
|
|
||||||
if (sscanf(line, "%d megaraid_sas_ioctl%n", &mjr, &n1) == 1 && n1 == 22) {
|
|
||||||
- n1=mknod("/dev/megaraid_sas_ioctl_node", S_IFCHR, makedev(mjr, 0));
|
|
||||||
+ n1=mknod("/dev/megaraid_sas_ioctl_node", S_IFCHR|0600, makedev(mjr, 0));
|
|
||||||
if(report > 0)
|
|
||||||
pout("Creating /dev/megaraid_sas_ioctl_node = %d\n", n1 >= 0 ? 0 : errno);
|
|
||||||
if (n1 >= 0 || errno == EEXIST)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (sscanf(line, "%d megadev%n", &mjr, &n1) == 1 && n1 == 11) {
|
|
||||||
- n1=mknod("/dev/megadev0", S_IFCHR, makedev(mjr, 0));
|
|
||||||
+ n1=mknod("/dev/megadev0", S_IFCHR|0600, makedev(mjr, 0));
|
|
||||||
if(report > 0)
|
|
||||||
pout("Creating /dev/megadev0 = %d\n", n1 >= 0 ? 0 : errno);
|
|
||||||
if (n1 >= 0 || errno == EEXIST)
|
|
||||||
@@ -2970,7 +2970,7 @@ bool linux_smart_interface::get_dev_mega
|
|
||||||
n1=0;
|
|
||||||
if (sscanf(line, "%d megaraid_sas_ioctl%n", &mjr, &n1) == 1 && n1 == 22) {
|
|
||||||
scan_megasas = true;
|
|
||||||
- n1=mknod("/dev/megaraid_sas_ioctl_node", S_IFCHR, makedev(mjr, 0));
|
|
||||||
+ n1=mknod("/dev/megaraid_sas_ioctl_node", S_IFCHR|0600, makedev(mjr, 0));
|
|
||||||
if(scsi_debugmode > 0)
|
|
||||||
pout("Creating /dev/megaraid_sas_ioctl_node = %d\n", n1 >= 0 ? 0 : errno);
|
|
||||||
if (n1 >= 0 || errno == EEXIST)
|
|
@ -0,0 +1,32 @@
|
|||||||
|
diff -up smartmontools-7.4/farmprint.cpp.fix_sast smartmontools-7.4/farmprint.cpp
|
||||||
|
--- smartmontools-7.4/farmprint.cpp.fix_sast 2024-08-06 16:38:15.152139278 +0200
|
||||||
|
+++ smartmontools-7.4/farmprint.cpp 2024-08-06 16:39:35.309972436 +0200
|
||||||
|
@@ -173,6 +173,7 @@ void ataPrintFarmLog(const ataFarmLog& f
|
||||||
|
farm_format_id_string(firmwareRev, farm_byte_swap(farmLog.driveInformation.firmwareRev2), farm_byte_swap(farmLog.driveInformation.firmwareRev));
|
||||||
|
|
||||||
|
char modelNumber[sizeof(farmLog.driveInformation.modelNumber) + 1];
|
||||||
|
+ modelNumber[0] = '\0';
|
||||||
|
for (uint8_t i = 0; i < sizeof(farmLog.driveInformation.modelNumber) / sizeof(farmLog.driveInformation.modelNumber[0]); i++) {
|
||||||
|
farm_format_id_string(&modelNumber[strlen(modelNumber)], farm_byte_swap(farmLog.driveInformation.modelNumber[i]));
|
||||||
|
}
|
||||||
|
diff -up smartmontools-7.4/scsicmds.cpp.fix_sast smartmontools-7.4/scsicmds.cpp
|
||||||
|
--- smartmontools-7.4/scsicmds.cpp.fix_sast 2024-08-06 16:32:18.058427672 +0200
|
||||||
|
+++ smartmontools-7.4/scsicmds.cpp 2024-08-06 16:37:56.041940650 +0200
|
||||||
|
@@ -200,7 +200,7 @@ scsi_device::cmd_support_level(uint8_t o
|
||||||
|
|
||||||
|
supported_vpd_pages::supported_vpd_pages(scsi_device * device) : num_valid(0)
|
||||||
|
{
|
||||||
|
- unsigned char b[0xfc] = {}; /* pre SPC-3 INQUIRY max response size */
|
||||||
|
+ unsigned char b[260] = {}; /* pre SPC-3 INQUIRY max response size, but also allow sizeof(pages)+4 for memcpy bellow */
|
||||||
|
|
||||||
|
if (device && (0 == scsiInquiryVpd(device, SCSI_VPD_SUPPORTED_VPD_PAGES,
|
||||||
|
b, sizeof(b)))) {
|
||||||
|
@@ -1807,7 +1807,7 @@ scsiModePageOffset(const uint8_t * resp,
|
||||||
|
bd_len = resp[3];
|
||||||
|
offset = bd_len + 4;
|
||||||
|
}
|
||||||
|
- if ((offset + 2) > len) {
|
||||||
|
+ if ((offset + 2) >= len) {
|
||||||
|
pout("scsiModePageOffset: raw_curr too small, offset=%d "
|
||||||
|
"resp_len=%d bd_len=%d\n", offset, resp_len, bd_len);
|
||||||
|
offset = -1;
|
@ -1,6 +1,3 @@
|
|||||||
# command line options for smartd
|
# command line options for smartd
|
||||||
# Add -s /var/lib/smartmontools to enable state persistence
|
# Add -s /var/lib/smartmontools/ to enable state persistence
|
||||||
smartd_opts="-q never --capabilities"
|
smartd_opts="-q never --capabilities=mail"
|
||||||
|
|
||||||
# autogenerated config file options
|
|
||||||
# smartd_conf_opts="-H -m root"
|
|
||||||
|
Loading…
Reference in new issue