Dispatching network connections in user-mode

A listener operating in user-mode can dispatch control of a client connection to a listener without exposing system memory or other sensitive services or components. For example, a client component requests access to a network component through connection with a user-mode listener. Based on information contained in the client request, the listener passes a call to an application program interface, which returns a first set of data that includes user-mode contextual information. The listener passes this first set of data to the requested network component. Another call is made to an application program interface, which includes the first set of data, and a request for socket duplication. The application program interface returns control of the requested socket to the network component, such that the network component and the client component communicate directly through the requested socket in user-mode.

BACKGROUND OF THE INVENTION

1. The Field of the Invention

This invention relates to systems, methods, and computer program products for providing network listeners the ability to hand off control of network connections to a requested process in user-mode.

2. Background and Relevant Art

As an increasing number of people and institutions are implementing computerized systems, whether in a work, home, or in an entertainment environment, the needs for sharing computing resources has also increased. One type of sharing environment is a distributed file system, which is generally a client/server-based application that allows clients to access and process data stored on a central server over a network, as if the server were the client's own computer. For example, several workers of a company may be allowed to electronically access certain files at a remotely located network drive from multiple personal computers. In another example, a computing system at one location might need to use the processing resources of another computer at another location to aid with a specific job.

Of course, just as sharing various files and processes over a network can provide a number of obvious advantages, the problems and disadvantages of networking are also well known. These problems range from benign architectural problems to those of intended malice. An example of a benign architectural problem is the fact that network computers have a limited number of ports, which in turn are usually only allowed to provide client components with access to a limited number of network components, such as network processes, modules, and the like. This can create a problem when a large number of client components need access to several network components through the same port.

On the other hand, well-known examples of malicious network problems include computer viruses, and network intruders. Viruses are computer-executable instructions typically passed electronically from one unwitting recipient to the next that, when executed, alter or erase important systems files, steal personal information, or the like. Similarly, network intruders can be a problem with networks that are open to outside connections, such as an otherwise closed work network that has a connection to the Internet. For example, a malicious person might find a way to gain electronic access to a company's network server beyond what was otherwise intended, and gain access to valuable company or employee documents found inside the network.

Accordingly, operating system security for computerized systems is increasingly important for computers on a network. Presently, there are myriad ways and processes computerized systems use to enforce security. These can generally be classified into the type of permissions in which a process or component runs, such as running in a user-mode (more limited, less control) level of control, or running in a kernel-mode (less limited, greater control) level of control. Generally, for example, if a client component and a requested network process at a network computer are communicating information in user-mode, the client component has only limited (if any) access to the network process, and only limited (if any) access to the network computer's system memory or services.

If the client component, however, connects to the network computer component through a kernel-mode driver running on the network computer, the client has much more flexibility. In particular, the client process may, in some cases, have unlimited access to the system memory, and/or to other services, processes or components at the network computer. In particular, a kernel-mode driver listening on a network has little or no control over who will send it messages. If the kernel-mode driver is “duped” by the sender of messages, there is little or no limit to the damage the sender of messages can do. By contrast, processes running in user-mode can be limited by operating system security.

As such, user-mode and kernel-mode levels of running components can provide a number of respective advantages and disadvantages, and so are typically implemented in specific types of situations. For example, a user-mode listener, such as a component implementing HTTP requests over a TCP protocol on a network stack, operates by relaying client process data to a requested network process through any number of communication mechanisms, such as through a shared memory space, a named pipe, Remote Procedure Protocol (“RPC”), Distributed Component Object Model (“DCOM”), or the like. The requested process then takes the relayed client process data through the relevant communication mechanism, and likewise responds to the client process only through the relevant communication mechanism. As such, the client process and the requested network computer process never communicate directly.

In particular, since the listener operating in user-mode has only limited access to system memory, and has only limited access to other system processes or components, a malicious client process is significantly hindered from causing damage to the network computer, or accessing sensitive information. On the other hand, since the user-mode listener acts as an intermediary relay mechanism using a shared memory, named pipe, or the like, the user-mode listener can become a significant bottleneck in network communication speeds, particularly with large numbers of outside client connections, or large data transfers.

