A cheap convex solution on $$\mathbb{R}^2$$ is $$f_0(x,y):= \big(x+3y-2\big)_+ -y \, ,$$
which also verifies $$f_0(x,y)=-y$$ for all $$(x,y)$$ in the rectangle $$[-1/4, 5/4]\times [-1/4,1/4]=\big([0,1]\times\{0 \}\big)\;{\bf +}\; [-1/4,1/4]^2 \subset\{x+3y-2\le0\} \, ,$$ and $$f_0(x,y)=x+2(y-1)$$ in the rectangle $$[-1/4, 5/4]\times [3/4,5/4]=\big([0,1]\times\{1 \}\big)\big)\;{\bf +}\; [-1/4,1/4]^2 \subset\{x+3y-2\ge0\} \, .$$ As a consequence, if $$\phi$$ is a symmetric $$C^\infty$$ convolution kernel with support in $$[-1/4,1/4]^2$$, the function $$f:=f_0*\phi$$ is a $$C^\infty$$ convex function on $$\mathbb{R}^2$$ satisfying $$f(x,0)=0$$ and $$f(x,1)=x$$.
(We can take e.g. $$\phi(x,y):=\psi(x)\psi(y)$$ with $$\psi\in C^\infty(\mathbb{R})$$, $$\psi\ge0$$, $$\psi(-t)=\psi(t)$$, $$\operatorname{supp}(\psi)\subset[-1/4,1/4]$$, $$\int_\mathbb{R}\psi(t)dt=1$$ ).
For a concave $$C^\infty$$ solution, the same construction works with $$f_0(x,y):=2y-\big(3y-x-1\big)_+\;$$ and in fact it can be adapted to a more general situation, as the main point of it is just, that convolution with a non-negative mollifier with compact support preserves convexity, and also fixes any affine function, if the mollifier is symmetric (meaning $$\phi(x)=-\phi(x)$$ for all $$x$$).