Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp281879ybz; Thu, 23 Apr 2020 23:47:50 -0700 (PDT) X-Google-Smtp-Source: APiQypIN5K8+zWdGGfrxm81z6xVz63sSGL9T/Y7BHTE7ecKl7PanV2gk26oNo8+PEc06M3WzIxG0 X-Received: by 2002:a17:906:1804:: with SMTP id v4mr6049589eje.104.1587710870606; Thu, 23 Apr 2020 23:47:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587710870; cv=none; d=google.com; s=arc-20160816; b=mltERqfUM2cHltwc1Y4/ewxxx9T7YYhZYn+QlcTMow72h/S3EsrcgMRCIBC3ONQxpp 9rIfo4G+PYNUo/5z2p7HlgXJ0RMwm8veYH6SuXl6LuIc39Vq9JOHFrESr0u1jk0Y9XiB 2+W1SixXypoFMogMkJ0eA/D7gs8Zbt8RleFpGJRpDvkkVHXEvH9vT3BZPHZChYHWQ77s 9ZuGbbGHQvPBvdyPmgMZKt8KD31Pk+NPnbCwH0AdAjF8m0IcjJPOOBQfdTtT3LS5tauY KHThtpmyPz081fB2Q2TqkeXCJXbZ1Vfvsx1FaW3qZ3OZRrXF9fLiLFh3UnRUnaR+QyPx bIgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wDEsYStynWhsUFcoHz/u9cJV2oOwZ01DZ19l8vEDOnA=; b=NGzMbSvodwEsRnqQ+qDpRE8FfWxuch2FnZADyvdVrcM2tlDzX9TN5m1l21GOUQS/of nZ17jY9ZZv/fOE9GV5yQf1VN6ssUDLemHhT2CG2FVC/iGFaCb608HBAtoay5Wt07XOT7 5HSLKcDHi7gB+3hYyN03j+Mq+/bdJhLEh+TImMoAE5KQN1Jgpd9f2kTGNaOwvHbPPuTH yZo7VakSY8zu0/gxfEgOvxFrlpLpgREfYLoxdP4zgCpkKcGy2Wm0c+AdxOLUs/qOeaLN d24QoJyoPGUTe7B/8k4Xo12gp4vI5vli1Pw+7kTIV7YBMrwAJ/46ruvxLKAMrEfYfJ/S 3CYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Pb7GxTWZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o6si2608907ejb.97.2020.04.23.23.47.26; Thu, 23 Apr 2020 23:47:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Pb7GxTWZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726717AbgDXGny (ORCPT + 99 others); Fri, 24 Apr 2020 02:43:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726698AbgDXGnw (ORCPT ); Fri, 24 Apr 2020 02:43:52 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 601FEC09B045; Thu, 23 Apr 2020 23:43:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=wDEsYStynWhsUFcoHz/u9cJV2oOwZ01DZ19l8vEDOnA=; b=Pb7GxTWZvrN0QfDT3trhg4dHja Wza06KbuV1LLIhTqUf9vD1FqNZ5EDxET87WSr4LGS4nDlrJMsIS398Cb34eJ8ewO8bdtGglq7/ICo tQtnmpTn/AmTFAilxNdS6yWd6wmeHpf9Gad2oriHpcgy7V0WcrDprJ3ur7nMou4lKa0MUL1lYU0zG v1gZzLUWYNKvoF54qNM5D4MidEzmCIb8Ykjo1NFhCNpvwUTcekytvS6cSev/91bLNJ1KWp9P290tM ju9LyRftpd3tI0Qd49IEwgG0/8pjw8JM4CRKGjVTiMDy7qnG+WP8XbdKWd78DokEwgyKG2J2hBrMW 1dNjq+aw==; Received: from [2001:4bb8:193:f203:c70:4a89:bc61:2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jRs3x-00014P-4p; Fri, 24 Apr 2020 06:43:49 +0000 From: Christoph Hellwig To: Kees Cook , Iurii Zaikin Cc: Alexei Starovoitov , Daniel Borkmann , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH 3/5] sysctl: remove all extern declaration from sysctl.c Date: Fri, 24 Apr 2020 08:43:36 +0200 Message-Id: <20200424064338.538313-4-hch@lst.de> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200424064338.538313-1-hch@lst.de> References: <20200424064338.538313-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Extern declarations in .c files are a bad style and can lead to mismatches. Use existing definitions in headers where they exist, and otherwise move the external declarations to suitable header files. Signed-off-by: Christoph Hellwig --- include/linux/coredump.h | 4 ++++ include/linux/file.h | 2 ++ include/linux/mm.h | 2 ++ include/linux/mmzone.h | 2 ++ include/linux/pid.h | 3 +++ include/linux/sysctl.h | 8 +++++++ kernel/sysctl.c | 45 +++------------------------------------- 7 files changed, 24 insertions(+), 42 deletions(-) diff --git a/include/linux/coredump.h b/include/linux/coredump.h index abf4b4e65dbb9..7a899e83835d5 100644 --- a/include/linux/coredump.h +++ b/include/linux/coredump.h @@ -22,4 +22,8 @@ extern void do_coredump(const kernel_siginfo_t *siginfo); static inline void do_coredump(const kernel_siginfo_t *siginfo) {} #endif +extern int core_uses_pid; +extern char core_pattern[]; +extern unsigned int core_pipe_limit; + #endif /* _LINUX_COREDUMP_H */ diff --git a/include/linux/file.h b/include/linux/file.h index 142d102f285e5..122f80084a3ef 100644 --- a/include/linux/file.h +++ b/include/linux/file.h @@ -94,4 +94,6 @@ extern void fd_install(unsigned int fd, struct file *file); extern void flush_delayed_fput(void); extern void __fput_sync(struct file *); +extern unsigned int sysctl_nr_open_min, sysctl_nr_open_max; + #endif /* __LINUX_FILE_H */ diff --git a/include/linux/mm.h b/include/linux/mm.h index 5a323422d783d..9c4e7e76deddc 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3140,5 +3140,7 @@ unsigned long wp_shared_mapping_range(struct address_space *mapping, pgoff_t first_index, pgoff_t nr); #endif +extern int sysctl_nr_trim_pages; + #endif /* __KERNEL__ */ #endif /* _LINUX_MM_H */ diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index f37bb8f187fc7..b2af594ef0f7c 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -909,6 +909,7 @@ static inline int is_highmem(struct zone *zone) /* These two functions are used to setup the per zone pages min values */ struct ctl_table; + int min_free_kbytes_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); int watermark_scale_factor_sysctl_handler(struct ctl_table *, int, @@ -925,6 +926,7 @@ int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *, int, extern int numa_zonelist_order_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); +extern int percpu_pagelist_fraction; extern char numa_zonelist_order[]; #define NUMA_ZONELIST_ORDER_LEN 16 diff --git a/include/linux/pid.h b/include/linux/pid.h index cc896f0fc4e34..93543cbc0e6b3 100644 --- a/include/linux/pid.h +++ b/include/linux/pid.h @@ -108,6 +108,9 @@ extern void transfer_pid(struct task_struct *old, struct task_struct *new, struct pid_namespace; extern struct pid_namespace init_pid_ns; +extern int pid_max; +extern int pid_max_min, pid_max_max; + /* * look up a PID in the hash table. Must be called with the tasklist_lock * or rcu_read_lock() held. diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 02fa84493f237..36143ca40b56b 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -207,7 +207,15 @@ void unregister_sysctl_table(struct ctl_table_header * table); extern int sysctl_init(void); +extern int pwrsw_enabled; +extern int unaligned_enabled; +extern int unaligned_dump_stack; +extern int no_unaligned_warning; + extern struct ctl_table sysctl_mount_point[]; +extern struct ctl_table random_table[]; +extern struct ctl_table firmware_config_table[]; +extern struct ctl_table epoll_table[]; #else /* CONFIG_SYSCTL */ static inline struct ctl_table_header *register_sysctl_table(struct ctl_table * table) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 99d27acf46465..31b934865ebc3 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -68,6 +68,9 @@ #include #include #include +#include +#include +#include #include "../lib/kstrtox.h" @@ -103,22 +106,6 @@ #if defined(CONFIG_SYSCTL) -/* External variables not in a header file. */ -extern int suid_dumpable; -#ifdef CONFIG_COREDUMP -extern int core_uses_pid; -extern char core_pattern[]; -extern unsigned int core_pipe_limit; -#endif -extern int pid_max; -extern int pid_max_min, pid_max_max; -extern int percpu_pagelist_fraction; -extern int latencytop_enabled; -extern unsigned int sysctl_nr_open_min, sysctl_nr_open_max; -#ifndef CONFIG_MMU -extern int sysctl_nr_trim_pages; -#endif - /* Constants used for minimum and maximum */ #ifdef CONFIG_LOCKUP_DETECTOR static int sixty = 60; @@ -160,24 +147,6 @@ static unsigned long hung_task_timeout_max = (LONG_MAX/HZ); #ifdef CONFIG_INOTIFY_USER #include #endif -#ifdef CONFIG_SPARC -#endif - -#ifdef CONFIG_PARISC -extern int pwrsw_enabled; -#endif - -#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW -extern int unaligned_enabled; -#endif - -#ifdef CONFIG_IA64 -extern int unaligned_dump_stack; -#endif - -#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN -extern int no_unaligned_warning; -#endif #ifdef CONFIG_PROC_SYSCTL @@ -243,14 +212,6 @@ static struct ctl_table vm_table[]; static struct ctl_table fs_table[]; static struct ctl_table debug_table[]; static struct ctl_table dev_table[]; -extern struct ctl_table random_table[]; -#ifdef CONFIG_EPOLL -extern struct ctl_table epoll_table[]; -#endif - -#ifdef CONFIG_FW_LOADER_USER_HELPER -extern struct ctl_table firmware_config_table[]; -#endif #if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \ defined(CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT) -- 2.26.1