Linux中与“内核安全”相关的数据结构

2023-05-16

五、内核安全相关数据结构

5.1 security_operations结构体

  • 这是一个钩子函数的指针数组,其中每一个数组元素都是一个SELINUX安全钩子函数,在2.6以上的内核中,大部分涉及安全控制的系统调用都被替换为了这个结构体中的对应钩子函数项,从而使SELINUX能在代码执行流这个层面实现安全访问控制。

  • 这个结构中包含了按照内核对象或内核子系统分组的钩子组成的子结构,以及一些用于系统操作的顶层钩子。在内核源代码中很容易找到对钩子函数的调用: 其前缀是security_ops->xxxx

    struct security_operations 
    {
        char name[SECURITY_NAME_MAX + 1];
    
        int (*ptrace_access_check) (struct task_struct *child, unsigned int mode);
        int (*ptrace_traceme) (struct task_struct *parent);
        int (*capget) (struct task_struct *target,\
                   kernel_cap_t *effective,\
                   kernel_cap_t *inheritable, kernel_cap_t *permitted);
        int (*capset) (struct cred *new,\
                   const struct cred *old,\
                   const kernel_cap_t *effective,\
                   const kernel_cap_t *inheritable,\
                   const kernel_cap_t *permitted);
        int (*capable) (struct task_struct *tsk, const struct cred *cred,\
                int cap, int audit);
        int (*acct) (struct file *file);
        int (*sysctl) (struct ctl_table *table, int op);
        int (*quotactl) (int cmds, int type, int id, struct super_block *sb);
        int (*quota_on) (struct dentry *dentry);
        int (*syslog) (int type);
        int (*settime) (struct timespec *ts, struct timezone *tz);
        int (*vm_enough_memory) (struct mm_struct *mm, long pages);
    
        int (*bprm_set_creds) (struct linux_binprm *bprm);
        int (*bprm_check_security) (struct linux_binprm *bprm);
        int (*bprm_secureexec) (struct linux_binprm *bprm);
        void (*bprm_committing_creds) (struct linux_binprm *bprm);
        void (*bprm_committed_creds) (struct linux_binprm *bprm);
    
        int (*sb_alloc_security) (struct super_block *sb);
        void (*sb_free_security) (struct super_block *sb);
        int (*sb_copy_data) (char *orig, char *copy);
        int (*sb_kern_mount) (struct super_block *sb, int flags, void *data);
        int (*sb_show_options) (struct seq_file *m, struct super_block *sb);
        int (*sb_statfs) (struct dentry *dentry);
        int (*sb_mount) (char *dev_name, struct path *path,
                 char *type, unsigned long flags, void *data);
        int (*sb_check_sb) (struct vfsmount *mnt, struct path *path);
        int (*sb_umount) (struct vfsmount *mnt, int flags);
        void (*sb_umount_close) (struct vfsmount *mnt);
        void (*sb_umount_busy) (struct vfsmount *mnt);
        void (*sb_post_remount) (struct vfsmount *mnt,
                     unsigned long flags, void *data);
        void (*sb_post_addmount) (struct vfsmount *mnt,\
                      struct path *mountpoint);
        int (*sb_pivotroot) (struct path *old_path,\
                     struct path *new_path);
        void (*sb_post_pivotroot) (struct path *old_path,\
                       struct path *new_path);
        int (*sb_set_mnt_opts) (struct super_block *sb,\
                    struct security_mnt_opts *opts);
        void (*sb_clone_mnt_opts) (const struct super_block *oldsb,\
                       struct super_block *newsb);
        int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts);
    
    #ifdef CONFIG_SECURITY_PATH
        int (*path_unlink) (struct path *dir, struct dentry *dentry);
        int (*path_mkdir) (struct path *dir, struct dentry *dentry, int mode);
        int (*path_rmdir) (struct path *dir, struct dentry *dentry);
        int (*path_mknod) (struct path *dir, struct dentry *dentry, int mode,\
                   unsigned int dev);
        int (*path_truncate) (struct path *path, loff_t length,\
                      unsigned int time_attrs);
        int (*path_symlink) (struct path *dir, struct dentry *dentry,\
                     const char *old_name);
        int (*path_link) (struct dentry *old_dentry, struct path *new_dir,\
                  struct dentry *new_dentry);
        int (*path_rename) (struct path *old_dir, struct dentry *old_dentry,\
                    struct path *new_dir, struct dentry *new_dentry);
    #endif
    
        int (*inode_alloc_security) (struct inode *inode);
        void (*inode_free_security) (struct inode *inode);
        int (*inode_init_security) (struct inode *inode, struct inode *dir,\
                        char **name, void **value, size_t *len);
        int (*inode_create) (struct inode *dir,\
                     struct dentry *dentry, int mode);
        int (*inode_link) (struct dentry *old_dentry,\
                   struct inode *dir, struct dentry *new_dentry);
        int (*inode_unlink) (struct inode *dir, struct dentry *dentry);
        int (*inode_symlink) (struct inode *dir,\
                      struct dentry *dentry, const char *old_name);
        int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode);
        int (*inode_rmdir) (struct inode *dir, struct dentry *dentry);
        int (*inode_mknod) (struct inode *dir, struct dentry *dentry,\
                    int mode, dev_t dev);
        int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry,\
                     struct inode *new_dir, struct dentry *new_dentry);
        int (*inode_readlink) (struct dentry *dentry);
        int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd);
        int (*inode_permission) (struct inode *inode, int mask);
        int (*inode_setattr)    (struct dentry *dentry, struct iattr *attr);
        int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry);
        void (*inode_delete) (struct inode *inode);
        int (*inode_setxattr) (struct dentry *dentry, const char *name,\
                       const void *value, size_t size, int flags);
        void (*inode_post_setxattr) (struct dentry *dentry, const char *name,\
                         const void *value, size_t size, int flags);
        int (*inode_getxattr) (struct dentry *dentry, const char *name);
        int (*inode_listxattr) (struct dentry *dentry);
        int (*inode_removexattr) (struct dentry *dentry, const char *name);
        int (*inode_need_killpriv) (struct dentry *dentry);
        int (*inode_killpriv) (struct dentry *dentry);
        int (*inode_getsecurity) (const struct inode *inode, \
                                  const char *name, void **buffer, bool alloc);
        int (*inode_setsecurity) (struct inode *inode, \
                                  const char *name, const void *value, \
                                  size_t size, int flags);
        int (*inode_listsecurity) (struct inode *inode, char *buffer, size_t buffer_size);
        void (*inode_getsecid) (const struct inode *inode, u32 *secid);
    
        int (*file_permission) (struct file *file, int mask);
        int (*file_alloc_security) (struct file *file);
        void (*file_free_security) (struct file *file);
        int (*file_ioctl) (struct file *file, unsigned int cmd,
                   unsigned long arg);
        int (*file_mmap) (struct file *file,\
                  unsigned long reqprot, unsigned long prot,\
                  unsigned long flags, unsigned long addr,\
                  unsigned long addr_only);
        int (*file_mprotect) (struct vm_area_struct *vma,\
                      unsigned long reqprot,\
                      unsigned long prot);
        int (*file_lock) (struct file *file, unsigned int cmd);
        int (*file_fcntl) (struct file *file, unsigned int cmd,\
                   unsigned long arg);
        int (*file_set_fowner) (struct file *file);
        int (*file_send_sigiotask) (struct task_struct *tsk,\
                        struct fown_struct *fown, int sig);
        int (*file_receive) (struct file *file);
        int (*dentry_open) (struct file *file, const struct cred *cred);
    
        int (*task_create) (unsigned long clone_flags);
        int (*cred_alloc_blank) (struct cred *cred, gfp_t gfp);
        void (*cred_free) (struct cred *cred);
        int (*cred_prepare)(struct cred *new, const struct cred *old,\
                    gfp_t gfp);
        void (*cred_commit)(struct cred *new, const struct cred *old);
        void (*cred_transfer)(struct cred *new, const struct cred *old);
        int (*kernel_act_as)(struct cred *new, u32 secid);
        int (*kernel_create_files_as)(struct cred *new, struct inode *inode);
        int (*kernel_module_request)(void);
        int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags);
        int (*task_fix_setuid) (struct cred *new, const struct cred *old,\
                    int flags);
        int (*task_setgid) (gid_t id0, gid_t id1, gid_t id2, int flags);
        int (*task_setpgid) (struct task_struct *p, pid_t pgid);
        int (*task_getpgid) (struct task_struct *p);
        int (*task_getsid) (struct task_struct *p);
        void (*task_getsecid) (struct task_struct *p, u32 *secid);
        int (*task_setgroups) (struct group_info *group_info);
        int (*task_setnice) (struct task_struct *p, int nice);
        int (*task_setioprio) (struct task_struct *p, int ioprio);
        int (*task_getioprio) (struct task_struct *p);
        int (*task_setrlimit) (unsigned int resource, struct rlimit *new_rlim);
        int (*task_setscheduler) (struct task_struct *p, int policy,\
                      struct sched_param *lp);
        int (*task_getscheduler) (struct task_struct *p);
        int (*task_movememory) (struct task_struct *p);
        int (*task_kill) (struct task_struct *p,\
                  struct siginfo *info, int sig, u32 secid);
        int (*task_wait) (struct task_struct *p);
        int (*task_prctl) (int option, unsigned long arg2,\
                   unsigned long arg3, unsigned long arg4,\
                   unsigned long arg5);
        void (*task_to_inode) (struct task_struct *p, struct inode *inode);
    
        int (*ipc_permission) (struct kern_ipc_perm *ipcp, short flag);
        void (*ipc_getsecid) (struct kern_ipc_perm *ipcp, u32 *secid);
    
        int (*msg_msg_alloc_security) (struct msg_msg *msg);
        void (*msg_msg_free_security) (struct msg_msg *msg);
    
        int (*msg_queue_alloc_security) (struct msg_queue *msq);
        void (*msg_queue_free_security) (struct msg_queue *msq);
        int (*msg_queue_associate) (struct msg_queue *msq, int msqflg);
        int (*msg_queue_msgctl) (struct msg_queue *msq, int cmd);
        int (*msg_queue_msgsnd) (struct msg_queue *msq,\
                     struct msg_msg *msg, int msqflg);
        int (*msg_queue_msgrcv) (struct msg_queue *msq,\
                     struct msg_msg *msg,\
                     struct task_struct *target,\
                     long type, int mode);
    
        int (*shm_alloc_security) (struct shmid_kernel *shp);
        void (*shm_free_security) (struct shmid_kernel *shp);
        int (*shm_associate) (struct shmid_kernel *shp, int shmflg);
        int (*shm_shmctl) (struct shmid_kernel *shp, int cmd);
        int (*shm_shmat) (struct shmid_kernel *shp,\
                  char __user *shmaddr, int shmflg);
    
        int (*sem_alloc_security) (struct sem_array *sma);
        void (*sem_free_security) (struct sem_array *sma);
        int (*sem_associate) (struct sem_array *sma, int semflg);
        int (*sem_semctl) (struct sem_array *sma, int cmd);
        int (*sem_semop) (struct sem_array *sma,\
                  struct sembuf *sops, unsigned nsops, int alter);
    
        int (*netlink_send) (struct sock *sk, struct sk_buff *skb);
        int (*netlink_recv) (struct sk_buff *skb, int cap);
    
        void (*d_instantiate) (struct dentry *dentry, struct inode *inode);
    
        int (*getprocattr) (struct task_struct *p, char *name, char **value);
        int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size);
        int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen);
        int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid);
        void (*release_secctx) (char *secdata, u32 seclen);
    
        int (*inode_notifysecctx)(struct inode *inode, void *ctx, u32 ctxlen);
        int (*inode_setsecctx)(struct dentry *dentry, void *ctx, u32 ctxlen);
        int (*inode_getsecctx)(struct inode *inode, void **ctx, u32 *ctxlen);
    
    #ifdef CONFIG_SECURITY_NETWORK
        int (*unix_stream_connect) (struct socket *sock,\
                        struct socket *other, struct sock *newsk);
        int (*unix_may_send) (struct socket *sock, struct socket *other);
    
        int (*socket_create) (int family, int type, int protocol, int kern);
        int (*socket_post_create) (struct socket *sock, int family,\
                       int type, int protocol, int kern);
        int (*socket_bind) (struct socket *sock,\
                    struct sockaddr *address, int addrlen);
        int (*socket_connect) (struct socket *sock,\
                       struct sockaddr *address, int addrlen);
        int (*socket_listen) (struct socket *sock, int backlog);
        int (*socket_accept) (struct socket *sock, struct socket *newsock);
        int (*socket_sendmsg) (struct socket *sock,\
                       struct msghdr *msg, int size);
        int (*socket_recvmsg) (struct socket *sock,
                       struct msghdr *msg, int size, int flags);
        int (*socket_getsockname) (struct socket *sock);
        int (*socket_getpeername) (struct socket *sock);
        int (*socket_getsockopt) (struct socket *sock, int level, int optname);
        int (*socket_setsockopt) (struct socket *sock, int level, int optname);
        int (*socket_shutdown) (struct socket *sock, int how);
        int (*socket_sock_rcv_skb) (struct sock *sk, struct sk_buff *skb);
        int (*socket_getpeersec_stream) (struct socket *sock, \
                                         char __user *optval, \
                                         int __user *optlen, unsigned len);
        int (*socket_getpeersec_dgram) (struct socket *sock, \
                                        struct sk_buff *skb, u32 *secid);
        int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority);
        void (*sk_free_security) (struct sock *sk);
        void (*sk_clone_security) (const struct sock *sk, struct sock *newsk);
        void (*sk_getsecid) (struct sock *sk, u32 *secid);
        void (*sock_graft) (struct sock *sk, struct socket *parent);
        int (*inet_conn_request) (struct sock *sk, struct sk_buff *skb,\
                      struct request_sock *req);
        void (*inet_csk_clone) (struct sock *newsk, const struct request_sock *req);
        void (*inet_conn_established) (struct sock *sk, struct sk_buff *skb);
        void (*req_classify_flow) (const struct request_sock *req, struct flowi *fl);
        int (*tun_dev_create)(void);
        void (*tun_dev_post_create)(struct sock *sk);
        int (*tun_dev_attach)(struct sock *sk);
    #endif    /* CONFIG_SECURITY_NETWORK */
    
    #ifdef CONFIG_SECURITY_NETWORK_XFRM
        int (*xfrm_policy_alloc_security) (struct xfrm_sec_ctx **ctxp,
                struct xfrm_user_sec_ctx *sec_ctx);
        int (*xfrm_policy_clone_security) (struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctx);
        void (*xfrm_policy_free_security) (struct xfrm_sec_ctx *ctx);
        int (*xfrm_policy_delete_security) (struct xfrm_sec_ctx *ctx);
        int (*xfrm_state_alloc_security) (struct xfrm_state *x,
            struct xfrm_user_sec_ctx *sec_ctx,
            u32 secid);
        void (*xfrm_state_free_security) (struct xfrm_state *x);
        int (*xfrm_state_delete_security) (struct xfrm_state *x);
        int (*xfrm_policy_lookup) (struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);
        int (*xfrm_state_pol_flow_match) (struct xfrm_state *x,\
                          struct xfrm_policy *xp,
                          struct flowi *fl);
        int (*xfrm_decode_session) (struct sk_buff *skb, u32 *secid, int ckall);
    #endif    /* CONFIG_SECURITY_NETWORK_XFRM */
    
        /* key management security hooks */
    #ifdef CONFIG_KEYS
        int (*key_alloc) (struct key *key, const struct cred *cred, unsigned long flags);
        void (*key_free) (struct key *key);
        int (*key_permission) (key_ref_t key_ref,\
                       const struct cred *cred,\
                       key_perm_t perm);
        int (*key_getsecurity)(struct key *key, char **_buffer);
        int (*key_session_to_parent)(const struct cred *cred,\
                         const struct cred *parent_cred,\
                         struct key *key);
    #endif    /* CONFIG_KEYS */
    
    #ifdef CONFIG_AUDIT
        int (*audit_rule_init) (u32 field, u32 op, char *rulestr, void **lsmrule);
        int (*audit_rule_known) (struct audit_krule *krule);
        int (*audit_rule_match) (u32 secid, u32 field, u32 op, void *lsmrule,\
                     struct audit_context *actx);
        void (*audit_rule_free) (void *lsmrule);
    #endif /* CONFIG_AUDIT */
    };
    
  • 拓展链接:

    • http://www.hep.by/gnu/kernel/lsm/framework.html
    • http://blog.sina.com.cn/s/blog_858820890101eb3c.html
    • http://mirror.linux.org.au/linux-mandocs/2.6.4-cset-20040312_2111/security_operations.html

