Russian and Ukrainian officials have signed a deal to allow grain exports from Ukrainian Black Sea ports, potentially averting the threat of a catastrophic global food crisis.