beagleboard / am335x_pru_package

331 stars 181 forks source link

`prussdrv_exec_program()` sometimes crashes if binary is larger than PRUSS_MAX_IRAM_SIZE #50

Closed e-matteson closed 6 years ago

e-matteson commented 8 years ago

If you attempt to exec a binary larger than PRUSS_MAX_IRAM_SIZE (8192 bytes) using prussdrv_exec_program(), bad things happen.

Sometimes the exec appears to succeed, the loader program continues running, and (some part of) the binary runs on the PRU. Sometimes the loader program crashes.

I think the solution is to check the file size in prussdrv_exec_program_at() and return -1 if it's too large. I can submit a pull request with that change, but I'm not sure how to compile and test the new version, so note that it is untested.

jadonk commented 8 years ago

It doesn't look too harmful, so I'll get it pulled in and it should show up in future system builds.