5.2 kprobe结构体

  • 用于存储每个探测点的基本结构

    struct kprobe 
    {
        /*用于保存kprobe的全局hash表,以被探测的addr为key*/
        struct hlist_node hlist;
    
        /*当对同一个探测点存在多个探测函数时,所有的函数挂在这条链上*/
        struct list_head list;
    
        /*count the number of times this probe was temporarily disarmed */
        unsigned long nmissed;
    
        /*被探测的目标地址,要注意的是,只能是addr或是symbol_name其中一个填入了值,如果两个都填入,在注册这个探头的时候就会出现错误-21非法符号*/
        kprobe_opcode_t *addr;
    
        /*允许用户指定函数名,内核函数kallsyms_lookup_name("xx")会去获取具体的函数地址*/
        const char *symbol_name;
    
        /*
        如果被探测点为函数内部某个指令,需要使用addr + offset的方式
        从这点也可以看出,kprobe可以hook在内核中的任何位置
        */
        unsigned int offset;
    
        /*探测函数,在目标探测点执行之前调用*/
        kprobe_pre_handler_t pre_handler;
    
        /*探测函数,在目标探测点执行之后调用*/
        kprobe_post_handler_t post_handler;
    
        /*
        called if executing addr causes a fault (eg. page fault).
        Return 1 if it handled fault, otherwise kernel will see it.
        */
        kprobe_fault_handler_t fault_handler;
    
        /*
        called if breakpoint trap occurs in probe handler.
        Return 1 if it handled break, otherwise kernel will see it.
        */
        kprobe_break_handler_t break_handler;
    
        /*opcode 以及 ainsn 用于保存被替换的指令码*/ 
        /* Saved opcode (which has been replaced with breakpoint) */
        kprobe_opcode_t opcode;
    
        /* copy of the original instruction */
        struct arch_specific_insn ainsn;
    
        /*
        Indicates various status flags.
        Protected by kprobe_mutex after this kprobe is registered.
        */
        u32 flags;
    };
    

