19 Apr, 2020
1 commit
-
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:struct foo {
int stuff;
struct boo array[];
};By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.Also, notice that, dynamic memory allocations won't be affected by
this change:"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]This issue was found with the help of Coccinelle.
[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")Signed-off-by: Gustavo A. R. Silva
25 Apr, 2018
7 commits
-
To get rid of the variable length arrays on stack in the RS decoder it's
necessary to allocate the decoder buffers per control structure instance.All usage sites have been checked for potential parallel decoder usage and
fixed where necessary. Kees confirmed that the pstore decoding is strictly
single threaded so there should be no surprises.Allocate them in the rs control structure sized depending on the number of
roots for the chosen codec and adapt the decoder code to make use of them.Document the fact that decode operations based on a particular rs control
instance cannot run in parallel and the caller has to ensure that as it's
not possible to provide a proper locking construct which fits all use
cases.Signed-off-by: Thomas Gleixner
Acked-by: Kees Cook
Cc: Boris Brezillon
Cc: Tony Luck
Cc: Segher Boessenkool
Cc: Kernel Hardening
Cc: Richard Weinberger
Cc: Mike Snitzer
Cc: Anton Vorontsov
Cc: Colin Cross
Cc: Andrew Morton
Cc: David Woodhouse
Cc: Alasdair Kergon
Signed-off-by: Kees Cook -
The decoder library uses variable length arrays on stack. To get rid of
them it would be simple to allocate fixed length arrays on stack, but those
might become rather large. The other solution is to allocate the buffers in
the rs control structure, but this cannot be done as long as the structure
can be shared by several users. Sharing is desired because the RS polynom
tables are large and initialization is time consuming.To solve this split the codec information out of the control structure and
have a pointer to a shared codec in it. Instantiate the control structure
for each user, create a new codec if no shareable is avaiable yet. Adjust
all affected usage sites to the new scheme.This allows to add per instance decoder buffers to the control structure
later on.Signed-off-by: Thomas Gleixner
Acked-by: Boris Brezillon
Cc: Tony Luck
Cc: Kees Cook
Cc: Segher Boessenkool
Cc: Kernel Hardening
Cc: Richard Weinberger
Cc: Mike Snitzer
Cc: Anton Vorontsov
Cc: Colin Cross
Cc: Andrew Morton
Cc: David Woodhouse
Cc: Alasdair Kergon
Signed-off-by: Kees Cook -
Now that SPDX identifiers are in place, remove the GPL boiler plate
text. Leave the notices which document that Phil Karn granted permission in
place (encode/decode source code). The modified files are code written for
the kernel by me.Signed-off-by: Thomas Gleixner
Reviewed-by: Kate Stewart
Reviewed-by: Greg Kroah-Hartman
Cc: Boris Brezillon
Cc: Tony Luck
Cc: Kees Cook
Cc: Segher Boessenkool
Cc: Kernel Hardening
Cc: Richard Weinberger
Cc: Mike Snitzer
Cc: Anton Vorontsov
Cc: Colin Cross
Cc: Andrew Morton
Cc: David Woodhouse
Cc: Alasdair Kergon
Signed-off-by: Kees Cook -
The Reed-Solomon library is based on code from Phil Karn who granted
permission to import it into the kernel under the GPL V2.See commit 15b5423757a7 ("Shared Reed-Solomon ECC library") in the history
git tree at: git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git...
The encoder/decoder code is lifted from the GPL'd userspace RS-library
written by Phil Karn. I modified/wrapped it to provide the different
functions which we need in the MTD/NAND code.
...
Signed-Off-By: Thomas Gleixner
Signed-Off-By: David Woodhouse
"No objections at all. Just keep the authorship notices." -- Phil KarnAdd the proper SPDX identifiers according to
Documentation/process/license-rules.rst.Signed-off-by: Thomas Gleixner
Reviewed-by: Kate Stewart
Reviewed-by: Greg Kroah-Hartman
Cc: Boris Brezillon
Cc: Tony Luck
Cc: Kees Cook
Cc: Segher Boessenkool
Cc: Kernel Hardening
Cc: Richard Weinberger
Cc: Mike Snitzer
Cc: Anton Vorontsov
Cc: Colin Cross
Cc: Andrew Morton
Cc: David Woodhouse
Cc: Alasdair Kergon
Signed-off-by: Kees Cook -
File references and stale CVS ids are really not useful.
Signed-off-by: Thomas Gleixner
Cc: Boris Brezillon
Cc: Tony Luck
Cc: Kees Cook
Cc: Segher Boessenkool
Cc: Kernel Hardening
Cc: Richard Weinberger
Cc: Mike Snitzer
Cc: Anton Vorontsov
Cc: Colin Cross
Cc: Andrew Morton
Cc: David Woodhouse
Cc: Alasdair Kergon
Signed-off-by: Kees Cook -
Instead of mixing the whitespace cleanup into functional changes, mop it up
first.Signed-off-by: Thomas Gleixner
Cc: Boris Brezillon
Cc: Tony Luck
Cc: Kees Cook
Cc: Segher Boessenkool
Cc: Kernel Hardening
Cc: Richard Weinberger
Cc: Mike Snitzer
Cc: Anton Vorontsov
Cc: Colin Cross
Cc: Andrew Morton
Cc: David Woodhouse
Cc: Alasdair Kergon
Signed-off-by: Kees Cook -
The rslib usage in dm/verity_fec is broken because init_rs() can nest in
GFP_NOIO mempool allocations as init_rs() is invoked from the mempool alloc
callback.Provide a variant which takes gfp_t flags as argument.
Signed-off-by: Thomas Gleixner
Cc: Mike Snitzer
Cc: Alasdair Kergon
Cc: Neil Brown
Signed-off-by: Kees Cook
02 May, 2007
1 commit
-
For the CAFÉ NAND controller, we need to support non-canonical
representations of the Galois field. Allow the caller to provide its own
function for generating the field, and CAFÉ can use rslib instead of its
own implementation.Signed-off-by: Segher Boessenkool
Signed-off-by: David Woodhouse
07 Nov, 2005
1 commit
17 Apr, 2005
1 commit
-
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.Let it rip!