News for hackers. Stuff that matters.
Re:C99 doesn't need function bodies, or 'VLAs are Turing com... by einpoklum on Thursday August 04, 2022 @01:19PM (#32345667)
With VLAs:

1. The stack-smashing pattern is simple, straightforward and sure to be used often. Other ways to smash the stack require some more "effort"...

2. It's not just _you_ who can smash the stack. It's the fact that anyone who calls your function will smash the stack if they pass some large numeric value.

Re:C99 doesn't need function bodies, or 'VLAs are Turing com... by saagarjha on Thursday August 04, 2022 @07:57PM (#32349840)
They can overflow the stack. They cannot smash the stack.
Re:C99 doesn't need function bodies, or 'VLAs are Turing com... by einpoklum on Friday August 05, 2022 @07:47AM (#32354755)
Fair enough; I had the mistaken idea that the two terms are interchangeable, but apparently stack smashing is only used for the attack involving the stack:

https://en.wikipedia.org/wiki/Stack_buffer_overflow

so, pretend I said "overflow" instead of "smash" in my post.

Re:C99 doesn't need function bodies, or 'VLAs are Turing com... by rhexs on Friday August 05, 2022 @02:34AM (#32352515)
Useless semantic pedantry at best, but arguable wrong as there isn't some sort of ISO standard on dumb hacking terms.
Re:C99 doesn't need function bodies, or 'VLAs are Turing com... by saagarjha on Friday August 05, 2022 @02:37AM (#32352544)
Overflowing the stack gives you a segfault. Smashing the stack lets hackers pop a shell on your computer. They are incredibly different. VLAs can crash your program, but they do not give attackers the ability to scribble all over the stack.
Re:C99 doesn't need function bodies, or 'VLAs are Turing com... by bjourne on Friday August 05, 2022 @03:53PM (#32361146)
> Overflowing the stack gives you a segfault.

Maybe. If the architecture supports protected memory and the compiler has placed an appropriately sized guard page below the stack. If it doesn't then overflowing the stack via a VLA gives you easy read and write access to any byte in program memory.

Re:C99 doesn't need function bodies, or 'VLAs are Turing com... by saagarjha on Friday August 05, 2022 @04:41PM (#32361740)
If your architecture does not support this then you’re at risk whenever you make a function call.
Re:C99 doesn't need function bodies, or 'VLAs are Turing com... by rhexs on Friday August 05, 2022 @08:13PM (#32363455)
Backpedal harder!
Re:C99 doesn't need function bodies, or 'VLAs are Turing com... by saagarjha on Friday August 05, 2022 @10:06PM (#32364128)
I’m not backpedaling. If your environment has guard pages and does probing then it protects equally well against VLAs and function calls overflowing the stack. If it has neither then both are liable to overwrite other memory. Obviously I would prefer that you have the protections, or some sort of equivalent, but they have nothing to do with VLAs.
Re:C99 doesn't need function bodies, or 'VLAs are Turing com... by pjmlp on Friday August 05, 2022 @04:54AM (#32353444)
Unless they happen to be enjoying kernel space.
Re:C99 doesn't need function bodies, or 'VLAs are Turing com... by saagarjha on Friday August 05, 2022 @03:27PM (#32360818)
There is no difference.