5.3 jprobe结构体

  • jprobe是对kprobes的一层功能上的封装,这点从数据结构上也能看出来

    struct jprobe 
    {  
        struct kprobe kp;  
    
        /*
        定义的probe程序,要注意的是
        1. 注册进去的探头程序应该和被注册的函数的参数列表一致
        2. 我们在设置函数指针的时候需要使用(kprobe_opcode_t *)进行强制转换
        */
        void *entry;  
    }
    

5.4 kretprobe结构体

  • kretprobe注册(register_kretprobe)的时候需要传递这个结构体
struct kretprobe 
{
    struct kprobe kp;

    //注册的回调函数,handler指定探测点的处理函数
    kretprobe_handler_t handler;

    //注册的预处理回调函数,类似于kprobes中的pre_handler()
    kretprobe_handler_t entry_handler;

    //maxactive指定可以同时运行的最大处理函数实例数,它应当被恰当设置,否则可能丢失探测点的某些运行
    int maxactive;
    int nmissed;

    //指示kretprobe需要为回调监控预留多少内存空间
    size_t data_size;
    struct hlist_head free_instances;
    raw_spinlock_t lock;
};

5.5 kretprobe_instance

  • 在kretprobe的注册处理函数(.handler)中我们可以拿到这个结构体
struct kretprobe_instance 
{
    struct hlist_node hlist;
    
