You will have to consider many legal issues that are sure to arise when writing a book or song about a real person without their permission.
First, you can legally write a book or song about a real person, however you will have to be careful about what you say/allege. If you make false allegations that a real person was involved in criminal or moral wrongdoing, you could be sued for defamation in civil court.
According to the law of defamation in Canada, you are permitted to publish information about others as long as you can successfully call upon one of several defences. For example, you can use the legal defence of “justification” or truth. Keep in mind however, that proving information is true in court may be a lot harder than you expected.
Second, you can use the legal defence of “fair comment.” This defence allows an individual to state a series of provable facts followed by an honest and fair commentary on those facts. If you lose a defamation lawsuit, you will be subjected to serious financial consequences in addition to the expensive lawyer fees that you will have to pay for.
Another legal consideration to think about is whether the person you are writing about might be perceived as endorsing a commercial venture that is associated with your book/song. If you use a person’s image or name for a commercial, promotional, or advertising purpose you may be implying that the person endorses your product. If the person did not authorize the use of their image or name, they may launch an action in civil court against you for “misappropriation of personality.”
A last question you may be asking yourself is whether the person has to be alive. For some famous people, there is an argument circulating that wrongfully using their name in association with an unapproved work may jeopardize the financial viability of their estate/ongoing business.
If a real person is the subject of your creative work, it is most likely the best idea to consult with a lawyer who has experience dealing with entertainment law.