@@ -58,22 +58,31 @@ extern unsigned long elf_hwcap;
#define ELF_PLATFORM (NULL)
#ifdef CONFIG_MMU
-#define ARCH_DLINFO \
-do { \
- NEW_AUX_ENT(AT_SYSINFO_EHDR, \
- (elf_addr_t)current->mm->context.vdso); \
- NEW_AUX_ENT(AT_L1I_CACHESIZE, \
- get_cache_size(1, CACHE_TYPE_INST)); \
- NEW_AUX_ENT(AT_L1I_CACHEGEOMETRY, \
- get_cache_geometry(1, CACHE_TYPE_INST)); \
- NEW_AUX_ENT(AT_L1D_CACHESIZE, \
- get_cache_size(1, CACHE_TYPE_DATA)); \
- NEW_AUX_ENT(AT_L1D_CACHEGEOMETRY, \
- get_cache_geometry(1, CACHE_TYPE_DATA)); \
- NEW_AUX_ENT(AT_L2_CACHESIZE, \
- get_cache_size(2, CACHE_TYPE_UNIFIED)); \
- NEW_AUX_ENT(AT_L2_CACHEGEOMETRY, \
- get_cache_geometry(2, CACHE_TYPE_UNIFIED)); \
+#define ARCH_DLINFO \
+do { \
+ NEW_AUX_ENT(AT_SYSINFO_EHDR, \
+ (elf_addr_t)current->mm->context.vdso); \
+ NEW_AUX_ENT(AT_L1I_CACHESIZE, \
+ get_cache_size(1, CACHE_TYPE_INST)); \
+ NEW_AUX_ENT(AT_L1I_CACHEGEOMETRY, \
+ get_cache_geometry(1, CACHE_TYPE_INST)); \
+ NEW_AUX_ENT(AT_L1D_CACHESIZE, \
+ get_cache_size(1, CACHE_TYPE_DATA)); \
+ NEW_AUX_ENT(AT_L1D_CACHEGEOMETRY, \
+ get_cache_geometry(1, CACHE_TYPE_DATA)); \
+ NEW_AUX_ENT(AT_L2_CACHESIZE, \
+ get_cache_size(2, CACHE_TYPE_UNIFIED)); \
+ NEW_AUX_ENT(AT_L2_CACHEGEOMETRY, \
+ get_cache_geometry(2, CACHE_TYPE_UNIFIED)); \
+ /* \
+ * Should always be nonzero unless there's a kernel bug. \
+ * If we haven't determined a sensible value to give to \
+ * userspace, omit the entry: \
+ */ \
+ if (likely(signal_minsigstksz)) \
+ NEW_AUX_ENT(AT_MINSIGSTKSZ, signal_minsigstksz); \
+ else \
+ NEW_AUX_ENT(AT_IGNORE, 0); \
} while (0)
#define ARCH_HAS_SETUP_ADDITIONAL_PAGES
struct linux_binprm;
@@ -7,6 +7,7 @@
#define _ASM_RISCV_PROCESSOR_H
#include <linux/const.h>
+#include <linux/cache.h>
#include <vdso/processor.h>
@@ -74,6 +75,7 @@ int riscv_of_parent_hartid(struct device_node *node);
extern void riscv_fill_hwcap(void);
extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
+extern unsigned long signal_minsigstksz __ro_after_init;
#endif /* __ASSEMBLY__ */
#endif /* _ASM_RISCV_PROCESSOR_H */
@@ -33,5 +33,6 @@
/* entries in ARCH_DLINFO */
#define AT_VECTOR_SIZE_ARCH 7
+#define AT_MINSIGSTKSZ 51
#endif /* _UAPI_ASM_RISCV_AUXVEC_H */
@@ -470,8 +470,16 @@ asmlinkage __visible void do_notify_resume(struct pt_regs *regs,
tracehook_notify_resume(regs);
}
+unsigned long __ro_after_init signal_minsigstksz;
+
void init_rt_signal_env(void);
void __init init_rt_signal_env(void)
{
rvv_sc_size = sizeof(struct __sc_riscv_v_state) + riscv_vsize;
+ /*
+ * Determine the stack space required for guaranteed signal delivery.
+ * The signal_minsigstksz will be populated into the AT_MINSIGSTKSZ entry
+ * in the auxiliary array at process startup.
+ */
+ signal_minsigstksz = cal_rt_frame_size();
}