    //指向相应的kretprobe_instance变量(就是我们在register_kretprobe时传入的参数) 
    struct kretprobe *rp;
    
    //返回地址
    kprobe_opcode_t *ret_addr;

    //指向相应的task_struct
    struct task_struct *task;
    char data[0];
};

5.6 kretprobe_blackpoint 、struct kprobe_blacklist_entry

struct kretprobe_blackpoint 
{
    const char *name;
    void *addr;
}; 

struct kprobe_blacklist_entry 
{
    struct list_head list;
    unsigned long start_addr;
    unsigned long end_addr;
};

5.7 linux_binprm

  • 在Linux内核中,每种二进制格式都表示为struct linux_binprm数据结构,Linux支持的二进制格式有:

    • flat_format: 平坦格式
      用于没有内存管理单元(MMU)的嵌入式CPU上,为节省空间,可执行文件中的数据还可以压缩(如果内核可提供zlib支持)
    1. script_format: 伪格式
      用于运行使用#!机制的脚本,检查文件的第一行,内核即知道使用何种解释器,启动适当的应用程序即可(例如: #! /usr/bin/perl 则启动perl)
    2. misc_format: 伪格式
      用于启动需要外部解释器的应用程序,与#!机制相比,解释器无须显示指定,而可以通过特定的文件标识符(后缀、文件头…),例如该格式用于执行java字节码或用wine运行windows程序
    3. elf_format:
      这是一种与计算机和体系结构无关的格式,可用于32/64位,它是linux的标准格式
    4. elf_fdpic_format: ELF格式变体
      提供了针对没有MMU系统的特别特性
    5. irix_format: ELF格式变体
      提供了特定于irix的特性
    6. som_format:
      在PA-Risc计算机上使用,特定于HP-UX的格式
    7. aout_format:
      a.out是引入ELF之前linux的标准格式
  • /source/include/linux/binfmts.h

