Skip to content

Instantly share code, notes, and snippets.

View ewxrjk's full-sized avatar

Richard Kettlewell ewxrjk

View GitHub Profile
@ewxrjk
ewxrjk / missed-optimization.txt
Created April 30, 2017 10:21
Missed optimization
richard@deodand:~$ cat t.c
unsigned long f();
unsigned long h() {
unsigned long x = f();
return x == (unsigned long)-1 ? 0 : x + 1;
}
richard@deodand:~$ gcc -O3 -S t.c && cat t.s
.file "t.c"
.text
#!/bin/bash -e
set -x
read -r -d '' BODY <<EOM
foo
EOM
echo "$BODY" | mail rjk
08:48 < ewx> wow, 11 curl advisories
09:07 < rejs> ewx: is that part of the 12 infosec days of christmas?
09:12 < ewx> that needs to exist.
09:14 < rejs> five zero-days!
09:19 < ewx> that occurred to me too.

Keybase proof

I hereby claim:

  • I am ewxrjk on github.
  • I am ewx (https://keybase.io/ewx) on keybase.
  • I have a public key whose fingerprint is 9006 B0ED 710D B81B 76D3 68D9 D338 8BA1 8A74 1BEF

To claim this, I am signing this object:

@ewxrjk
ewxrjk / gist:93808cdab43bcc5610519bd1f1a8c577
Last active January 15, 2021 12:39
FireTV pretending to be 192.168.49.1?
** Please do not post any more messages which amount to "I have the same issue" with no additional information.
** I get a notification for each one and it is just noise; knowing that one more person has the same issue does
** not help anyone. If these content-free comments continue to appear I will delete this gist to cut down on
** the noise. You have been warned.
Aug 21 20:02:57 sfere kernel: [107297.977252] IPv4: martian source 172.17.207.66 from 192.168.49.1, on dev br1
Aug 21 20:02:57 sfere kernel: [107297.981023] ll header: 00000000: 00 04 a7 05 ac 0c 84 d6 d0 91 67 b4 08 00 ..........g...
Aug 21 20:02:57 sfere kernel: [107298.729160] IPv4: martian source 172.17.207.66 from 192.168.49.1, on dev br1
Aug 21 20:02:57 sfere kernel: [107298.736326] ll header: 00000000: 00 04 a7 05 ac 0c 84 d6 d0 91 67 b4 08 00 ..........g...
Aug 21 20:02:58 sfere kernel: [107299.793616] IPv4: martian source 172.17.207.66 from 192.168.49.1, on dev br1
@ewxrjk
ewxrjk / gist:ba9a3c970273132bc46300478480537a
Last active August 21, 2016 09:35
lxc guest can reach router but not host
tcpdump on host showing that container (.19) can each other hosts (e.g. .1) but does not get a response to host address (.18)
rjk@araminta:~$ really tcpdump -npi vethE23AI6: host 172.17.207.19
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on vethE23AI6:, link-type EN10MB (Ethernet), capture size 262144 bytes
10:29:25.994201 IP 172.17.207.19.48716 > 172.17.207.1.53: 64233+ A? mirror.anjou.terraraq.org.uk. (46)
10:29:25.994243 IP 172.17.207.19.48716 > 172.17.207.1.53: 58575+ AAAA? mirror.anjou.terraraq.org.uk. (46)
10:29:25.994947 IP 172.17.207.1.53 > 172.17.207.19.48716: 64233* 1/3/2 A 172.17.207.18 (169)
10:29:25.995129 IP 172.17.207.1.53 > 172.17.207.19.48716: 58575* 0/1/0 (98)
10:29:25.995240 IP 172.17.207.19.58774 > 172.17.207.18.80: Flags [S], seq 4164822563, win 29200, options [mss 1460,sackOK,TS val 13201837 ecr 0,nop,wscale 7], length 0
$ cat 4096.py
import pyprimes
p=0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D788719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA993B4EA988D8FDDC186FFB7DC90A6C0
@ewxrjk
ewxrjk / gist:4a6b373691962ec2eb3d
Last active November 22, 2015 18:52
G++ LTO bug?
$ type g++-5
g++-5 is /usr/bin/g++-5
$ g++-5 --version
g++-5 (Debian 5.2.1-23) 5.2.1 20151028
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ dpkg -l g++-5 libstdc++-5-dev
Desired=Unknown/Install/Remove/Purge/Hold
@ewxrjk
ewxrjk / gist:64fde4ff96ec8ce593a8
Created September 13, 2015 10:59
Thanks, GCC
udplog.c: In function ‘main’:
udplog.c:72:5: error: assuming signed overflow does not occur when assuming that (X + c) >= X is always true [-Werror=strict-overflow]
int main(int argc, char **argv) {
^
udplog.c:72:5: error: assuming signed overflow does not occur when assuming that (X + c) >= X is always true [-Werror=strict-overflow]
cc1: all warnings being treated as errors
@ewxrjk
ewxrjk / syncretism!
Created June 28, 2015 13:22
Syncretism!
$ dig mx va
; <<>> DiG 9.9.5-9-Debian <<>> mx va
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18186
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 6, ADDITIONAL: 16
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096