When a signature is generated, there are a number of things to check, for example, the parameter k must be between 1 and N-1, the r and s signature must not be null etc ...
There is another condition (I have never seen), even if the probability is extremely low: k must not be equal to the private key d.
If k is equal to d, the private key can be calculated by d = z(s-r)-1 (z is the reduced message hash)!
This case is very easy to detect. Indeed, if k == d, r is the x coordinate of the public key!
Although this case is very unlikely, it costs nothing to add this test in the module signature;
Here is an example:
Public key
Q: "0x02f24fb983ba6825277b09fabbf60afe833ebf03f0bb808cab04ccbfb81593d835" (compressed)
Message Hash
z: "0x8d29467f53b7a412dc54de9a8eeb8960821d191568f5e22f64806326a5e11f20"
Signature
r: "0xf24fb983ba6825277b09fabbf60afe833ebf03f0bb808cab04ccbfb81593d835"
s: "0x24f080f53a8384be1e3263aeabc48df6569286f29a7141baf43d8723988eb558"
You can effectively see that r==Qx. This indicates that k==d!
It is then easy to get the private key "0x26439421bbfcf3c81d8ab8cda150d6e2e280d1656e70d8e49e18acf5ae0f11df" and compute Q from it to be convinced that this is the correct value.