]> git.baikalelectronics.ru Git - kernel.git/commit
IB/mlx5: Allow mapping the free running counter on PROT_EXEC
authorMatan Barak <matanb@mellanox.com>
Thu, 14 Apr 2016 13:52:10 +0000 (16:52 +0300)
committerDoug Ledford <dledford@redhat.com>
Fri, 13 May 2016 23:40:03 +0000 (19:40 -0400)
commit55ce32d96d9c63bab7feb88690c5d8f14bde6d2f
treed361a3fe422482b0a0876cab0362ca7084a73d27
parenta83d9bd328b7396fffdada1f867982f6998aa9f2
IB/mlx5: Allow mapping the free running counter on PROT_EXEC

The current mlx5 code disallows mapping the free running counter of
mlx5 based hardwares when PROT_EXEC is set.
Although this behaviour is correct, Linux does add an implicit VM_EXEC
to the vm_flags if the READ_IMPLIES_EXEC bit is set in the process
personality. This happens for example if the process stack is
executable.

This causes libmlx5 to output a warning and prevents the user from
reading the free running clock.
Executing the init segment of the hardware isn't a security risk
(at least no more than executing a process own stack), so we just
prevent writes to there.

Fixes: 6cd3a985cf49 ('IB/mlx5: Mmap the HCA's core clock register to
      user-space')
Signed-off-by: Matan Barak <matanb@mellanox.com>
Reviewed-by: Haggai Eran <haggaie@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/mlx5/main.c