At least eight people have died after a stabbing attack at a Chinese school, with 17 others injured.