Support for the following changes in the Linux kernel v7.0:
- e3b2cf6e5dba ("kernfs: pass struct ns_common instead of
const void * for namespace tags")
This is the result of running the Linux kernel Coccinelle script from
scripts/coccinelle/api/kmalloc_objs.cocci against the SCST tree.
This patch doesn't change any functionality.
SIGUSR1/SIGUSR2 set/clear logins_suspended. While set, any login
attempt is rejected with a retriable Target Error instead of the
permanent Initiator Error (TGT_NOT_FOUND) that causes initiators
to give up.
Use 'bytes' (the return value from af_alg_final) instead of 'res'
(which is 0 after the last successful af_alg_update call) when
copying the digest.
This bug caused the memcpy to copy 0 bytes, resulting in an
uninitialized digest buffer. It also triggered a GCC
-Werror=stringop-overflow warning because 'res' could theoretically
be negative, leading to a huge unsigned size.
Upstream workqueue changes introduce a new WQ_PERCPU flag and plan to
switch alloc_workqueue()'s default from per-CPU to unbound
To kepp SCST behaviour unchanged across kernels, this patch makes all
alloc_workqueue() users explicit about whether they want per-CPU or
unbound queues.
The calculation of the upper limit for queues does not depend solely on
the number of online CPUs; for example, the isolcpus kernel
command-line option must also be considered.
To account for this, the block layer provides a helper function to
retrieve the maximum number of queues. Use it to set an appropriate
upper queue number limit.
-fstack-protector-strong is controlled by the in-tree
CONFIG_STACKPROTECTOR_STRONG config option. If the flag is set without
the config option, scst fails to build:
ERROR: modpost: "__stack_chk_fail" [scst/src/scst.ko] undefined!
-fstack-clash-protection is disabled in the kernel's Makefile due to an
incompatibility with randomize_kstack_offset.
Fixes: 86d3d4bb1d ("kbuild: Enable additional compiler warnings")
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Kernel v6.15+ removed LIBCRC32C and switched in-tree users to CRC32.
Keep older kernels working by accepting either CRC32 or LIBCRC32C in
Kconfig and preprocessor guards, so crc32c() usage compiles and links
on both old and new kernels.
When attempting to manage iscsi-scstd using a systemd service file,
systemd warns:
PIDFile= references a path below legacy directory /var/run/, [...]
Change the pidfile path to be under /run instead.
/run has been in use as a replacement for /var/run for many years now
(the original Debian proposal is from 2011). Most distributions symlink
/var/run to /run, which means that this change should not have any
adverse side effects for the vast majority of users.
Replace combined sysfs_emit() calls with separate sysfs_emit() and
sysfs_emit_at() invocations when emitting SCST_SYSFS_KEY_MARK in sysfs
attribute show handlers.
This improves code clarity and consistency, explicitly handling the
conditional addition of SCST_SYSFS_KEY_MARK.
This patch does not change any functionality.
Replace scnprintf() with sysfs_emit() and sysfs_emit_at() in sysfs show handlers.
These helper functions are specifically designed for sysfs output, providing safer
handling of buffer lengths and consistency across kernel sysfs interfaces.
This patch does not change any functionality.
Replace snprintf() with scnprintf() in two places:
- code paths that build up a buffer incrementally
- sysfs attribute “show” handlers
scnprintf() guarantees its return value is the number of bytes actually
written (never exceeding the buffer), preventing potential overruns.
This patch does not change any functionality.
Replace all uses of sprintf() with scnprintf() in sysfs attribute
callbacks to eliminate the risk of buffer overflows.
This patch does not change any functionality.
Fedora 42 maps %{_sbindir} to /usr/bin. Export SBINDIR=%{_sbindir} in
the spec files and let the iscsi-scst/scstadmin Makefiles honour that
variable.
Fixes "File not found: .../iscsi-scst-adm" on unified-/usr systems while
keeping older distros unchanged.
GCC 15 (C23) now reserves bool/true/false, so the local typedef in
iscsid.d breaks the build:
error: cannot use keyword 'false' as enumeration constant
error: expected ';', identifier or '(' before 'bool'
Include <stdbool.h> and drop the typedef.
Support for the following scsi layer changes in the Linux kernel v6.14:
- ed638918f4df ("scsi: Rename .slave_alloc() and .slave_destroy()")
- 49515b7fe50c ("scsi: Convert SCSI drivers to .sdev_configure()")
- c9a71ca13f71 ("scsi: Constify struct pci_device_id")
- bd326a5ad639 ("scsi: replace blk_mq_pci_map_queues with blk_mq_map_hw_queues")
Use the kernel userspace AL_ALG API to access additional hash
functions "sha256" and "sha3-256".
If configured for CHAP, on iSCSI login the client will present an
ordered list of desired algorithms. During this negotiation, if
the client requests SHA256 or SHA3-256 we verify that the kernel
supports the algorithm before agreeing to use it.
The workqueue maintainer wants to remove the create*_workqueue() macros
because these macros always set the WQ_MEM_RECLAIM flag and because these
only support literal workqueue names. Hence this patch that replaces the
create*_workqueue() invocations with the definition of this macro. The
WQ_MEM_RECLAIM flag has been retained because I think that flag is necessary
for workqueues created by storage drivers.
Support for the following changes in the Linux kernel v6.12:
- 5f60d5f6bbc1 ("move asm/unaligned.h to linux/unaligned.h")
- cb787f4ac0c2 ("[tree-wide] finally take no_llseek out")
Add an internal_portal parameter to allow specified portals to
bypass CHAP controls for both discovery and target login. If not
populated, then the current behavior will be preserved.
Add a link_local parameter to control whether an IPv6 SendTargets
response includes link local addresses. The default is to preserve
the existing behavior and include them.
According to kernel documentation, this flag should be set if the
workqueue will be involved in the kernel's memory reclamation flow.
Since it is not, there is no need for the driver's WQ to have this
flag set so remove it.
create_workqueue() was replaced with alloc_workqueue() with max_active set
to 0. However, the original create_workqueue() implicitly set max_active
to 1.
This change has led to unexpected bugs because previously, work items
could only be executed one by one. With the change, they can now be
executed simultaneously.
This patch fixes the issue by restoring max_active to 1.
Fixes: f4686e9102 ("scst: Remove deprecated create_workqueue()")
Fixes: https://github.com/SCST-project/scst/issues/179
strlcpy() reads the entire source buffer first. This read may exceed the
destination size limit. This is both inefficient and can lead to linear
read overflows if a source string is not NULL-terminated [1].
[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
Use sendmsg() conditionally with MSG_SPLICE_PAGES in write_data()
rather than calling sendpage().
Support for the following net layer changes in the Linux kernel v6.5:
- dc97391e6610 ("sock: Remove ->sendpage*() in favour of
sendmsg(MSG_SPLICE_PAGES)")
This patch carries out a refactoring of the sendpage functionality in
the write_data() function:
1. Reorganize the logic used to select the sock_sendpage function.
2. Streamline the data sending loop by reducing conditional branches and
eliminating labels.
3. Adjust the error handling for -EINTR and -EAGAIN to make the code
cleaner and easier to follow.
This patch doesn't change any functionality.