本文将mark下SMAP(Supervisor Memory Access Protection) and SMEP(Supervisor Memory Execute Protection)相关notes,参考kernel版本为v6.3。
Introduction
SMEP prevents the kernel running in ring 0 from executing code which is user accessible. SMAP prevents the kernel from accessing userspace memory while the AC flag in the RFLAGS register is clear. These features can help harden the kernel against exploitation and prevent certain kinds of memory corruption.
/** * igb_ptp_get_ts_config - get hardware time stamping config * @netdev: netdev struct * @ifr: interface struct * * Get the hwtstamp_config settings to return to the user. Rather than attempt * to deconstruct the settings from the registers, just return a shadow copy * of the last known settings. **/ intigb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr) { structigb_adapter *adapter = netdev_priv(netdev); structhwtstamp_config *config = &adapter->tstamp_config;