By contrast, a kernel-mode listener, such as a network driver operating in kernel-mode, writes the connection data from the client process directly to system memory, and may even dispatch control of the entire connection to the requested network process, if appropriate. In either case, the kernel-mode listener allows the network process to communicate with the client process using mechanisms that are much faster than using a shared memory space, named pipe, or the like, as with a user-mode listener. Unfortunately, because a kernel-mode listener has fairly unfettered access to the network computer system and memory, a malicious person or program could overrun the network computer memory and gain access to sensitive system files or other network processes on the network computer. Thus, a kernel-mode listener is typically avoided in many situations where the speed associated therewith could be helpful.

Accordingly, an advantage in the art can be realized with systems, methods, and computer program products that allow a user-mode listener to facilitate communication between a client process and a requested network process without incurring the typical speed or bottleneck issues associated therewith. Furthermore, an advantage can be realized with such systems that facilitate communication between a client process and a requested network computer when appropriate, without at the same time exposing system memory or other sensitive system processes at the network computer.

BRIEF SUMMARY OF THE INVENTION

The present invention solves one or more of the foregoing problems in the art with systems, methods, and computer program products that allow a user-mode listener to effectively dispatch control of a client connection to a network computer component in a safe manner. In particular, a user-mode listener, in accordance with the present invention, can dispatch control of a client connection to a requested network component without exposing the system memory and/or system services of the network computer.

For example, in at least one implementation of the present invention, a listener, such as a network connection process operating in user-mode at a network computer, receives a request from a client component for communicative access to a network component. If appropriate, the user-mode listener then passes a request for socket duplication to a first application service, such as an application program interface (“API”), or other component, or module, which returns a first set of data that includes user-mode contextual information. The user-mode listener then passes the first set of data sent by the first application service to the requested network component using conventional relay mechanisms, such as a shared memory, named pipe, or the like.

If appropriate, the requested network component then calls an application service, such as the first or a second application service, to duplicate the socket controlled by the user-mode listener, and passes the first set of data as a parameter. The called application service then provides the network component with a response that has parameters of control over a specified socket, and parameters of the first set of data. With control over the specified socket, the requested network component is able to communicate directly with the client computer component through the socket for the remainder of the client connection. Thus, the user-mode listener in accordance with the present invention can dispatch control of the client connection to the network computer component without exposing the system memory or other sensitive system services, components or processes. This allows the client component and the network computer component to communicate in speeds similar to that of operating in kernel-mode with the security typically associated with user-mode.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

The present invention extends to systems, methods, and computer program products that allow a user-mode listener to effectively dispatch control of a client connection to a network computer component in a safe manner. In particular, a user-mode listener, in accordance with the present invention, can dispatch control of a client connection to a requested network component without exposing the system memory and/or system services of the network computer.

Thus, as will be understood from the present specification and claims, one aspect of the invention comprises dispatching control of a connection with a client component (e.g., a process, interface, or module, etc.) to a requested network component (e.g., a process, interface, or module, etc.). Furthermore, although it will be understood that the connection described herein can be between client components at a client computer system and network component at a different network computer system, the principles of the invention described herein can also be applied in the context of inter-component connections at the same local computer. That is, there are situations in which client and network components of the same computer system communicate data to one another through an intermediary process, such as a listener.

In any event, when the client component establishes a connection, the user-mode listener that interfaces with the network stack can implement dispatch logic to ascertain whether to dispatch control of the client connection to the network component. Although not necessarily required, another aspect of the invention can include the requested network component implementing a similar calculus to ascertain whether it should accept control of the client connection from the user-mode listener. When network component control is appropriate in each situation, the network component can accept control of the connection, and speak directly with the client component through the network stack. Accordingly, a client component and network component can communicate at speeds that are similar to those of communicating in kernel-mode, without necessarily risking one or more of the disadvantages thereof.

For example,FIG. 1Aillustrates a schematic overview for practicing the invention between two computers, in which a user-mode listener100controls a connection between a client component105from a client computer140and a network component110at the network computer150. In one implementation, the user-mode listener100is a network connection process operating in user-mode, although the user-mode listener100will be understood generally as any interface, component, or module that interfaces with a network stack115, and initially controls a user-mode network connection between a client component and a network component. Thus,FIG. 1Ashows that the client component105has established a connection with the network computer150through the network stack115. Furthermore,FIG. 1Ashows that the listener100controls this connection between the client component105and the network component110through a socket130.

Initially, when the client component105and listener100establish the connection, the listener100reads at least a portion of one or more of the initial data packets sent in by the client component105. In one implementation, the user-mode listener100does so to identify such factors as the requested network component (e.g.,110), and/or some indication as to the length of the requested connection, when or if appropriate. The listener100can also implement “dispatch logic” when reading the initial one or more data packets from the client component105to determine, based on one or more of a client message property or a system property, whether an efficiency gain can be made by transferring control of the connection.

