History

Merge branch 'errata/tx2-219' into for-next/fixes

Workaround for Cavium/Marvell ThunderX2 erratum #219. * errata/tx2-219: arm64: Allow CAVIUM_TX2_ERRATUM_219 to be selected arm64: Avoid Cavium TX2 erratum 219 when switching TTBR arm64: Enable workaround for Cavium TX2 erratum 219 when running SMT arm64: KVM: Trap VM ops when ARM64_WORKAROUND_CAVIUM_TX2_219_TVM is set

Will Deacon committed 7 years ago

Commit 777d0622 parents 597399d 603afdc298 files · +2755 −1802Browse files

Showing the changes to include/linux (7 of 298 files). Show all

Unified · Split

7 files
  1. include/linux/bitops.h +7 −0
  2. include/linux/dsa/sja1105.h +3 −1
  3. include/linux/kvm_host.h +2 −0
  4. include/linux/mii.h +9 −0
  5. include/linux/phy.h +2 −0
  6. include/linux/skbuff.h +1 −4
  7. include/linux/uaccess.h +70 −0
include/linux/bitops.h+7−0
@@ -4,6 +4,13 @@ · 3 unmodified lines
44 #include <asm/types.h>
55 #include <linux/bits.h>
66
7+/* Set bits in the first 'n' bytes when loaded from memory */
8+#ifdef __LITTLE_ENDIAN
9+# define aligned_byte_mask(n) ((1UL << 8*(n))-1)
10+#else
11+# define aligned_byte_mask(n) (~0xffUL << (BITS_PER_LONG - 8 - 8*(n)))
12+#endif
13+
714 #define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE)
815 #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long))
916
include/linux/dsa/sja1105.h+3−1
@@ -31,6 +31,8 @@ · 30 unmodified lines
3131 #define SJA1105_META_SMAC 0x222222222222ull
3232 #define SJA1105_META_DMAC 0x0180C200000Eull
3333
34+#define SJA1105_HWTS_RX_EN 0
35+
3436 /* Global tagger data: each struct sja1105_port has a reference to
3537 * the structure defined in struct sja1105_private.
3638 */
@@ -42,7 +44,7 @@ struct sja1105_tagger_data { · 5 unmodified lines
4244 * from taggers running on multiple ports on SMP systems
4345 */
4446 spinlock_t meta_lock;
45− bool hwts_rx_en;
47+ unsigned long state;
4648 };
4749
4850 struct sja1105_skb_cb {
include/linux/kvm_host.h+2−0
@@ -1090,6 +1090,7 @@ enum kvm_stat_kind { · 1089 unmodified lines
10901090
10911091 struct kvm_stat_data {
10921092 int offset;
1093+ int mode;
10931094 struct kvm *kvm;
10941095 };
10951096
@@ -1097,6 +1098,7 @@ struct kvm_stats_debugfs_item { · 1 unmodified line
10971098 const char *name;
10981099 int offset;
10991100 enum kvm_stat_kind kind;
1101+ int mode;
11001102 };
11011103 extern struct kvm_stats_debugfs_item debugfs_entries[];
11021104 extern struct dentry *kvm_debugfs_dir;
include/linux/mii.h+9−0
@@ -455,6 +455,15 @@ static inline void mii_lpa_mod_linkmode_lpa_t(unsigned long *lp_advertising, · 454 unmodified lines
455455 lp_advertising, lpa & LPA_LPACK);
456456 }
457457
458+static inline void mii_ctrl1000_mod_linkmode_adv_t(unsigned long *advertising,
459+ u32 ctrl1000)
460+{
461+ linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, advertising,
462+ ctrl1000 & ADVERTISE_1000HALF);
463+ linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, advertising,
464+ ctrl1000 & ADVERTISE_1000FULL);
465+}
466+
458467 /**
459468 * linkmode_adv_to_lcl_adv_t
460469 * @advertising:pointer to linkmode advertising
include/linux/phy.h+2−0
@@ -678,6 +678,7 @@ static inline bool phy_is_started(struct phy_device *phydev) · 677 unmodified lines
678678 return phydev->state >= PHY_UP;
679679 }
680680
681+void phy_resolve_aneg_pause(struct phy_device *phydev);
681682 void phy_resolve_aneg_linkmode(struct phy_device *phydev);
682683
683684 /**
@@ -1076,6 +1077,7 @@ int genphy_config_eee_advert(struct phy_device *phydev); · 392 unmodified lines
10761077 int __genphy_config_aneg(struct phy_device *phydev, bool changed);
10771078 int genphy_aneg_done(struct phy_device *phydev);
10781079 int genphy_update_link(struct phy_device *phydev);
1080+int genphy_read_lpa(struct phy_device *phydev);
10791081 int genphy_read_status(struct phy_device *phydev);
10801082 int genphy_suspend(struct phy_device *phydev);
10811083 int genphy_resume(struct phy_device *phydev);
include/linux/skbuff.h+1−4
@@ -4160,15 +4160,12 @@ static inline void __skb_ext_copy(struct sk_buff *d, const struct sk_buff *s) {} · 4159 unmodified lines
41604160 static inline void skb_ext_copy(struct sk_buff *dst, const struct sk_buff *s) {}
41614161 #endif /* CONFIG_SKB_EXTENSIONS */
41624162
4163−static inline void nf_reset(struct sk_buff *skb)
4163+static inline void nf_reset_ct(struct sk_buff *skb)
41644164 {
41654165 #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
41664166 nf_conntrack_put(skb_nfct(skb));
41674167 skb->_nfct = 0;
41684168 #endif
4169−#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
4170− skb_ext_del(skb, SKB_EXT_BRIDGE_NF);
4171−#endif
41724169 }
41734170
41744171 static inline void nf_reset_trace(struct sk_buff *skb)
include/linux/uaccess.h+70−0
@@ -231,6 +231,76 @@ __copy_from_user_inatomic_nocache(void *to, const void __user *from, · 230 unmodified lines
231231
232232 #endif /* ARCH_HAS_NOCACHE_UACCESS */
233233
234+extern __must_check int check_zeroed_user(const void __user *from, size_t size);
235+
236+/**
237+ * copy_struct_from_user: copy a struct from userspace
238+ * @dst: Destination address, in kernel space. This buffer must be @ksize
239+ * bytes long.
240+ * @ksize: Size of @dst struct.
241+ * @src: Source address, in userspace.
242+ * @usize: (Alleged) size of @src struct.
243+ *
244+ * Copies a struct from userspace to kernel space, in a way that guarantees
245+ * backwards-compatibility for struct syscall arguments (as long as future
246+ * struct extensions are made such that all new fields are *appended* to the
247+ * old struct, and zeroed-out new fields have the same meaning as the old
248+ * struct).
249+ *
250+ * @ksize is just sizeof(*dst), and @usize should've been passed by userspace.
251+ * The recommended usage is something like the following:
252+ *
253+ * SYSCALL_DEFINE2(foobar, const struct foo __user *, uarg, size_t, usize)
254+ * {
255+ * int err;
256+ * struct foo karg = {};
257+ *
258+ * if (usize > PAGE_SIZE)
259+ * return -E2BIG;
260+ * if (usize < FOO_SIZE_VER0)
261+ * return -EINVAL;
262+ *
263+ * err = copy_struct_from_user(&karg, sizeof(karg), uarg, usize);
264+ * if (err)
265+ * return err;
266+ *
267+ * // ...
268+ * }
269+ *
270+ * There are three cases to consider:
271+ * * If @usize == @ksize, then it's copied verbatim.
272+ * * If @usize < @ksize, then the userspace has passed an old struct to a
273+ * newer kernel. The rest of the trailing bytes in @dst (@ksize - @usize)
274+ * are to be zero-filled.
275+ * * If @usize > @ksize, then the userspace has passed a new struct to an
276+ * older kernel. The trailing bytes unknown to the kernel (@usize - @ksize)
277+ * are checked to ensure they are zeroed, otherwise -E2BIG is returned.
278+ *
279+ * Returns (in all cases, some data may have been copied):
280+ * * -E2BIG: (@usize > @ksize) and there are non-zero trailing bytes in @src.
281+ * * -EFAULT: access to userspace failed.
282+ */
283+static __always_inline __must_check int
284+copy_struct_from_user(void *dst, size_t ksize, const void __user *src,
285+ size_t usize)
286+{
287+ size_t size = min(ksize, usize);
288+ size_t rest = max(ksize, usize) - size;
289+
290+ /* Deal with trailing bytes. */
291+ if (usize < ksize) {
292+ memset(dst + size, 0, rest);
293+ } else if (usize > ksize) {
294+ int ret = check_zeroed_user(src + size, rest);
295+ if (ret <= 0)
296+ return ret ?: -E2BIG;
297+ }
298+ /* Copy the interoperable parts of the struct. */
299+ if (copy_from_user(dst, src, size))
300+ return -EFAULT;
301+ return 0;
302+}
303+
234304 /*
235305 * probe_kernel_read(): safely attempt to read from a location
236306 * @dst: pointer to the buffer that shall take the data

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t