mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:24:47 +01:00
Summary
* Removed macros from proc handler converters Replace the proc converter macros with "regular" functions. Though it is more verbose than the macro version, it helps when debugging and better aligns with coding-style.rst. * General cleanup Remove superfluous ctl_table forward declarations. Const qualify the memory_allocation_profiling_sysctl and loadpin_sysctl_table arrays. Add missing kernel doc to proc_dointvec_conv. * Testing This series was run through sysctl selftests/kunit test suite in x86_64. And went into linux-next after rc4, giving it a good 3 weeks of testing -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEErkcJVyXmMSXOyyeQupfNUreWQU8FAmmUabYACgkQupfNUreW QU8y2Qv/d2y35uQPRDh0HKWKWXJy41C2RJzd/rFCWJPCwo150whTSHIHkWYnu76g 10QblBXQmXi9TVqFnJ7Il7PWgqkMPjzA13tfT9eXNWU8j2OB/mcVKNl9X4wm/jWi QxtGmBsIQ/nxb2pUzMCykzgfc5mLi2NQ8qhZ5bOnq7UW3zdYmzEqx+tRdvIacyIk adComi5v8xUDqyEbVFaBovuX2WHQkPyBMnD64nwWG93JpNG/+9PxGzv/DNUXY11Y epVOfSoKdJbSLjYoHEPEhT0aHjSydq3QHru7uF6wzKOFTfHej/XkXXbUnFXPO2Pn c5J0u/HziYG5eN2QTqGfrhECZYuCFPemtUozltbcgGebkl1wKH+k9K5vsCaz/mhk ihUC3mui++W/n9B9HJRYh1XeEpk6C1pWERCOx27XFZ25fSek2YO6ZWkT0q+gceC0 t4+eIFSGJ3OzheJgHNK9XhTMWiQPmHyA6brXYGx4WeRvJFLpVddPF7k3Z89zIAu/ Fut7FGTH =0Z+I -----END PGP SIGNATURE----- Merge tag 'sysctl-7.00-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctl Pull sysctl updates from Joel Granados: - Remove macros from proc handler converters Replace the proc converter macros with "regular" functions. Though it is more verbose than the macro version, it helps when debugging and better aligns with coding-style.rst. - General cleanup Remove superfluous ctl_table forward declarations. Const qualify the memory_allocation_profiling_sysctl and loadpin_sysctl_table arrays. Add missing kernel doc to proc_dointvec_conv. - Testing This series was run through sysctl selftests/kunit test suite in x86_64. And went into linux-next after rc4, giving it a good 3 weeks of testing * tag 'sysctl-7.00-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctl: sysctl: replace SYSCTL_INT_CONV_CUSTOM macro with functions sysctl: Replace unidirectional INT converter macros with functions sysctl: Add kernel doc to proc_douintvec_conv sysctl: Replace UINT converter macros with functions sysctl: Add CONFIG_PROC_SYSCTL guards for converter macros sysctl: clarify proc_douintvec_minmax doc sysctl: Return -ENOSYS from proc_douintvec_conv when CONFIG_PROC_SYSCTL=n sysctl: Remove unused ctl_table forward declarations loadpin: Implement custom proc_handler for enforce alloc_tag: move memory_allocation_profiling_sysctls into .rodata sysctl: Add missing kernel-doc for proc_dointvec_conv
This commit is contained in:
commit
23b0f90ba8
11 changed files with 438 additions and 178 deletions
|
|
@ -53,32 +53,29 @@ static DEFINE_SPINLOCK(pinned_root_spinlock);
|
|||
static bool deny_reading_verity_digests;
|
||||
#endif
|
||||
|
||||
// initialized to false
|
||||
static bool loadpin_root_writable;
|
||||
#ifdef CONFIG_SYSCTL
|
||||
static struct ctl_table loadpin_sysctl_table[] = {
|
||||
|
||||
static int proc_handler_loadpin(const struct ctl_table *table, int dir,
|
||||
void *buffer, size_t *lenp, loff_t *ppos)
|
||||
{
|
||||
if (!loadpin_root_writable && SYSCTL_USER_TO_KERN(dir))
|
||||
return -EINVAL;
|
||||
return proc_dointvec_minmax(table, dir, buffer, lenp, ppos);
|
||||
}
|
||||
|
||||
static const struct ctl_table loadpin_sysctl_table[] = {
|
||||
{
|
||||
.procname = "enforce",
|
||||
.data = &enforce,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = SYSCTL_ONE,
|
||||
.proc_handler = proc_handler_loadpin,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_ONE,
|
||||
},
|
||||
};
|
||||
|
||||
static void set_sysctl(bool is_writable)
|
||||
{
|
||||
/*
|
||||
* If load pinning is not enforced via a read-only block
|
||||
* device, allow sysctl to change modes for testing.
|
||||
*/
|
||||
if (is_writable)
|
||||
loadpin_sysctl_table[0].extra1 = SYSCTL_ZERO;
|
||||
else
|
||||
loadpin_sysctl_table[0].extra1 = SYSCTL_ONE;
|
||||
}
|
||||
#else
|
||||
static inline void set_sysctl(bool is_writable) { }
|
||||
#endif
|
||||
|
||||
static void report_writable(struct super_block *mnt_sb, bool writable)
|
||||
|
|
@ -132,7 +129,6 @@ static int loadpin_check(struct file *file, enum kernel_read_file_id id)
|
|||
struct super_block *load_root;
|
||||
const char *origin = kernel_read_file_id_str(id);
|
||||
bool first_root_pin = false;
|
||||
bool load_root_writable;
|
||||
|
||||
/* If the file id is excluded, ignore the pinning. */
|
||||
if ((unsigned int)id < ARRAY_SIZE(ignore_read_file_id) &&
|
||||
|
|
@ -153,7 +149,6 @@ static int loadpin_check(struct file *file, enum kernel_read_file_id id)
|
|||
}
|
||||
|
||||
load_root = file->f_path.mnt->mnt_sb;
|
||||
load_root_writable = sb_is_writable(load_root);
|
||||
|
||||
/* First loaded module/firmware defines the root for all others. */
|
||||
spin_lock(&pinned_root_spinlock);
|
||||
|
|
@ -169,8 +164,8 @@ static int loadpin_check(struct file *file, enum kernel_read_file_id id)
|
|||
spin_unlock(&pinned_root_spinlock);
|
||||
|
||||
if (first_root_pin) {
|
||||
report_writable(pinned_root, load_root_writable);
|
||||
set_sysctl(load_root_writable);
|
||||
loadpin_root_writable = sb_is_writable(pinned_root);
|
||||
report_writable(pinned_root, loadpin_root_writable);
|
||||
report_load(origin, file, "pinned");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue