[llvmlinux] VLAIS cleanup
PaX Team
pageexec at freemail.hu
Mon Mar 24 16:28:41 UTC 2014
On 24 Mar 2014 at 15:45, Renato Golin wrote:
> function_whatever(arguments) {
> struct {
> struct shash_desc desc;
> char ctx[crypto_shash_descsize(lmk->hash_tfm)];
> } sdesc;
> ...
> // sometimes...
> ctx = ...;
>
> // always
> whatever = another_function(&sdesc.desc, ...);
>
> // sometimes, less often
> return ctx;
> }
>
> I'm not a kernel expert, but I couldn't find any of those functions
> receiving the address of the first member modifying anything past the
> sizeof(desc), which is the only way it could be using the ctx member
> without clearly stated in the code.
note the last field in struct shash_desc: void *__ctx[] CRYPTO_MINALIGN_ATTR;
what the various callbacks in shash_alg structs do is that they call shash_desc_ctx()
to convert the shash_desc ptr into the ctx ptr: return desc->__ctx;
More information about the LLVMLinux
mailing list