/*
 * This structure is used to hold the arguments that are used when loading binaries.
 */
struct linux_binprm
{
    //保存可执行文件的头128字节
    char buf[BINPRM_BUF_SIZE];
#ifdef CONFIG_MMU
    struct vm_area_struct *vma;
    unsigned long vma_pages;
#else
# define MAX_ARG_PAGES    32
    struct page *page[MAX_ARG_PAGES];
#endif
    struct mm_struct *mm;

    unsigned long p; //当前内存页最高地址
    unsigned int
        cred_prepared:1,	/* true if creds already prepared (multiple
                 		 	 * preps happen for interpreters) */
        cap_effective:1;	/* true if has elevated effective capabilities,
                 			 * false if not; except for init which inherits
                 			 * its parent's caps anyway */
#ifdef __alpha__
    unsigned int taso:1;
#endif
    unsigned int recursion_depth;
    struct file * file;		//要执行的文件
    struct cred *cred;  	//new credentials    
    int unsafe;        /* how unsafe this exec is (mask of LSM_UNSAFE_*) */
    unsigned int per_clear;    /* bits to clear in current->personality */    
    int argc, envc;	//命令行参数和环境变量数目

    char * filename;	//要执行的二进制文件的名称
    char * interp;      //要执行的文件的真实名称,通常和filename相同   
    unsigned interp_flags;
    unsigned interp_data;
    unsigned long loader, exec;
};

