Sadly, I get B2B marketing spam like that all the time as CTO, so I'm definitely not as shocked as others in this thread.
How is LinkedIn a "personal" channel, and why would it be illegal anyway? Direct marketing isn't illegal.
Depending on the jurisdiction it might be. E.g. in Germany cold calls (actual phone calls) even for B2B are only legal under certain conditions (generally either preexisting registration of intent, or if it's common in the specific industry). I'm not sure what the regulations regarding cold e-mail or messaging are, though.