[bug report] crypto: jitter - add RCT/APT support for different OSRs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Stephan Müller,

The patch 04597c8dd6c4: "crypto: jitter - add RCT/APT support for
different OSRs" from Sep 21, 2023 (linux-next), leads to the
following Smatch static checker warning:

	crypto/jitterentropy.c:615 jent_read_entropy()
	warn: sleeping in atomic context

crypto/jitterentropy.c
    601                 if (jent_permanent_health_failure(ec)) {
    602                         /*
    603                          * At this point, the Jitter RNG instance is considered
    604                          * as a failed instance. There is no rerun of the
    605                          * startup test any more, because the caller
    606                          * is assumed to not further use this instance.
    607                          */
    608                         return -3;
    609                 } else if (jent_health_failure(ec)) {
    610                         /*
    611                          * Perform startup health tests and return permanent
    612                          * error if it fails.
    613                          */
    614                         if (jent_entropy_init(ec->osr, ec->flags,
--> 615                                               ec->hash_state))

jent_entropy_init() does a sleeping allocation.  The caller,
jent_kcapi_random(), is holding spin_lock(&rng->jent_lock); and so
we're not allowed to sleep.

    616                                 return -3;
    617 
    618                         return -2;
    619                 }
    620 
    621                 if ((DATA_SIZE_BITS / 8) < len)
    622                         tocopy = (DATA_SIZE_BITS / 8);
    623                 else
    624                         tocopy = len;
    625                 if (jent_read_random_block(ec->hash_state, p, tocopy))
    626                         return -1;
    627 
    628                 len -= tocopy;
    629                 p += tocopy;
    630         }
    631 
    632         return 0;
    633 }

regards,
dan carpenter



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux