




1
1






















char bytes[10];
int main() {
bytes[0] = 2;
bytes[1] = 4;
bytes[2] = 4;
bytes[3] = 4;
bytes[4] = 4;
bytes[5] = 4;
bytes[6] = 4;
bytes[7] = 4;
bytes[8] = 4;
bytes[9] = 6;
return 0;
}
Since bytes variable is not initialized it goes to .bss section(maybe) so when call cc main.c -c addresses which point to that memory will be 0x0. Like here:
4: c6 05 00 00 00 00 02 movb $0x2,0x0(%rip) # b <main+0xb>
b: c6 05 00 00 00 00 04 movb $0x4,0x0(%rip) # 12 <main+0x12>
I will be set after linking. And everything works and all gud. But why in .rela.text section(run readelf -a main.o) it goes from bytes - 5 to bytes + 4 why not from bytes to bytes + 9
Relocation section '.rela.text' at offset 0x1c8 contains 10 entries:
Offset Info Type Sym. Value Sym. Name + Addend
000000000006 000300000002 R_X86_64_PC32 0000000000000000 bytes - 5
00000000000d 000300000002 R_X86_64_PC32 0000000000000000 bytes - 4
000000000014 000300000002 R_X86_64_PC32 0000000000000000 bytes - 3
00000000001b 000300000002 R_X86_64_PC32 0000000000000000 bytes - 2
000000000022 000300000002 R_X86_64_PC32 0000000000000000 bytes - 1
000000000029 000300000002 R_X86_64_PC32 0000000000000000 bytes + 0
000000000030 000300000002 R_X86_64_PC32 0000000000000000 bytes + 1
000000000037 000300000002 R_X86_64_PC32 0000000000000000 bytes + 2
00000000003e 000300000002 R_X86_64_PC32 0000000000000000 bytes + 3
000000000045 000300000002 R_X86_64_PC32 0000000000000000 bytes + 4






char bytes[10];
int main() {
bytes[0] = 2;
bytes[1] = 4;
bytes[2] = 4;
bytes[3] = 4;
bytes[4] = 4;
bytes[5] = 4;
bytes[6] = 4;
bytes[7] = 4;
bytes[8] = 4;
bytes[9] = 6;
return 0;
}
Since bytes variable is not initialized it goes to .bss section(maybe) so when call cc main.c -c addresses which point to that memory will be 0x0. Like here:
4: c6 05 00 00 00 00 02 movb $0x2,0x0(%rip) # b <main+0xb>
b: c6 05 00 00 00 00 04 movb $0x4,0x0(%rip) # 12 <main+0x12>
I will be set after linking. And everything works and all gud. But why in .rela.text section(run readelf -a main.o) it goes from bytes - 5 to bytes + 4 why not from bytes to bytes + 9
Relocation section '.rela.text' at offset 0x1c8 contains 10 entries:
Offset Info Type Sym. Value Sym. Name + Addend
000000000006 000300000002 R_X86_64_PC32 0000000000000000 bytes - 5
00000000000d 000300000002 R_X86_64_PC32 0000000000000000 bytes - 4
000000000014 000300000002 R_X86_64_PC32 0000000000000000 bytes - 3
00000000001b 000300000002 R_X86_64_PC32 0000000000000000 bytes - 2
000000000022 000300000002 R_X86_64_PC32 0000000000000000 bytes - 1
000000000029 000300000002 R_X86_64_PC32 0000000000000000 bytes + 0
000000000030 000300000002 R_X86_64_PC32 0000000000000000 bytes + 1
000000000037 000300000002 R_X86_64_PC32 0000000000000000 bytes + 2
00000000003e 000300000002 R_X86_64_PC32 0000000000000000 bytes + 3
000000000045 000300000002 R_X86_64_PC32 0000000000000000 bytes + 4








char bytes[10];
int main() {
bytes[0] = 2;
bytes[1] = 4;
bytes[2] = 4;
bytes[3] = 4;
bytes[4] = 4;
bytes[5] = 4;
bytes[6] = 4;
bytes[7] = 4;
bytes[8] = 4;
bytes[9] = 6;
return 0;
}
Since bytes variable is not initialized it goes to .bss section(maybe) so when call cc main.c -c addresses which point to that memory will be 0x0. Like here:
4: c6 05 00 00 00 00 02 movb $0x2,0x0(%rip) # b <main+0xb>
b: c6 05 00 00 00 00 04 movb $0x4,0x0(%rip) # 12 <main+0x12>
I will be set after linking. And everything works and all gud. But why in .rela.text section(run readelf -a main.o) it goes from bytes - 5 to bytes + 4 why not from bytes to bytes + 9
Relocation section '.rela.text' at offset 0x1c8 contains 10 entries:
Offset Info Type Sym. Value Sym. Name + Addend
000000000006 000300000002 R_X86_64_PC32 0000000000000000 bytes - 5
00000000000d 000300000002 R_X86_64_PC32 0000000000000000 bytes - 4
000000000014 000300000002 R_X86_64_PC32 0000000000000000 bytes - 3
00000000001b 000300000002 R_X86_64_PC32 0000000000000000 bytes - 2
000000000022 000300000002 R_X86_64_PC32 0000000000000000 bytes - 1
000000000029 000300000002 R_X86_64_PC32 0000000000000000 bytes + 0
000000000030 000300000002 R_X86_64_PC32 0000000000000000 bytes + 1
000000000037 000300000002 R_X86_64_PC32 0000000000000000 bytes + 2
00000000003e 000300000002 R_X86_64_PC32 0000000000000000 bytes + 3
000000000045 000300000002 R_X86_64_PC32 0000000000000000 bytes + 4

0000000000000000 <main>:
0: f3 0f 1e fa endbr64
4: 55 push rbp
5: 48 89 e5 mov rbp,rsp
8: c6 05 00 00 00 00 02 mov BYTE PTR [rip+0x0],0x2 # f <main+0xf>
f: c6 05 00 00 00 00 04 mov BYTE PTR [rip+0x0],0x4 # 16 <main+0x16>
16: c6 05 00 00 00 00 04 mov BYTE PTR [rip+0x0],0x4 # 1d <main+0x1d>
1d: c6 05 00 00 00 00 04 mov BYTE PTR [rip+0x0],0x4 # 24 <main+0x24>
24: c6 05 00 00 00 00 04 mov BYTE PTR [rip+0x0],0x4 # 2b <main+0x2b>
2b: c6 05 00 00 00 00 04 mov BYTE PTR [rip+0x0],0x4 # 32 <main+0x32>
32: c6 05 00 00 00 00 04 mov BYTE PTR [rip+0x0],0x4 # 39 <main+0x39>
39: c6 05 00 00 00 00 04 mov BYTE PTR [rip+0x0],0x4 # 40 <main+0x40>
40: c6 05 00 00 00 00 04 mov BYTE PTR [rip+0x0],0x4 # 47 <main+0x47>
47: c6 05 00 00 00 00 06 mov BYTE PTR [rip+0x0],0x6 # 4e <main+0x4e>
4e: b8 00 00 00 00 mov eax,0x0
53: 5d pop rbp
54: c3 ret

0000000000000000 <main>:
0: f3 0f 1e fa endbr64
4: 55 push rbp
5: 48 89 e5 mov rbp,rsp
8: c6 05 00 00 00 00 02 mov BYTE PTR [rip+0x0],0x2 # f <main+0xf>
f: c6 05 00 00 00 00 04 mov BYTE PTR [rip+0x0],0x4 # 16 <main+0x16>
16: c6 05 00 00 00 00 04 mov BYTE PTR [rip+0x0],0x4 # 1d <main+0x1d>
1d: c6 05 00 00 00 00 04 mov BYTE PTR [rip+0x0],0x4 # 24 <main+0x24>
24: c6 05 00 00 00 00 04 mov BYTE PTR [rip+0x0],0x4 # 2b <main+0x2b>
2b: c6 05 00 00 00 00 04 mov BYTE PTR [rip+0x0],0x4 # 32 <main+0x32>
32: c6 05 00 00 00 00 04 mov BYTE PTR [rip+0x0],0x4 # 39 <main+0x39>
39: c6 05 00 00 00 00 04 mov BYTE PTR [rip+0x0],0x4 # 40 <main+0x40>
40: c6 05 00 00 00 00 04 mov BYTE PTR [rip+0x0],0x4 # 47 <main+0x47>
47: c6 05 00 00 00 00 06 mov BYTE PTR [rip+0x0],0x6 # 4e <main+0x4e>
4e: b8 00 00 00 00 mov eax,0x0
53: 5d pop rbp
54: c3 ret 


Mon Apr 8 09:57:01 2024 >>> www-client/firefox-124.0.2
merge time: 8 minutes and 40 seconds.