For example, a client message property can include whether all or most of the data packets sent by the client component105are intended for the same requested network component110, or whether the length of the connection session or size of the messages to be sent are such that dispatch of control is appropriate, and so forth. By contrast, a system property can include consideration of load balancing or security policy concerns, which could be better implemented by dispatching the connection to the requested network component. Accordingly, the dispatch logic can evaluate a number of client or other system factors to indicate to the listener100that it is cost-effective to hand off control of the connection.

If the dispatch logic indicates to the listener100that it is cost-effective from a resource standpoint to transfer control of the established client connection, the listener100can then initiate transfer of control of the established connection. To do so, the listener100sends a function call to an application service120, such as an application program interface (“API”), or other component or module, that administers socket control. In one implementation, the listener100also passes, as parameters of the function call, the network component110requested by the client component105, as well as a request for socket duplication. The application service120then responds with a first set of data (i.e., “Data1”) that is specific for the established connection between the client component105and the network component110. In one implementation, this first set of data includes such data as one or more state variables of the network stack115for the established connection, as well as user-mode context information for the connection, and any data sent by the client component105when establishing the connection.

Upon receiving the first set of data (i.e., “Data1”),FIG. 1Ashows that the listener100forwards the first set of data and contextual information to the requested network component110using the communication mechanism for the user-mode connection. For example, the existing connection path may involve use of a shared memory space, a named pipe, RPC, DCOM, or the like. With respect to a shared memory space, this typically involves the listener100placing the first set of data and contextual information into a previously allocated shared memory. In such a situation, the listener100may also send a separate signal (not shown) to the network component110that indicates that there is a first set of data in the shared memory for the network component110to extract.

Once the network component110receives the first set of data and contextual information, the network component110can initiate steps to accept control of the connection. In one implementation, this involves the network component110also performing an additional evaluation similar to the “dispatch logic” used by the listener100. For example, the network component110may try to identify whether the client component105is a trusted client, or whether the type of data the client component105intends to pass is appropriate to be passed to the network component110directly. In any event, if the network component110decides to accept control of the connection, the network component110initiates steps to duplicate the socket130. To do so, the network component100passes a function call to an application service, with parameters of the first data set, as well as a request to duplicate the socket130controlled by the listener100.

As shown inFIG. 1A, the network component requests duplication of the socket130by calling application service125, which is a different, second application service, component or module distinct from application service120. One will appreciate, however, that using the same application service may be appropriate in some circumstances, while using two different application services by the network component110and listener100may be appropriate in other circumstances. In any event,FIG. 1Athose that application service125evaluates the function call and the included data passed from the network component110. The application service125then returns data to the network component110that allows the network component110to control the socket130. For example, the application service may return the name or address of the socket130, an initial packet or so of data received from the client component before the connection is dispatched, as well as any other network stack state variables that should be relayed back to the listener100and to the network stack115. The application service125may also return user-mode context information, as appropriate.

The network process110then uses the returned data from the application service125to take control of the socket130, and therefore control of the established connection. In at least one implementation, this step for taking control of the connection can involve additional acts performed by the network process110and listener100. For example, in one implementation, the network process110sends an indicator to the listener100that the network process110has taken control of the socket130. In response to this indicator, the listener100sends another indicator to, for example, the transport layer117of the network stack, indicating that the listener100is unable to receive any more client process105data. In another implementation, the listener100also sends a signal to the network stack115, which tells the relevant layers to buffer incoming client process105data momentarily until the network process110has established control of the socket130in some way.

Once all relevant components understand that the requested network component110has accepted control of the established socket130, the network component110will be understood as having accepted control of the established connection. In particular,FIG. 1Bshows the schematic diagram ofFIG. 1Ain which the network component110has gained control of the socket130. In this Figure, the listener100no longer acts as a relay intermediary between the client component105and the network component110, such that the network component110and client component105communicate directly through the network stack115.

As previously described, this direct communication is typically much faster than having to communicate with the aid of the listener100in user-mode through a shared memory, named pipe, or the like. Furthermore, one or more additional advantages, such as may relate to security issues, can be realized since the switch of socket130control can be made transparent to the client component105, such that the client component105is unaware that there has been a switch in control of the socket from the listener100to the requested network component110. That is, the client component105may not have been aware initially that its connection was being handled by the listener100at all. Even if the client component105was aware it was speaking to the listener100, implementations of the present invention would not require a signal to be sent to the client component105that the network component110is now in control of the socket130.

