# US 2017/0286066 A1 · Dynamic Addition of Code in Shared Libraries

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2017/0286066 A1
- Document ID: US20170286066A1
- Status: Published application
- Kind: A1
- Application number: 15/085,415
- Filed: 2016-03-30
- Published: 2017-10-05
- Earliest claimed: 2016-03-30
- Assignees: QUALCOMM Incorporated
- Applicants: QUALCOMM Incorporated
- Inventors: Sudha Anil Kumar GATHALA; Mihai CHRISTODORESCU; Mastooreh SALAJEGHEH
- Web page: https://patentgrep.com/patent/US20170286066A1

## CPC

- G06F 8/30: Creation or generation of source code
- G06F 8/54: Link editing before load time
- G06F 9/44521: {Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading}
- G06F 9/44557: {Code layout in executable memory}
- G06F 11/3624: {by performing operations on the source code, e.g. via a compiler}
- G06F 11/3644: {by instrumenting at runtime}
- G06F 11/3466: {Performance evaluation by tracing or monitoring}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Various embodiments include methods for dynamically modifying shared libraries on a client computing device. Various embodiment methods may include receiving a first set of code segments and a first set of code sites associated with a first application. Each code in the first set of code sites may include an address within a compiled shared library stored on the client computing device. The compiled shared library may include one or more dummy instructions inserted at each code site in the first set of code sites, and each code segment in the first set of code segments may be associated with a code site in the first set of code sites. The client computing device may insert each code segment in the first set of code segments at its associated code site in the compiled shared library.

## Claims

### Claim 1

A method for dynamically modifying shared libraries on a client computing device, comprising:
receiving a first set of code segments and a first set of code sites associated with a first application, wherein:
each code site in the first set of code sites comprises an address within a compiled shared library stored on the client computing device;
the compiled shared library includes one or more dummy instructions inserted at each code site in the first set of code sites; and
each code segment in the first set of code segments is associated with a code site in the first set of code sites; and
inserting each code segment in the first set of code segments at its associated code site in the compiled shared library.

### Claim 2 (depends on 1)

The method of claim 1, further comprising:
receiving a request to modify the compiled shared library from the first application;
determining whether the first application is authorized to modify the compiled shared library; and
denying the request to modify the compiled shared library in response to determining that the first application is not authorized to modify the compiled shared library.

### Claim 3 (depends on 1)

The method of claim 1, wherein inserting each code segment at its associated code site in the compiled shared library comprises:
copying an original memory page of the compiled shared library containing a first code site in the first set of code sites;
overwriting the one or more dummy instructions at the first code site of the copied memory page with an associated code segment; and
overwriting the original memory page with the copied memory page.

### Claim 4 (depends on 1)

The method of claim 1, wherein inserting each code segment at its associated code site in the compiled shared library comprises:
copying an original memory page of the compiled shared library containing a first code site in the first set of code sites;
overwriting the one or more dummy instructions at the first code site of the copied memory page with an associated code segment;
un-mapping the original memory page from an address space of the compiled shared library associated with the first application; and
mapping the copied memory page into the address space at a same address location as the original memory page.

### Claim 5 (depends on 1)

The method of claim 1, wherein inserting each code segment at its associated code site in the compiled shared library comprises:
overwriting the one or more dummy instructions at a first code site in the first set of code sites in the compiled shared library with an associated code segment.

### Claim 6 (depends on 1)

The method of claim 1, further comprising:
receiving a second set of code segments and a second set of code sites associated with a second application, wherein:
each code site in the second set of code sites comprises an address within the compiled shared library;
the compiled shared library includes one or more dummy instructions inserted at each code site in the second set of code sites; and
each code segment in the second set of code segments is associated with a code site in the second set of code sites; and
inserting each code segment in the first set of code segments and the second set of code segments at its associated code site in the compiled shared library.

### Claim 7 (depends on 1)

