{"push_id":1478536814,"size":5,"distinct_size":5,"ref":"refs/heads/xzotic-r2","head":"7f964f6609e3664287a9404a4833a8ebc77c0bed","before":"0fe2cd3bef691d71883079fa3a7c425e9fdab2fd","commits":[{"sha":"b95aade5f6d9d8d0ba6b89b0ad46c01815b8a9f0","author":{"name":"imoseyon","email":"10a51fa76245a6d62993b9f678997023cca4f98d@gmail.com"},"message":"random: entropy tweaks are all the rage nowadays\n\nuse non-blocking pool for all\n\nhttp://lwn.net/Articles/489734/\n\nConflicts:\n\n\tdrivers/char/random.c\n\nConflicts:\n\tdrivers/char/random.c\n\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nrandom: prevent add_input from doing anything\n\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nrandom: remove warning\n\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nchar: frandom: initial commit v1.1\n\n    Based on my dd test:\n      hw_random (msm_rng): 0.56 MB/s\n      linux random/urandom: 4.4 MB/s\n      frandom/erandom: 90 MB/s\n\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nrandom32: add periodic reseeding\n\nThe current Tausworthe PRNG is never reseeded with truly random data after\nthe first attempt in late_initcall. As this PRNG is used for some critical\nrandom data as e.g. UDP port randomization we should try better and reseed\nthe PRNG once in a while with truly random data from get_random_bytes().\n\nWhen we reseed with prandom_seed we now make also sure to throw the first\noutput away. This suffices the reseeding procedure.\n\nThe delay calculation is based on a proposal from Eric Dumazet.\n\nJoint work with Daniel Borkmann.\n\nCc: Eric Dumazet <eric.dumazet@gmail.com>\nCc: Theodore Ts'o <tytso@mit.edu>\nSigned-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>\nSigned-off-by: Daniel Borkmann <dborkman@redhat.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nrandom32: add prandom_reseed_late() and call when nonblocking pool becomes initialized\n\nThe Tausworthe PRNG is initialized at late_initcall time. At that time the\nentropy pool serving get_random_bytes is not filled sufficiently. This\npatch adds an additional reseeding step as soon as the nonblocking pool\ngets marked as initialized.\n\nOn some machines it might be possible that late_initcall gets called after\nthe pool has been initialized. In this situation we won't reseed again.\n\n(A call to prandom_seed_late blocks later invocations of early reseed\nattempts.)\n\nJoint work with Daniel Borkmann.\n\nCc: Eric Dumazet <eric.dumazet@gmail.com>\nCc: Theodore Ts'o <tytso@mit.edu>\nSigned-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>\nSigned-off-by: Daniel Borkmann <dborkman@redhat.com>\nAcked-by: \"Theodore Ts'o\" <tytso@mit.edu>\nSigned-off-by: David S. Miller <davem@davemloft.net>\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nrandom32: move rnd_state to linux/random.h\n\nstruct rnd_state got mistakenly pulled into uapi header. It is not\nused anywhere and does also not belong there!\n\nCommit 5960164fde (\"lib/random32: export pseudo-random number\ngenerator for modules\"), the last commit on rnd_state before it\ngot moved to uapi, says:\n\n  This patch moves the definition of struct rnd_state and the inline\n  __seed() function to linux/random.h.  It renames the static __random32()\n  function to prandom32() and exports it for use in modules.\n\nHence, the structure was moved from lib/random32.c to linux/random.h\nso that it can be used within modules (FCoE-related code in this\ncase), but not from user space. However, it seems to have been\nmistakenly moved to uapi header through the uapi script. Since no-one\nshould make use of it from the linux headers, move the structure back\nto the kernel for internal use, so that it can be modified on demand.\n\nJoint work with Hannes Frederic Sowa.\n\nCc: Joe Eykholt <jeykholt@cisco.com>\nSigned-off-by: Daniel Borkmann <dborkman@redhat.com>\nSigned-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>\nSigned-off-by: David S. Miller <davem@davemloft.net>\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nrandom32: upgrade taus88 generator to taus113 from errata paper\n\nSince we use prandom*() functions quite often in networking code\ni.e. in UDP port selection, netfilter code, etc, upgrade the PRNG\nfrom Pierre L'Ecuyer's original paper \"Maximally Equidistributed\nCombined Tausworthe Generators\", Mathematics of Computation, 65,\n213 (1996), 203--213 to the version published in his errata paper [1].\n\nThe Tausworthe generator is a maximally-equidistributed generator,\nthat is fast and has good statistical properties [1].\n\nThe version presented there upgrades the 3 state LFSR to a 4 state\nLFSR with increased periodicity from about 2^88 to 2^113. The\nalgorithm is presented in [1] by the very same author who also\ndesigned the original algorithm in [2].\n\nAlso, by increasing the state, we make it a bit harder for attackers\nto \"guess\" the PRNGs internal state. See also discussion in [3].\n\nNow, as we use this sort of weak initialization discussed in [3]\nonly between core_initcall() until late_initcall() time [*] for\nprandom32*() users, namely in prandom_init(), it is less relevant\nfrom late_initcall() onwards as we overwrite seeds through\nprandom_reseed() anyways with a seed source of higher entropy, that\nis, get_random_bytes(). In other words, a exhaustive keysearch of\n96 bit would be needed. Now, with the help of this patch, this\nstate-search increases further to 128 bit. Initialization needs\nto make sure that s1 > 1, s2 > 7, s3 > 15, s4 > 127.\n\ntaus88 and taus113 algorithm is also part of GSL. I added a test\ncase in the next patch to verify internal behaviour of this patch\nwith GSL and ran tests with the dieharder 3.31.1 RNG test suite:\n\n$ dieharder -g 052 -a -m 10 -s 1 -S 4137730333 #taus88\n$ dieharder -g 054 -a -m 10 -s 1 -S 4137730333 #taus113\n\nWith this seed configuration, in order to compare both, we get\nthe following differences:\n\nalgorithm                 taus88           taus113\nrands/second [**]         1.61e+08         1.37e+08\nsts_serial(4, 1st run)    WEAK             PASSED\nsts_serial(9, 2nd run)    WEAK             PASSED\nrgb_lagged_sum(31)        WEAK             PASSED\n\nWe took out diehard_sums test as according to the authors it is\nconsidered broken and unusable [4]. Despite that and the slight\ndecrease in performance (which is acceptable), taus113 here passes\nall 113 tests (only rgb_minimum_distance_5 in WEAK, the rest PASSED).\nIn general, taus/taus113 is considered \"very good\" by the authors\nof dieharder [5].\n\nThe papers [1][2] states a single warm-up step is sufficient by\nrunning quicktaus once on each state to ensure proper initialization\nof ~s_{0}:\n\nOur selection of (s) according to Table 1 of [1] row 1 holds the\ncondition L - k <= r - s, that is,\n\n  (32 32 32 32) - (31 29 28 25) <= (25 27 15 22) - (18 2 7 13)\n\nwith r = k - q and q = (6 2 13 3) as also stated by the paper.\nSo according to [2] we are safe with one round of quicktaus for\ninitialization. However we decided to include the warm-up phase\nof the PRNG as done in GSL in every case as a safety net. We also\nuse the warm up phase to make the output of the RNG easier to\nverify by the GSL output.\n\nIn prandom_init(), we also mix random_get_entropy() into it, just\nlike drivers/char/random.c does it, jiffies ^ random_get_entropy().\nrandom-get_entropy() is get_cycles(). xor is entropy preserving so\nit is fine if it is not implemented by some architectures.\n\nNote, this PRNG is *not* used for cryptography in the kernel, but\nrather as a fast PRNG for various randomizations i.e. in the\nnetworking code, or elsewhere for debugging purposes, for example.\n\n[*]: In order to generate some \"sort of pseduo-randomness\", since\nget_random_bytes() is not yet available for us, we use jiffies and\ninitialize states s1 - s3 with a simple linear congruential generator\n(LCG), that is x <- x * 69069; and derive s2, s3, from the 32bit\ninitialization from s1. So the above quote from [3] accounts only\nfor the time from core to late initcall, not afterwards.\n[**] Single threaded run on MacBook Air w/ Intel Core i5-3317U\n\n [1] http://www.iro.umontreal.ca/~lecuyer/myftp/papers/tausme2.ps\n [2] http://www.iro.umontreal.ca/~lecuyer/myftp/papers/tausme.ps\n [3] http://thread.gmane.org/gmane.comp.encryption.general/12103/\n [4] http://code.google.com/p/dieharder/source/browse/trunk/libdieharder/diehard_sums.c?spec=svn490&r=490#20\n [5] http://www.phy.duke.edu/~rgb/General/dieharder.php\n\nJoint work with Hannes Frederic Sowa.\n\nCc: Florian Weimer <fweimer@redhat.com>\nCc: Theodore Ts'o <tytso@mit.edu>\nSigned-off-by: Daniel Borkmann <dborkman@redhat.com>\nSigned-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>\nSigned-off-by: David S. Miller <davem@davemloft.net>\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nrandom32: add test cases for taus113 implementation\n\nWe generated a battery of 100 test cases from GSL taus113 implemention\nand compare the results from a particular seed and a particular\niteration with our implementation in the kernel. We have verified on\n32 and 64 bit machines that our taus113 kernel implementation gives\nsame results as GSL taus113 implementation:\n\n  [    0.147370] prandom: seed boundary self test passed\n  [    0.148078] prandom: 100 self tests passed\n\nThis is a Kconfig option that is disabled on default, just like the\ncrc32 init selftests in order to not unnecessary slow down boot process.\nWe also refactored out prandom_seed_very_weak() as it's now used in\nmultiple places in order to reduce redundant code.\n\nGSL code we used for generating test cases:\n\n  int i, j;\n  srand(time(NULL));\n  for (i = 0; i < 100; ++i) {\n    int iteration = 500 + (rand() % 500);\n    gsl_rng_default_seed = rand() + 1;\n    gsl_rng *r = gsl_rng_alloc(gsl_rng_taus113);\n    printf(\"\\t{ %lu, \", gsl_rng_default_seed);\n    for (j = 0; j < iteration - 1; ++j)\n      gsl_rng_get(r);\n    printf(\"%u, %lu },\\n\", iteration, gsl_rng_get(r));\n    gsl_rng_free(r);\n  }\n\nJoint work with Hannes Frederic Sowa.\n\nCc: Florian Weimer <fweimer@redhat.com>\nCc: Theodore Ts'o <tytso@mit.edu>\nSigned-off-by: Daniel Borkmann <dborkman@redhat.com>\nSigned-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>\nSigned-off-by: David S. Miller <davem@davemloft.net>\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nrandom32: add __init prefix to prandom_start_seed_timer\n\nWe only call that in functions annotated with __init, so add __init\nprefix in prandom_start_seed_timer() as well, so that the kernel can\nmake use of this hint and we can possibly free up resources after it's\nusage. And since it's an internal function rename it to\n__prandom_start_seed_timer().\n\nSigned-off-by: Daniel Borkmann <dborkman@redhat.com>\nSigned-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>\nSigned-off-by: David S. Miller <davem@davemloft.net>\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nrandom32: use msecs_to_jiffies for reseed timer\n\nUse msecs_to_jiffies, for these calculations as different HZ\nconsiderations are taken into account for conversion of the timer\nshot, and also it makes the code more readable.\n\nSigned-off-by: Daniel Borkmann <dborkman@redhat.com>\nSigned-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>\nSigned-off-by: David S. Miller <davem@davemloft.net>\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nrandom32: avoid attempt to late reseed if in the middle of seeding\n\nCommit 4af712e8df (\"random32: add prandom_reseed_late() and call when\nnonblocking pool becomes initialized\") has added a late reseed stage\nthat happens as soon as the nonblocking pool is marked as initialized.\n\nThis fails in the case that the nonblocking pool gets initialized\nduring __prandom_reseed()'s call to get_random_bytes(). In that case\nwe'd double back into __prandom_reseed() in an attempt to do a late\nreseed - deadlocking on 'lock' early on in the boot process.\n\nInstead, just avoid even waiting to do a reseed if a reseed is already\noccuring.\n\nFixes: 4af712e8df99 (\"random32: add prandom_reseed_late() and call when nonblocking pool becomes initialized\")\nSigned-off-by: Sasha Levin <sasha.levin@oracle.com>\nAcked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>\nSigned-off-by: Daniel Borkmann <dborkman@redhat.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nlib/random32.c: minor cleanups and kdoc fix\n\nThese are just some very minor and misc cleanups in the PRNG.  In\nprandom_u32() we store the result in an unsigned long which is\nunnecessary as it should be u32 instead that we get from\nprandom_u32_state().  prandom_bytes_state()'s comment is in kdoc format,\nso change it into such as it's done everywhere else.  Also, use the\nnormal comment style for the header comment.  Last but not least for\nreadability, add some newlines.\n\nSigned-off-by: Daniel Borkmann <dborkman@redhat.com>\nCc: Joe Perches <joe@perches.com>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nrandom32: mix in entropy from core to late initcall\n\nCurrently, we have a 3-stage seeding process in prandom():\n\nPhase 1 is from the early actual initialization of prandom()\nsubsystem which happens during core_initcall() and remains\nmost likely until the beginning of late_initcall() phase.\nHere, the system might not have enough entropy available\nfor seeding with strong randomness from the random driver.\nThat means, we currently have a 32bit weak LCG() seeding\nthe PRNG status register 1 and mixing that successively\ninto the other 3 registers just to get it up and running.\n\nPhase 2 starts with late_initcall() phase resp. when the\nrandom driver has initialized its non-blocking pool with\nenough entropy. At that time, we throw away *all* inner\nstate from its 4 registers and do a full reseed with strong\nrandomness.\n\nPhase 3 starts right after that and does a periodic reseed\nwith random slack of status register 1 by a strong random\nsource again.\n\nA problem in phase 1 is that during bootup data structures\ncan be initialized, e.g. on module load time, and thus access\na weakly seeded prandom and are never changed for the rest\nof their live-time, thus carrying along the results from a\nweek seed. Lets make sure that current but also future users\naccess a possibly better early seeded prandom.\n\nThis patch therefore improves phase 1 by trying to make it\nmore 'unpredictable' through mixing in seed from a possible\nhardware source. Now, the mix-in xors inner state with the\noutcome of either of the two functions arch_get_random_{,seed}_int(),\npreferably arch_get_random_seed_int() as it likely represents\na non-deterministic random bit generator in hw rather than\na cryptographically secure PRNG in hw. However, not all might\nhave the first one, so we use the PRNG as a fallback if\navailable. As we xor the seed into the current state, the\nworst case would be that a hardware source could be unverifiable\ncompromised or backdoored. In that case nevertheless it\nwould be as good as our original early seeding function\nprandom_seed_very_weak() since we mix through xor which is\nentropy preserving.\n\nJoint work with Daniel Borkmann.\n\nSigned-off-by: Daniel Borkmann <dborkman@redhat.com>\nSigned-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>\nSigned-off-by: David S. Miller <davem@davemloft.net>\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nrandom32: improvements to prandom_bytes\n\nThis patch addresses a couple of minor items, mostly addesssing\nprandom_bytes(): 1) prandom_bytes{,_state}() should use size_t\nfor length arguments, 2) We can use put_unaligned() when filling\nthe array instead of open coding it [ perhaps some archs will\nfurther benefit from their own arch specific implementation when\nGCC cannot make up for it ], 3) Fix a typo, 4) Better use unsigned\nint as type for getting the arch seed, 5) Make use of\nprandom_u32_max() for timer slack.\n\nRegarding the change to put_unaligned(), callers of prandom_bytes()\nwhich internally invoke prandom_bytes_state(), don't bother as\nthey expect the array to be filled randomly and don't have any\ncontrol of the internal state what-so-ever (that's also why we\nhave periodic reseeding there, etc), so they really don't care.\n\nNow for the direct callers of prandom_bytes_state(), which\nare solely located in test cases for MTD devices, that is,\ndrivers/mtd/tests/{oobtest.c,pagetest.c,subpagetest.c}:\n\nThese tests basically fill a test write-vector through\nprandom_bytes_state() with an a-priori defined seed each time\nand write that to a MTD device. Later on, they set up a read-vector\nand read back that blocks from the device. So in the verification\nphase, the write-vector is being re-setup [ so same seed and\nprandom_bytes_state() called ], and then memcmp()'ed against the\nread-vector to check if the data is the same.\n\nAkinobu, Lothar and I also tested this patch and it runs through\nthe 3 relevant MTD test cases w/o any errors on the nandsim device\n(simulator for MTD devs) for x86_64, ppc64, ARM (i.MX28, i.MX53\nand i.MX6):\n\n  # modprobe nandsim first_id_byte=0x20 second_id_byte=0xac \\\n                     third_id_byte=0x00 fourth_id_byte=0x15\n  # modprobe mtd_oobtest dev=0\n  # modprobe mtd_pagetest dev=0\n  # modprobe mtd_subpagetest dev=0\n\nWe also don't have any users depending directly on a particular\nresult of the PRNG (except the PRNG self-test itself), and that's\njust fine as it e.g. allowed us easily to do things like upgrading\nfrom taus88 to taus113.\n\nSigned-off-by: Daniel Borkmann <dborkman@redhat.com>\nTested-by: Akinobu Mita <akinobu.mita@gmail.com>\nTested-by: Lothar Waßmann <LW@KARO-electronics.de>\nCc: Hannes Frederic Sowa <hannes@stressinduktion.org>\nSigned-off-by: David S. Miller <davem@davemloft.net>\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nrandom32: add prandom_u32_max and convert open coded users\n\nMany functions have open coded a function that returns a random\nnumber in range [0,N-1]. Under the assumption that we have a PRNG\nsuch as taus113 with being well distributed in [0, ~0U] space,\nwe can implement such a function as uword t = (n*m')>>32, where\nm' is a random number obtained from PRNG, n the right open interval\nborder and t our resulting random number, with n,m',t in u32 universe.\n\nLets go with Joe and simply call it prandom_u32_max(), although\ntechnically we have an right open interval endpoint, but that we\nhave documented. Other users can further be migrated to the new\nprandom_u32_max() function later on; for now, we need to make sure\nto migrate reciprocal_divide() users for the reciprocal_divide()\nfollow-up fixup since their function signatures are going to change.\n\nJoint work with Hannes Frederic Sowa.\n\nCc: Jakub Zawadzki <darkjames-ws@darkjames.pl>\nCc: Eric Dumazet <eric.dumazet@gmail.com>\nCc: linux-kernel@vger.kernel.org\nSigned-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>\nSigned-off-by: Daniel Borkmann <dborkman@redhat.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>\n\nConflicts:\n\tnet/packet/af_packet.c\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nrandom: allow architectures to optionally define random_get_entropy()\n\nAllow architectures which have a disabled get_cycles() function to\nprovide a random_get_entropy() function which provides a fine-grained,\nrapidly changing counter that can be used by the /dev/random driver.\n\nFor example, an architecture might have a rapidly changing register\nused to control random TLB cache eviction, or DRAM refresh that\ndoesn't meet the requirements of get_cycles(), but which is good\nenough for the needs of the random driver.\n\nSigned-off-by: \"Theodore Ts'o\" <tytso@mit.edu>\nCc: stable@vger.kernel.org\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nrandom32: use e/frandom for reseeding, and a merge fixup\n\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nRevert \"binfmt_elf.c: use get_random_int() to fix entropy depleting\"\n\nThis reverts commit a9310fe217312dd0053963ede450dbbcdef26dfd.\n\nbinfmt_elf: use prandom - do not deplete entropy\n\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nrandom.h: declare erandom function\n\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nnet/packet: merge fix\n\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nrandom: sprinkle e/f/prandom in places that deplete entropy often\n\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>\nSigned-off-by: As007Akash <akashpathange.aaa47@gmail.com>","distinct":true,"url":"https://api.github.com/repos/As007Akash/XzoTic_msm8916/commits/b95aade5f6d9d8d0ba6b89b0ad46c01815b8a9f0"},{"sha":"6e4030a1afca236fd421375bd8a345d83396f2c0","author":{"name":"As007Akash","email":"7300e763d1842fc50583cd0808eeee12da1bfd4c@gmail.com"},"message":"NOT WORKING \"Lettuce:added DT2W\"\n\nThis reverts commit 7cb2660947e1faeb8f6861f4372fdcf266043b55.","distinct":true,"url":"https://api.github.com/repos/As007Akash/XzoTic_msm8916/commits/6e4030a1afca236fd421375bd8a345d83396f2c0"},{"sha":"4a3085e077d83c00e9dd3b73c1797c67688d42c0","author":{"name":"As007Akash","email":"7300e763d1842fc50583cd0808eeee12da1bfd4c@gmail.com"},"message":"Lettuce:added DT2W\n\nSigned-off-by: As007Akash <akashpathange.aaa47@gmail.com>","distinct":true,"url":"https://api.github.com/repos/As007Akash/XzoTic_msm8916/commits/4a3085e077d83c00e9dd3b73c1797c67688d42c0"},{"sha":"d69f7efc9459483c2443b1ec18bbce2346cce08c","author":{"name":"As007Akash","email":"7300e763d1842fc50583cd0808eeee12da1bfd4c@gmail.com"},"message":"NEW BUILD SCRIPT!\n\nSigned-off-by: As007Akash <akashpathange.aaa47@gmail.com>","distinct":true,"url":"https://api.github.com/repos/As007Akash/XzoTic_msm8916/commits/d69f7efc9459483c2443b1ec18bbce2346cce08c"},{"sha":"7f964f6609e3664287a9404a4833a8ebc77c0bed","author":{"name":"As007Akash","email":"7300e763d1842fc50583cd0808eeee12da1bfd4c@gmail.com"},"message":"add some needs\n\nSigned-off-by: As007Akash <akashpathange.aaa47@gmail.com>","distinct":true,"url":"https://api.github.com/repos/As007Akash/XzoTic_msm8916/commits/7f964f6609e3664287a9404a4833a8ebc77c0bed"}]}
{"actor":{"display_login":"As007Akash"}}