The present invention can also be described in terms of specific, non-functional acts for accomplishing functional results, as part of one or more methods in accordance with implementations of the present invention. In particular,FIG. 2illustrates two methods in an interrelated flow chart, where one side illustrates acts performed from the perspective of the user-mode listener100, while another side of the flow chart illustrates acts performed from the perspective of the requested network component110. The acts ofFIG. 2will be described below in terms of the schematic diagrams shown inFIGS. 1A and 1B.

For example,FIG. 2shows that a method in accordance with the present invention of dispatching control of a connection to a network component in user-mode from the listener100side comprises an act200of establishing a connection. Act200includes establishing a connection in user-mode between a client component and a listener through a socket in user-mode. For example, a client component105, such as a process at the same or different remote computer, initiates a connection with listener100, and requests a specific network component110, such as another process at the same or different remote network computer, as part of the connection parameters. Since the connection is in user-mode, a listener100that interfaces with the network stack115will control the connection through a socket, such as through socket130shown inFIG. 1A.

In some cases, the listener100will also relay an initial part of the connection data to the network component110before or while the listener100begins to dispatch the connection. Accordingly, a method from the network component110side can comprise an act250of receiving data from a client component. Act250includes receiving an initial set of data from a client component105through the user-mode listener100. For example, the network component110may receive one or more data packets through a shared memory, named pipe, RPC, DCOM, or the like as the listener100decides what to do with the established connection.

Referring again to the listener100perspective, the method of dispatching a connection also comprises an act210of requesting duplication of the socket. Act210includes requesting duplication of the socket based on information associated with the connection, wherein a first set of data is received. For example, after reading an initial set of data in the connection initiated by the client component105, the listener100can implement dispatch logic. As described herein, the dispatch logic can include functions that evaluate such factors data for the state variables of the network stack115, the amount of data to be transferred in the established connection, the length of the connection, whether the client is a trusted client, and so forth.

If the dispatch logic analysis suggests handing control to the network component110, the listener100can, in some cases, perform any number of additional steps. For example, the listener100can send a function call to an application service120as previously described. In one implementation, the parameters of the function call include the network component requested by the client, some initial amount of data sent by the client component105, a request for socket duplication, and/or any combination of the foregoing. The application service120could then return a first set of data (e.g., “Data1”) that includes user-mode context information as part of its parameters. As shown in act230, the listener100then passes any relevant data such as this on to the network component110.

Accordingly, the method ofFIG. 2from the network component110perspective comprises an act260of receiving connection information from the listener. Act260includes receiving connection information from the user-mode listener, wherein the connection information identifies information about the client component and the established connection. For example, the network component110can receive a first set of data (i.e., “Data1”), which is relayed through a relay communication mechanism such as a shared memory, named pipe. In some cases, this first set of data may also include other data in the established client connection that has not yet been received from the client component105, as well as any data that the network component110can use to identify whether accepting control of the socket130is appropriate. For example, the listener100may decide it is appropriate to hand off control of the socket130to the network component110, but the network component110may implement its own similar dispatch logic to decide that the network component110is not suited to handle control of the connection. For example, the network component110may determine that the client component105is not trusted. Alternatively, the network component110may be configured simply to accept all dispatched connections from the listener100.

Nevertheless, if the network component110has determined that it is able to accept control of the socket130,FIG. 2shows that the network component110performs an act270of requesting duplication of the socket. Act270includes requesting duplication of the socket associated with the connection. For example, the network component110passes a function call to an application service, whether the same application service120as before, or a different application service, such as application service125. The parameters of the function call include the first set of data (e.g., “Data1”) passed previously to the listener100. The relevant application service, such as application service125, then processes the function call and returns socket information to the network component110. The socket information may also include one or more state variables of the network stack115that are associated with the established connection. In any event, the returned information allows the network component110to take control of the socket130.

Accordingly, the method from the network component perspective also comprises an act280of accepting control of the socket. Act280includes accepting control of the socket from the listener, wherein the network component communicates directly with the client component through the connection in user-mode. For example, in one implementation, the network component110sends a signal to the listener100indicating that the network component110has accepted control of the socket (e.g.,FIG. 1B). In other implementations, however, the network component110may communicate directly with the network stack115, and tell the network stack115to stop sending information through the listener100.

