This study presents the design of feedback controllers for generalized cost functions to deal with stochastic optimal control problems. Target linear systems contain time-invariant stochastic parameters that describe system uncertainty. The cost functions involve nonlinear mappings and polynomial forms of the system states and inputs to express various performance metrics. Unfortunately, these properties cause difficulties in solving the problems. Conventional methods, such as the principle of optimality, are not employed to solve such problems owing to the time-invariant parameters. As opposed to the well-known quadratic functions, handling the generalized cost functions is a complicated task. This study overcomes these challenges by deriving an explicit relation between the cost function and the linear feedback gain of a controller. The derived relation enables the feedback gain to be optimized via a gradient method. A theoretical analysis ensures the convergence of the proposed gradient method. A suboptimal feedback controller is obtained to solve the problem, even for the generalized cost. Furthermore, the controller guarantees robust stability of the feedback system even with the stochastic parameters. It is demonstrated that the proposed cost function can express an expectation of a quadratic cost, risk-sensitive cost, polynomial cost, and input-to-state gain. A numerical simulation shows the effectiveness of the proposed method.