diff options
author | Ranjanikar Nikhil Prabhakarrao <rprabhakarra@nvidia.com> | 2018-12-13 06:59:20 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2020-06-30 13:07:26 -0400 |
commit | f56874aec2ec61f2c341b813cc76de5acc51ea12 (patch) | |
tree | efd3d6a3921c930a76bf0cb7011ca6b9809ed5f3 /drivers/gpu/nvgpu/os/linux/ioctl_tsg.c | |
parent | bbef4c6927a13a24821c43cb2b6af72f859f7deb (diff) |
gpu: nvgpu: add speculative barrier
Data can be speculativerly stored and
code flow can be hijacked.
To mitigate this problem insert a
speculation barrier.
Bug 200447167
Change-Id: Ia865ff2add8b30de49aa970715625b13e8f71c08
Signed-off-by: Ranjanikar Nikhil Prabhakarrao <rprabhakarra@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1972221
(cherry picked from commit f0762ed4831b3fe6cc953a4a4ec26c2537dcb69f)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/1996052
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: Deepak Nibade <dnibade@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/os/linux/ioctl_tsg.c')
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/ioctl_tsg.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_tsg.c b/drivers/gpu/nvgpu/os/linux/ioctl_tsg.c index a26559f5..2f8cb3ae 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl_tsg.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl_tsg.c | |||
@@ -361,6 +361,7 @@ static int gk20a_tsg_event_id_ctrl(struct gk20a *g, struct tsg_gk20a *tsg, | |||
361 | if (args->event_id >= NVGPU_IOCTL_CHANNEL_EVENT_ID_MAX) | 361 | if (args->event_id >= NVGPU_IOCTL_CHANNEL_EVENT_ID_MAX) |
362 | return -EINVAL; | 362 | return -EINVAL; |
363 | 363 | ||
364 | nvgpu_speculation_barrier(); | ||
364 | switch (args->cmd) { | 365 | switch (args->cmd) { |
365 | case NVGPU_IOCTL_CHANNEL_EVENT_ID_CMD_ENABLE: | 366 | case NVGPU_IOCTL_CHANNEL_EVENT_ID_CMD_ENABLE: |
366 | err = gk20a_tsg_event_id_enable(tsg, args->event_id, &fd); | 367 | err = gk20a_tsg_event_id_enable(tsg, args->event_id, &fd); |
@@ -572,6 +573,7 @@ static int gk20a_tsg_ioctl_read_single_sm_error_state(struct gk20a *g, | |||
572 | if (args->record_size > 0) { | 573 | if (args->record_size > 0) { |
573 | size_t write_size = sizeof(*sm_error_state); | 574 | size_t write_size = sizeof(*sm_error_state); |
574 | 575 | ||
576 | nvgpu_speculation_barrier(); | ||
575 | if (write_size > args->record_size) | 577 | if (write_size > args->record_size) |
576 | write_size = args->record_size; | 578 | write_size = args->record_size; |
577 | 579 | ||