Nevertheless, the method ofFIG. 2from the listener100perspective shows that a method for dispatching control can comprise an act240of receiving an indicator that the network component has accepted control. Act280includes receiving an indicator that the network component has accepted control of the socket, such that the listener no longer accepts connection data from the client computer for the connection, and such that the network component and the client component communicate through the connection without the listener. For example, since the listener passed control of the socket130in user-mode, the network component110is also effectively connected to the client component105in user-mode. That is, the client component105and the network component110are directly connected through the network protocol stack115, albeit in a mode that is limited in terms of memory usage, or other limited permissions, and thus avoids exploitation of the network computer.

Accordingly, implementations of the present invention provide a number of advantages in the art. In particular, relatively secure, or more limited, connections can be made between network and client components between different computers or at the same computer with much faster speeds where necessary, even approaching kernel-mode connection speeds or better. Furthermore, implementations of the present invention allow the listener to pass off connections to network components primarily when those connections might pose a bottleneck to the system. As such, the listener can still continue to handle a large amount of connections in user-mode that do not stand to significantly gain with dispatching the connection, and do dispatches in a much more efficient manner.

With reference toFIG. 3, an exemplary system for implementing the invention includes a general-purpose computing device in the form of a conventional computer320, including a processing unit321, a system memory322, and a system bus323that couples various system components including the system memory322to the processing unit321. The system bus323may be any of several types of bus structures including a memory bus or memory controller, a peripheral bus, and a local bus using any of a variety of bus architectures. The system memory includes read only memory (ROM)324and random access memory (RAM)325. A basic input/output system (BIOS)326, containing the basic routines that help transfer information between elements within the computer320, such as during start-up, may be stored in ROM324.

The computer320may also include a magnetic hard disk drive327for reading from and writing to a magnetic hard disk339, a magnetic disc drive328for reading from or writing to a removable magnetic disk329, and an optical disc drive330for reading from or writing to removable optical disc331such as a CD ROM or other optical media. The magnetic hard disk drive327, magnetic disk drive328, and optical disc drive330are connected to the system bus323by a hard disk drive interface332, a magnetic disk drive-interface333, and an optical drive interface334, respectively. The drives and their associated computer-readable media provide nonvolatile storage of computer-executable instructions, data structures, program modules and other data for the computer320. Although the exemplary environment described herein employs a magnetic hard disk339, a removable magnetic disk329and a removable optical disc331, other types of computer readable media for storing data can be used, including magnetic cassettes, flash memory cards, digital versatile disks, Bernoulli cartridges, RAMs, ROMs, and the like.

Program code means comprising one or more program modules may be stored on the hard disk339, magnetic disk329, optical disc331, ROM324or RAM325, including an operating system335, one or more application programs336, other program modules337, and program data338. A user may enter commands and information into the computer320through keyboard340, pointing device342, or other input devices (not shown), such as a microphone, joy stick, game pad, satellite dish, scanner, or the like. These and other input devices are often connected to the processing unit321through a serial port interface346coupled to system bus323. Alternatively, the input devices may be connected by other interfaces, such as a parallel port, a game port or a universal serial bus (USB). A monitor347or another display device is also connected to system bus323via an interface, such as video adapter348. In addition to the monitor, personal computers typically include other peripheral output devices (not shown), such as speakers and printers.

The computer320may operate in a networked environment using logical connections to one or more remote computers, such as remote computers349aand349b. Remote computers349aand349bmay each be another personal computer, a server, a router, a network PC, a peer device or other common network node, and typically include many or all of the elements described above relative to the computer320, although only memory storage devices350aand350band their associated application programs336aand336bhave been illustrated inFIG. 3. The logical connections depicted inFIG. 3include a local area network (LAN)351and a wide area network (WAN)352that are presented here by way of example and not limitation. Such networking environments are commonplace in office-wide or enterprise-wide computer networks, intranets and the Internet.

When used in a LAN networking environment, the computer320is connected to the local network351through a network interface or adapter353. When used in a WAN networking environment, the computer320may include a modem354, a wireless link, or other means for establishing communications over the wide area network352, such as the Internet. The modem354, which may be internal or external, is connected to the system bus323via the serial port interface346. In a networked environment, program modules depicted relative to the computer320, or portions thereof, may be stored in the remote memory storage device. It will be appreciated that the network connections shown are exemplary and other means of establishing communications over wide area network352may be used.