char bytes[10];
int main() {
bytes[0] = 2;
bytes[1] = 4;
bytes[2] = 4;
bytes[3] = 4;
bytes[4] = 4;
bytes[5] = 4;
bytes[6] = 4;
bytes[7] = 4;
bytes[8] = 4;
bytes[9] = 6;
return 0;
}
Since bytes variable is not initialized it goes to .bss section(maybe) so when call cc main.c -c addresses which point to that memory will be 0x0. Like here:
4: c6 05 00 00 00 00 02 movb $0x2,0x0(%rip) # b <main+0xb>
b: c6 05 00 00 00 00 04 movb $0x4,0x0(%rip) # 12 <main+0x12>
I will be set after linking. And everything works and all gud. But why in .rela.text section(run readelf -a main.o) it goes from bytes - 5 to bytes + 4 why not from bytes to bytes + 9
Relocation section '.rela.text' at offset 0x1c8 contains 10 entries:
Offset Info Type Sym. Value Sym. Name + Addend
000000000006 000300000002 R_X86_64_PC32 0000000000000000 bytes - 5
00000000000d 000300000002 R_X86_64_PC32 0000000000000000 bytes - 4
000000000014 000300000002 R_X86_64_PC32 0000000000000000 bytes - 3
00000000001b 000300000002 R_X86_64_PC32 0000000000000000 bytes - 2
000000000022 000300000002 R_X86_64_PC32 0000000000000000 bytes - 1
000000000029 000300000002 R_X86_64_PC32 0000000000000000 bytes + 0
000000000030 000300000002 R_X86_64_PC32 0000000000000000 bytes + 1
000000000037 000300000002 R_X86_64_PC32 0000000000000000 bytes + 2
00000000003e 000300000002 R_X86_64_PC32 0000000000000000 bytes + 3
000000000045 000300000002 R_X86_64_PC32 0000000000000000 bytes + 4



















static though btw

Mon Apr 8 09:57:01 2024 >>> www-client/firefox-124.0.2
merge time: 8 minutes and 40 seconds. 










This mode will make your team behave like team 0. (edited)

this review hasn't been handled yet >:( (edited)










- when finish sentence
okay then
R_X86_64_PC32 is a relocation type that has calculation S + A - P where S is the value in symtab, A is the addend we are discussing, P is the address of the storage unit being relocated.
.bss + 0x8, S ends up being .bss + 0x8, P is the address of .text since that's the "storage unit" being relocated..text + r_offset. There we want to insert the difference between .bss + 0x8 and %rip since we have rip relative addressing. So we want to calculate .bss + 0x8 - %rip%rip is at the point we are modifying (by definition) pointing to the next instruction, which is 5 bytes ahead, 4 bytes we are replacing currently + 1 byte for the operand. (This is only for this case of a rip-relative mov instruction with an immediate operand). So %rip = .text + r_offset + 5.bss + 0x8 - (.text + r_offset + 5) = S - (P + 5) = S - 5 + P thus we have that our A must be -5 for us to get to the correct address using the things we have
S + 5 - P but i had to S - 5 - P because FIVE IS NEGATIVE 


- when finish sentence 





S in total, our instruction accesses absolute address %rip + <value we control>. We need to craft our value such that it's S - %rip so the rip dependence goes away. We know rip at link time because we know where we place our instruction. %rip will be 5 + .text + r_offset as discussed earlier. Now it should be obvious why addend needs to be negative there





























































ec_bindaddr "localhost"
ec_port 16321
ec_password "test"
ec_bantime 0
ec_auth_timeout 120
ec_output_level 1
I tried: 127.0.0.1 instead of localhost, checked if port is used, tried different ports, starting server using root, disabling firewall (temporarily) ...
I always get this error/warning on server startup:
2024-04-08 21:47:26 I http: libcurl version 7.81.0 (compiled = 8.0.1)
2024-04-08 21:47:26 I host_lookup: host='localhost' port=0 3
2024-04-08 21:47:26 I net: failed to bind socket with domain 10 and type 1 (99 'Cannot assign requested address')
2024-04-08 21:47:26 I econ: couldn't open socket. port might already be in use
Any ideas? Could i be missing dependencies? (edited)

1

ec_bindaddr "localhost"
ec_port 16321
ec_password "test"
ec_bantime 0
ec_auth_timeout 120
ec_output_level 1
I tried: 127.0.0.1 instead of localhost, checked if port is used, tried different ports, starting server using root, disabling firewall (temporarily) ...
I always get this error/warning on server startup:
2024-04-08 21:47:26 I http: libcurl version 7.81.0 (compiled = 8.0.1)
2024-04-08 21:47:26 I host_lookup: host='localhost' port=0 3
2024-04-08 21:47:26 I net: failed to bind socket with domain 10 and type 1 (99 'Cannot assign requested address')
2024-04-08 21:47:26 I econ: couldn't open socket. port might already be in use
Any ideas? Could i be missing dependencies? (edited)



1
1























cmake .. -DVULKAN=OFF (edited)

./DDNet “gfx_backend opengl”



error: narrowing conversion of ‘2155905024’ from ‘unsigned int’ to ‘int’ [-Wnarrowing]int aInts[2] = {0, 0x80808000};