$$
\begin{array}{l}
\text { 6. Let } f(x)=x^{2}+a x+b \cos x , \\
\{x \mid f(x)=0, x \in \mathbf{R}\} \\
=\{x \mid f(f(x))=0, x \in \mathbf{R}\} \neq \varnothing .
\end{array}
$$

Then the values of all real numbers $a$ and $b$ that satisfy the condition are . $\qquad$
$$
6.0 \leqslant a<4, b=0 .
$$

Let $x_{0} \in\{x \mid f(x)=0, x \in \mathbf{R}\}$, then
$$
b=f(0)=f\left(f\left(x_{0}\right)\right)=0 \text {. }
$$

Thus, $f(x)=x(x+a)$,
$$
\begin{array}{l}
f(f(x))=f(x)(f(x)+a) \\
=x(x+a)\left(x^{2}+a x+a\right) .
\end{array}
$$

Obviously, $a=0$ satisfies the condition.
If $a \neq 0$, since the roots of $x^{2}+a x+a=0$ cannot be 0 or $-a$, therefore, $x^{2}+a x+a=0$ has no real roots. Then
$$
\Delta=a^{2}-4 a<0 \Leftrightarrow 0<a<4 \text {. }
$$

Hence, the $a$ and $b$ that satisfy the given conditions are $0 \leqslant a<4, b=0$.