The sigaltstack(2) system call fails with -ENOMEM if the new alternative
signal stack is found to be smaller than SIGMINSTKSZ. On architectures
such as arm64, where the native value for SIGMINSTKSZ is larger than
the compat value, this can result in an unexpected error being reported
to a compat task. See, for example:
This patch fixes the problem by extending do_sigaltstack to take the
minimum signal stack size as an additional parameter, allowing the
native and compat system call entry code to pass in their respective
values. COMPAT_SIGMINSTKSZ is just defined as SIGMINSTKSZ if it has not
been defined by the architecture.
In commit 87c8331fcf72 ("[SCSI] libsas: prevent domain rediscovery
competing with ata error handling") introduced disco mutex to prevent
rediscovery competing with ata error handling and put the whole
revalidation in the mutex. But the rphy add/remove needs to wait for the
error handling which also grabs the disco mutex. This may leads to dead
lock.So the probe and destruct event were introduce to do the rphy
add/remove asynchronously and out of the lock.
The asynchronously processed workers makes the whole discovery process
not atomic, the other events may interrupt the process. For example,
if a loss of signal event inserted before the probe event, the
sas_deform_port() is called and the port will be deleted.
And sas_port_delete() may run before the destruct event, but the
port-x:x is the top parent of end device or expander. This leads to
a kernel WARNING such as:
Make probe and destruct a direct call in the disco and revalidate function,
but put them outside the lock. The whole discovery or revalidate won't
be interrupted by other events. And the DISCE_PROBE and DISCE_DESTRUCT
event are deleted as a result of the direct call.
Introduce a new list to destruct the sas_port and put the port delete after
the destruct. This makes sure the right order of destroying the sysfs
kobject and fix the warning above.
In sas_ex_revalidate_domain() have a loop to find all broadcasted
device, and sometimes we have a chance to find the same expander twice.
Because the sas_port will be deleted at the end of the whole revalidate
process, sas_port with the same name cannot be added before this.
Otherwise the sysfs will complain of creating duplicate filename. Since
the LLDD will send broadcast for every device change, we can only
process one expander's revalidation.
[mkp: kbuild test robot warning]
Signed-off-by: Jason Yan <email address hidden>
CC: John Garry <email address hidden>
CC: Johannes Thumshirn <email address hidden>
CC: Ewan Milne <email address hidden>
CC: Christoph Hellwig <email address hidden>
CC: Tomas Henzl <email address hidden>
CC: Dan Williams <email address hidden>
Reviewed-by: Hannes Reinecke <email address hidden>
Signed-off-by: Martin K. Petersen <email address hidden>
(backported from commit 0558f33c06bb910e2879e355192227a8e8f0219d)
[ Connor Kuehl: The hunk that removed variants from 'enum
discover_event' required manual placement. I did take the liberty of
removing the hardcoded enum values from this enum as is done in
upstream commit 0d78f969b10f "scsi: libsas: remove the numbering for
each event enum" but only for this enum to reduce confusion over
renumbering. It seemed overkill to take in the entire patch alongside
this backport. ]
Signed-off-by: Connor Kuehl <email address hidden>
Acked-by: Kamal Mostafa <email address hidden>
Acked-by: Tyler Hicks <email address hidden>
Signed-off-by: Khalid Elmously <email address hidden>
d774555...
by
Sanjay Konduri <email address hidden>
rsi: add fix for crash during assertions
CVE-2018-21008
Observed crash in some scenarios when assertion has occurred,
this is because hw structure is freed and is tried to get
accessed in some functions where null check is already
present. So, avoided the crash by making the hw to NULL after
freeing.