5.8 linux_binfmt

  • /source/include/linux/binfmts.h
/*
 * This structure defines the functions that are used to load the binary formats that
 * linux accepts.
*/
struct linux_binfmt 
{
    //链表结构
    struct list_head lh;
    struct module *module;
    //装入二进制代码
    int (*load_binary)(struct linux_binprm *, struct  pt_regs * regs);

    //装入公用库
    int (*load_shlib)(struct file *);

    int (*core_dump)(long signr, struct pt_regs *regs, \
                     struct file *file, unsigned long limit);
    unsigned long min_coredump;    /* minimal dump size */
    int hasvdso;
};
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Linux中与“内核安全”相关的数据结构 的相关文章

  • Django教务管理系统|学生选课系统(关注下载源码)

    关注即可下载源码 写在前面 采用Django框架以及MySQL数据库实现BS架构的教务管理系统 xff0c 网页界面模仿了正方软件股份有线公司开发的教务管理系统 题目 建立一个学生选课系统 编写应用程序完成系统开发 建立基本表 xff1a
  • c/c++|解线性方程组的迭代法(高斯-赛德尔迭代法)

    span class token macro property span class token directive keyword include span span class token string lt bits stdc 43
  • C++ 字符(char)转字符串(string)

    char转string 误区 无法使用to string 方法 span class token keyword char span c span class token operator 61 span span class token
  • B树和B+树

    B树 上图是一颗完整的5阶B树 xff0c 符合以下特点 xff1a 对于一个m阶B树 xff0c 每个节点最多有m个分支 xff1b 根节点且不是叶子节点则至少有2个分支 xff0c 而非根非叶节点至少有m 2 xff08 上取整 xff
  • R-Tree

    R Tree R Tree是一颗用来存储高维数据的平衡树 xff0c 它把B树的思想扩展到了多维空间 xff0c 采用了B树分割空间思想 xff0c 并在添加 删除操作时采用合并 分解节点的方法 xff0c 保证树的平衡性 数据结构 每个R
  • 【AI炼丹术】写深度学习代码的一些心得体会

    写深度学习代码的一些心得体会 体会1体会2体会3总结内容来源 一般情况下 xff0c 拿到一批数据之后 xff0c 首先会根据任务先用领域内经典的Model作为baseline跑通 xff0c 然后再在这个框架内加入自己设计的Model x
  • win10配置MMClassification+PyTorch+CUDA

    Win10配置MMClassification 依赖 Python 3 8CUDA 10 2Microsoft Visual C 43 43 14 0PyTorch 1 10 0MMCV 1 3 17MMClassification 0 1
  • 逢七过

    试题描述 相信大家都玩过这个游戏 xff0c 一群人围坐一圈 xff0c 开始喊数 xff0c 是7的倍数或者数中含有7的均要说 过 xff0c 其余的数就直接说出数的大小 为了简化问题 xff0c 我们规定 xff0c 对于下面的情况我们
  • 斐波那契数列

    试题描述 斐波那契数列指的是这样一个数列 xff1a 1 1 2 3 5 8 13 21 34 这个数列从第三项开始 xff0c 每一项都等于前两项之和 请你输出斐波那契数列的前N项 xff08 0 lt N lt 30 xff09 请用循
  • 允许并列的排名

    试题描述 在我们参加的各种竞赛中 xff0c 允许并列的排名方式是经常遇到的 例如有四名选手的成绩分别为50 80 50 30分 xff0c 则80分的选手为第一名 xff0c 50分的两名选手均为第二名 xff0c 30分的选手为第三名
  • n位水仙花数

    试题描述 n位水仙花数是指一个n位数 xff0c 它的每个位上的数字的n次幂之和等于它本身 例如 xff1a 三位水仙花数是指一个三位数 xff0c 它的每个位上的数字的3次幂之和等于它本身 xff08 例如 xff1a 13 43 53
  • 成绩的最高分问题

    试题描述 编写函数ReadScore 和FindMax xff0c 输入某班学生某门课的成绩和学号 xff08 最多不超过40人 xff09 xff0c 当输入为负值时 xff0c 表示输入结束 xff0c 用函数编程通过返回数组中最大元素
  • xcode编译静态库时:**** is not an object file (not allowed in a library)

    出现此错误 xff1a 第一步 xff1a 链接的库是否是存在的且正确的库 a 第二步 xff1a 如果还出现错误 xff0c 那么确定Xcode搜索库路径 Library search paths xff0c 是否有错误 如果在工程目录中
  • Ubuntu桥接模式下无法连接网络的问题

    新装的VMware虚拟机 xff0c 作为开发 xff0c 需要使用桥接模式 xff0c 但是一直无法正常连接网络 xff0c ifconfig一直没有IPV4地址显示 xff0c ping外网也不通 网上的方法也几乎试了个遍 xff0c
  • 黑马程序员————数组,字符串,函数,指针

    Java培训 Android培训 iOS培训 Net培训 期待与您交流 xff01 一 数组的基本概念 只能存放一种类型的数据 xff0c 比如int类型的数组 float类型的数组 里面存放的数据称为 元素 二数组的定义 1 定义 声明数
  • QT控件提升之QPushButton提升为QMenu

    当一个控件进行提升之后 xff0c 就有了新的功能 xff0c 在原来的一些特性基础上 xff0c 发生一些新的改变 QT控件提升方法 xff1a 1 需要写一个需要提升为某种功能的类 2 打开qt设计师 xff0c 在对应需要提升的控件
  • 【Hugging Face】Hugging Face 主要类和函数介绍

    Hugging Face 主要类和函数介绍 Hugging face是什么 xff1f 什么是自然语言处理 xff1f PipelineDatasetPipeline on GPUMetricsAutoClasses在本地保存和加载模型结论
  • 基于ubuntu server 16.04环境安装kvm虚拟机并创建windows系统

    由于项目需要 xff0c 最近在研究 kvm 虚拟机 xff0c 将这个过程中遇到的一些问题做一些记录 由于本人水平有限 xff0c 其中不妥之处还请网友们不吝赐教 1 操作环境 ubuntu server 16 04 默认的安装后没有桌面
  • Linux炫酷代码秀

    cmatrix 命令 这个很酷 xff01 黑客帝国 那种矩阵风格的动画效果 安装 sudo apt get install cmatrix 运行 cmatrix
  • keil中include 头文件循环引用问题

    在头文件中使用 ifdef和 xff03 ifndef是非常重要的 xff0c 可以防止双重定义的错误 有时候 xff0c 在b h中会include 34 a h 34 xff0c 在 34 c h 34 中会include 34 b h

