Rory McIlroy is two shots off the lead at the halfway stage of the BMW Masters in Shanghai, despite complaining that the local pollution is giving him headaches.