Let $M$ be a smooth Riemannian manifold without boundary. Let $X\subset M$ be a closed subset which is a smooth submanifold with boundary, $\dim X=\dim M$. Assume that $X$ is locally convex, i.e. any point of $X$ has a neighborhood $U$ such that for any two points from $X\cap U$ there exists a unique shortest geodesic in $M$ connecting them, and this geodesic is contained in $X\cap U$. 


**Question.** Let $p\in \partial X$. Let $\gamma$ be a geodesic in $M$ such that $\gamma(0)=p$ and $\gamma'(0)$ is tangent to $\partial X$. Is it true that there exists an open (in $M$) neighborhood $V$ of $p$ such that $\gamma \cap V$ does not intersect the interior of $X$?


Remark. If $M$ is a Euclidean space then the statement is true and it can be deduced e.g. from a version of the Hahn-Banach theorem.


A reference would be helpful.



Geometry of convex sets in Riemannian manifolds
Yes it is true.


Consider the signed diststance function $f=\mathrm{dist}\_{\partial X}$.
Note that it is semiconcave in a neigborhood of $X$;
moreover, $f''\le C\cdot |f|$ for some constant $C$ defined locally.
For your $\gamma$, we have $(f\circ\gamma)'=0$ and 
$$(f\circ\gamma)''\le C\cdot |f\circ\gamma|.$$ 
The latter implies $f\circ\gamma(t)\le 0$ for all sufficiently small $t$. 