随机推荐

  • 并查集(加入、查找、删除)

    并查集 来源洛谷 题目描述 如题 xff0c 现在有一个并查集 xff0c 你需要完成合并和查询操作 输入格式 第一行包含两个整数 N M 表示共有 N 个元素和 M 个操作 接下来 M 行 xff0c 每行包含三个整数Z i X i Y
  • Centos7查看防火墙以及端口开放情况

    1 查看防火墙状态 firewall cmd state 2 开关防火墙 systemctl start firewalld service systemctl stop firewalld service systemctl restar
  • 完美解决“当前不会命中断点,还未为文档加载任何符号”的问题

    遇到这个问题是我正在用vc2008 调试一个 C 43 43 写的 Dll xff0c dll 在编译中没有报错 xff0c 但在用VB net写的程序调用此 Dll 时 xff0c 才会报告 于 34 xxx dll 中找不到 XXX 函
  • switch 以string为条件 做判断的方法

    c 43 43 和java语言中的switch都是只接受 整型 c 语言中可以在switch中 xff0c 以字符串作为case的条件 我觉得宏定义不行 xff0c 用map尝试一下 xff0c 下面是给你一个例子 map lt strin
  • nginx那点事儿——nginx日志详解

    nginx日志 前言一 日志配置 格式二 日志格式包含的变量三 日志缓存1 缓存设置2 作用位置 四 日志切割1 切割配置文件2 日志切割原理 五 日志分析 前言 Nginx有非常灵活的日志记录模式 每个级别的配置可以有各自独立的访问日志
  • 最全详解关键路径法

    关键路径法是软考的知识点 我分析了常见的模棱两可的知识点 并进行了图解说明 现在分享给正在准备参加软考试的广大考友 01什么是关键路径法CPM 关键路径法用于在进度模型中估算项目最短工期 确定逻辑网络路径的进度灵活性大小 这种进度网络分析技
  • 【LLM】LLaMA简介:一个650亿参数的基础大型语言模型

    LLaMA简介 xff1a 一个650亿参数的基础大型语言模型 PaperSetup其他资料 作为 Meta 对开放科学承诺的一部分 xff0c 今天我们将公开发布 LLaMA 大型语言模型 Meta AI xff0c 这是一个最先进的大型
  • Cache-主存效率问题

    本文主要明确在软考中经常遇到的缓存效率问题 第零 xff0c 明确一个问题 xff1a 如果Cache不命中时 xff0c 不同的系统有不同的应对策略 一是直接从主存中拿走待取数据 xff0c 它的时间消耗仅仅是一个访问主存周期 二是把待取
  • filezilla 严重文件传输错误 550permission denied

    问题描述 xff1a FileZilla工具使用ftp账户 xff0c 密码 xff0c 端口21 xff0c 快速链接到自己搭建的外网ftp服务器 xff0c 提示登录成功 xff0c 选择本地文件 xff0c 右键文件上传 xff0c
  • ubuntu与windows互传文件的3种方法

    一般在进行编程作业的时候 xff0c 我们会采用 开发在Windows中编辑源代码 xff0c 在linux中编译 执行源代码 这往往需要需要将在Windows下编辑好的源代码上传到linux系统种进行编译 怎么来进行上传呢 xff1f 其
  • ubuntu下如何设置环境变量

    一 设置环境变量的三种方法 1 1 临时设置 export PATH 61 home yan share usr local arm 3 4 1 bin PATH 1 2 当前用户的全局设置 打开 bashrc xff0c 添加行 xff1
  • ssh免密登录设置方法

    1 前提条件 主机A xff0c 用户名为aris xff0c IP地址为192 168 1 1主机B xff0c 用户名为leon xff0c IP地址为192 168 1 2这两台主机上均安装了SSH服务器 xff0c 且已经打开ssh
  • 软考高项你想要的全在这

    2021年准备参加软考获取高级职业技术资格认证的小伙伴咱们约起吧 xff1f xff01 自软考系列文章发表之后有很多准备参加软考的小伙伴加我微信 xff0c 关注我的微博 xff0c 也有很多因此成了好朋友 xff0c 甚至是同事 自前年
  • Makefile语法及通用模板

    简介 xff1a 本文主要讲解了在开发常规项目时 xff0c 用于自动化部署生成目标文件的Makefile 对其包含的主要语法进行了讲解 xff0c 最后给出了一个项目通用的Makefile模板 xff0c 以帮助大家理解 1 Makefi
  • ubuntu镜像源的配置

    摘要 xff1a 你是否遇到过按照网上教程更改了自己的镜像源之后 xff0c 貌似还是不兼容 xff0c 许多安装包还是下不了 xff1f 其实不是他们写的教程有错误 xff0c 而是你没用根据自己使用的ubuntu的版本去正确配置镜像源
  • Linux中与“内核模块”相关的数据结构

    摘要 本文详细解释了linux中与模块相关的内核数据结构 xff0c 便于大家在学习理解内核源码或驱动编程中理解相应代码和思想 三 内核模块相关的数据结构 目录 THIS MODULE宏module结构体module use 3 1 THI
  • Linux内核中与“文件系统”相关的数据结构

    文件系统相关的数据结构 4 1 file结构体 文件结构体代表一个打开的文件 xff0c 系统中的每个打开的文件在内核空间都有一个关联的struct file 它由内核在打开文件时创建 xff0c 并传递给在文件上进行操作的任何函数 在文件
  • 【可解释AI】图神经网络的可解释性方法及GNNexplainer代码示例

    图神经网络的可解释性方法及GNNexplainer代码示例 GNNExplainerIntroductionModelSingle instance explanations xff08 Explanation via Structural
  • 文本编辑器VI命令详解

    目录 一 xff1a 文本编辑器概述 1 文本编辑器含义 2 文本编辑器的作用 3 Linux中最常见的文本编辑器 二 vi编辑器的工作模式 1 vi编辑器的工作模式 2 各模式之间的切换 三 xff1a 命令模式概述 1 命令模式常用操作
  • Linux中与“内核安全”相关的数据结构

    五 内核安全相关数据结构 5 1 security operations结构体 这是一个钩子函数的指针数组 xff0c 其中每一个数组元素都是一个SELINUX安全钩子函数 xff0c 在2 6以上的内核中 xff0c 大部分涉及安全控制的