The method of claim 1, further comprising:
removing the first set of code segments inserted into the compiled shared library from memory when the compiled shared library is unloaded from memory.

### Claim 8

A method for compiling shared libraries on a computing device, comprising:
receiving a set of code sites, wherein each code site in the set of code sites comprises an address within a shared library stored on the computing device; and
compiling the shared library, wherein one or more dummy instructions are inserted in the compiled shared library at each code site in the set of code sites.

### Claim 9 (depends on 8)

The method of claim 8, further comprising:
providing the compiled shared library to one or more client computing devices.

### Claim 10

A client computing device, comprising:
a memory storing a compiled shared library; and
a processor coupled to the memory and configured with processor-executable instructions to perform operations comprising:
receiving a first set of code segments and a first set of code sites associated with a first application, wherein:
each code site in the first set of code sites comprises an address within the compiled shared library;
the compiled shared library includes one or more dummy instructions inserted at each code site in the first set of code sites; and
each code segment in the first set of code segments is associated with a code site in the first set of code sites; and
inserting each code segment in the first set of code segments at its associated code site in the compiled shared library.

### Claim 11 (depends on 10)

The client computing device of claim 10, wherein the processor coupled is configured with processor-executable instructions to perform operations further comprising:
receiving a request to modify the compiled shared library from the first application;
determining whether the first application is authorized to modify the compiled shared library; and
denying the request to modify the compiled shared library in response to determining that the first application is not authorized to modify the compiled shared library.

### Claim 12 (depends on 10)

The client computing device of claim 10, wherein the processor is further configured with processor-executable instructions to insert each code segment at its associated code site in the compiled shared library by:
copying an original memory page of the compiled shared library containing a first code site in the first set of code sites;
overwriting the one or more dummy instructions at the first code site of the copied memory page with an associated code segment; and
overwriting the original memory page with the copied memory page.

### Claim 13 (depends on 10)

The client computing device of claim 10, wherein the processor is further configured with processor-executable instructions to insert each code segment at its associated code site in the compiled shared library by:
copying an original memory page of the compiled shared library containing a first code site in the first set of code sites;
overwriting the one or more dummy instructions at the first code site of the copied memory page with an associated code segment;
un-mapping the original memory page from an address space of the compiled shared library associated with the first application; and
mapping the copied memory page into the address space at a same address location as the original memory page.

### Claim 14 (depends on 10)

The client computing device of claim 10, wherein the processor is further configured with processor-executable instructions to insert each code segment at its associated code site in the compiled shared library by:
overwriting the one or more dummy instructions at a first code site in the first set of code sites in the compiled shared library with an associated code segment.

### Claim 15 (depends on 10)

The client computing device of claim 10, wherein the processor is configured with processor-executable instructions to perform operations further comprising:
receiving a second set of code segments and a second set of code sites associated with a second application, wherein:
each code site in the second set of code sites comprises an address within the compiled shared library;
the compiled shared library includes one or more dummy instructions inserted at each code site in the second set of code sites; and
each code segment in the second set of code segments is associated with a code site in the second set of code sites; and
inserting each code segment in the first set of code segments and the second set of code segments at its associated code site in the compiled shared library.

### Claim 16 (depends on 10)

The client computing device of claim 10, wherein the processor is configured with processor-executable instructions to perform operations further comprising:
removing the first set of code segments inserted into the compiled shared library from memory when the compiled shared library is unloaded from memory.

### Claim 17

A computing device, comprising:
a memory storing a shared library; and
a processor coupled to the memory and configured with processor-executable instructions to perform operations comprising:
receiving a set of code sites, wherein each code site in the set of code sites comprises an address within the shared library; and
compiling the shared library, wherein one or more dummy instructions are inserted in the compiled shared library at each code site in the set of code sites.

### Claim 18 (depends on 17)

The computing device of claim 17, wherein the processor is configured with processor-executable instructions to perform operations further comprising:
providing the compiled shared library to one or more client computing devices.
