2222#include <linux/slab.h>
2323#include <linux/vmalloc.h>
2424#include <linux/elf.h>
25- #include <linux/proc_fs.h>
2625#include <linux/seq_file.h>
2726#include <linux/syscalls.h>
2827#include <linux/fcntl.h>
@@ -805,31 +804,6 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
805804 return ret ;
806805}
807806
808- static inline void print_unload_info (struct seq_file * m , struct module * mod )
809- {
810- struct module_use * use ;
811- int printed_something = 0 ;
812-
813- seq_printf (m , " %i " , module_refcount (mod ));
814-
815- /*
816- * Always include a trailing , so userspace can differentiate
817- * between this and the old multi-field proc format.
818- */
819- list_for_each_entry (use , & mod -> source_list , source_list ) {
820- printed_something = 1 ;
821- seq_printf (m , "%s," , use -> source -> name );
822- }
823-
824- if (mod -> init != NULL && mod -> exit == NULL ) {
825- printed_something = 1 ;
826- seq_puts (m , "[permanent]," );
827- }
828-
829- if (!printed_something )
830- seq_puts (m , "-" );
831- }
832-
833807void __symbol_put (const char * symbol )
834808{
835809 struct find_symbol_arg fsa = {
@@ -919,12 +893,6 @@ void module_put(struct module *module)
919893EXPORT_SYMBOL (module_put );
920894
921895#else /* !CONFIG_MODULE_UNLOAD */
922- static inline void print_unload_info (struct seq_file * m , struct module * mod )
923- {
924- /* We don't know the usage count, or what modules are using. */
925- seq_puts (m , " - -" );
926- }
927-
928896static inline void module_unload_free (struct module * mod )
929897{
930898}
@@ -3596,7 +3564,7 @@ static void cfi_cleanup(struct module *mod)
35963564}
35973565
35983566/* Keep in sync with MODULE_FLAGS_BUF_SIZE !!! */
3599- static char * module_flags (struct module * mod , char * buf )
3567+ char * module_flags (struct module * mod , char * buf )
36003568{
36013569 int bx = 0 ;
36023570
@@ -3619,103 +3587,6 @@ static char *module_flags(struct module *mod, char *buf)
36193587 return buf ;
36203588}
36213589
3622- #ifdef CONFIG_PROC_FS
3623- /* Called by the /proc file system to return a list of modules. */
3624- static void * m_start (struct seq_file * m , loff_t * pos )
3625- {
3626- mutex_lock (& module_mutex );
3627- return seq_list_start (& modules , * pos );
3628- }
3629-
3630- static void * m_next (struct seq_file * m , void * p , loff_t * pos )
3631- {
3632- return seq_list_next (p , & modules , pos );
3633- }
3634-
3635- static void m_stop (struct seq_file * m , void * p )
3636- {
3637- mutex_unlock (& module_mutex );
3638- }
3639-
3640- static int m_show (struct seq_file * m , void * p )
3641- {
3642- struct module * mod = list_entry (p , struct module , list );
3643- char buf [MODULE_FLAGS_BUF_SIZE ];
3644- void * value ;
3645-
3646- /* We always ignore unformed modules. */
3647- if (mod -> state == MODULE_STATE_UNFORMED )
3648- return 0 ;
3649-
3650- seq_printf (m , "%s %u" ,
3651- mod -> name , mod -> init_layout .size + mod -> core_layout .size );
3652- print_unload_info (m , mod );
3653-
3654- /* Informative for users. */
3655- seq_printf (m , " %s" ,
3656- mod -> state == MODULE_STATE_GOING ? "Unloading" :
3657- mod -> state == MODULE_STATE_COMING ? "Loading" :
3658- "Live" );
3659- /* Used by oprofile and other similar tools. */
3660- value = m -> private ? NULL : mod -> core_layout .base ;
3661- seq_printf (m , " 0x%px" , value );
3662-
3663- /* Taints info */
3664- if (mod -> taints )
3665- seq_printf (m , " %s" , module_flags (mod , buf ));
3666-
3667- seq_puts (m , "\n" );
3668- return 0 ;
3669- }
3670-
3671- /*
3672- * Format: modulename size refcount deps address
3673- *
3674- * Where refcount is a number or -, and deps is a comma-separated list
3675- * of depends or -.
3676- */
3677- static const struct seq_operations modules_op = {
3678- .start = m_start ,
3679- .next = m_next ,
3680- .stop = m_stop ,
3681- .show = m_show
3682- };
3683-
3684- /*
3685- * This also sets the "private" pointer to non-NULL if the
3686- * kernel pointers should be hidden (so you can just test
3687- * "m->private" to see if you should keep the values private).
3688- *
3689- * We use the same logic as for /proc/kallsyms.
3690- */
3691- static int modules_open (struct inode * inode , struct file * file )
3692- {
3693- int err = seq_open (file , & modules_op );
3694-
3695- if (!err ) {
3696- struct seq_file * m = file -> private_data ;
3697- m -> private = kallsyms_show_value (file -> f_cred ) ? NULL : (void * )8ul ;
3698- }
3699-
3700- return err ;
3701- }
3702-
3703- static const struct proc_ops modules_proc_ops = {
3704- .proc_flags = PROC_ENTRY_PERMANENT ,
3705- .proc_open = modules_open ,
3706- .proc_read = seq_read ,
3707- .proc_lseek = seq_lseek ,
3708- .proc_release = seq_release ,
3709- };
3710-
3711- static int __init proc_modules_init (void )
3712- {
3713- proc_create ("modules" , 0 , NULL , & modules_proc_ops );
3714- return 0 ;
3715- }
3716- module_init (proc_modules_init );
3717- #endif
3718-
37193590/* Given an address, look for it in the module exception tables. */
37203591const struct exception_table_entry * search_module_extables (unsigned long addr )
37213592{
0 commit comments