## Enhancing Attack Resilience in Real-Time Systems through Variable Control Task Sampling Rates

Arkaprava Sain, Sunandan Adhikary, Ipsita Koley, Soumyajit Dey Department of Computer Science and Engineering, Indian Institute of Technology, Kharagpur, India

Abstract -Cyber-physical systems (CPSs) in modern real-time applications integrate numerous control units linked through communication networks, each responsible for executing a mix of real-time safety-critical and non-critical tasks. To ensure predictable timing behaviour, most safety-critical tasks are scheduled with fixed sampling periods, which supports rigorous safety and performance analyses. However, this deterministic execution can be exploited by attackers to launch inferencebased attacks on safety-critical tasks. This paper addresses the challenge of preventing such timing inference or schedulebased attacks by dynamically adjusting the execution rates of safety-critical tasks while maintaining their performance. We propose a novel schedule vulnerability analysis methodology, enabling runtime switching between valid schedules for various control task sampling rates. Leveraging this approach, we present the Multi-Rate Attack-Aware Randomized Scheduling (MAARS) framework for preemptive fixed-priority schedulers, designed to reduce the success rate of timing inference attacks on realtime systems. To our knowledge, this is the first method that combines attack-aware schedule randomization with preserved control and scheduling integrity. The framework's efficacy in attack prevention is evaluated on automotive benchmarks using a Hardware-in-the-Loop (HiL) setup.

Index Terms -Schedule-Based Attacks, Multi-Rate Control Execution, CPS Security

## I. INTRODUCTION

Real-time systems (RTSs) in CPS domains like automotive, avionics, power grids, etc. are mostly safety-critical. The feature-rich implementation of such modern CPSs makes the system design mixed-critical, for which tasks with different criticality levels are executed in each processor [1]. The safe operation of these RTSs relies highly on the timely execution of the safety-critical control tasks. For achieving predictable execution behaviour, fixed priority based scheduling algorithms remain popular for running tasks on embedded control units in CPSs, with higher priority typically being assigned to hard real time safety-critical tasks for ensuring deadline satisfaction even under platform uncertainties like sensing/actuation/communication delays. Also, the deterministic nature of static priority scheduling enables the designers to analyse the worst-case response time (WCRT) of every safetycritical control loop and design delay-aware control strategies for these loops [2].

lower priority task (mostly non-safety-critical) that periodically executes immediately before or after this victim task, the attacker observes its execution timestamps for multiple hyperperiods. Since a static fixed-priority schedule is followed, the execution sequence repeats every hyper-period, which helps the attacker infer possible initial offsets of the safety-critical task and predict their future arrival times. The attacker can manipulate data inside the victim task's shared I/O device buffer within a time window around those inferred future arrival time instances [4]. We term such vulnerable time windows as attack effective window (AEW) , a quantity which is implementation-dependent and can be measured experimentally by the attacker [4]. Such schedule-based attacks (SBAs) can be categorised into the following four models depending on the timing relation between the victim's arrival and the attacker task's arrival within AEW [5], i.e., Posterior Attack (attacker task executes after victim task), Anterior Attack (attacker task executes before the victim task), Concurrent Attack (attacker task executes while the victim task runs) and, Pincer Attack (combines both posterior and anterior attack). Since the non-critical attacker tasks are of lower priority, the corresponding jobs are mostly scheduled/completed after higher-priority victim task instances in case of nearby arrival times. This makes posterior attacks more prevalent compared to other attack models in embedded controllers [6]. In this paper, we consider the posterior attack model, analyse the drawbacks of state-of-the-art defence mechanisms, and discuss how the proposed defensive solution outdoes them.

However, this predictability of fixed-priority scheduling exposes the timing information of safety-critical task executions. The attacker first finds out the periodicity of a safety-critical task by observing its data communication in the network or by observing the changes in physical system states of the controlled plant [3], [4]. By compromising a relatively

Researchers have proposed several solutions to prevent and defend against such SBAs. Among these, schedule randomization -based defence approaches are widely explored. One of the initial works in this area is TaskShuffler [7], which randomizes job execution by allowing lower-priority jobs in the ready queue to run before higher-priority jobs. In [8], the authors discuss the following two slot-level randomization techniques to mitigate directed schedule-based attacks. (i) Slotlevel online randomization of schedules, for selecting the next job at runtime meeting task deadline constraints and (ii) Offline schedule-diversification, where offline precomputed schedules are stored beforehand, and their selection is made online. Such schedule randomization methods obfuscate the schedule information, which makes it difficult for the attacker to predict the future arrival times of the victim task. However, randomizing without any insight into the attacker's strategy produces some vulnerable schedules during randomization, which can make a random attack attempt successful [9]. The authors in [10] devise a privacy-preserved strategy that samples a suitable execution offset for critical tasks from a Laplace distribution and switches between them to keep the execution sequences from getting exposed. However, they do not ensure the performance and schedulability criteria of the control tasks while doing so. In another line of work, the authors in [5] suggested a temporal protection mechanism for multi-core Linux platforms. In this method, all the non-safety critical tasks, mostly considered to be untrusted , are blocked within the AEW of all the safety-critical or trusted tasks, eliminating all schedule vulnerabilities. However, this significantly delays the execution of untrusted tasks in uniprocessor systems, and they frequently miss their deadlines. If the trusted or critical task utilization is considerably high, such a protection strategy can impose an unbounded delay on the execution of other tasks that hampers the overall system performance [6]. In this work, we propose a schedule randomization policy that is attack-aware and ensures meeting the deadlines for all tasks in the system, by carefully balancing the trade-offs between performance and security.

One of the crucial pieces of information for any schedulebased attack model is the future arrival instances of a critical task, which is derived by finding out its periodicity [4]. If the sampling period is dynamically switched, the attacker will find it difficult to infer the exact schedule even after doing schedule analysis. With this motivation, we utilise multi-rate controller scheduling strategy to ensure security in real-time task schedules by reducing its inferability , i.e. identifying start times of victim task instances. As shown in the state-of-theart research works, dynamic switching between a predefined set of sampling periods, coupled with optimally designed controllers, significantly reduces resource utilization, ensuring performance, compared to conventional fixed sampling rate static scheduling [11]. There exist state-of-the-art works that analyse the performance of such systems by analysing their Lyapunov stability [12]-[14]. Such works mostly analyse whether a Common Quadratic Lyapunov Function (CQLF) exists among the control loops with different sampling rates. The existence of such a function that abides by a given performance criteria guarantees stability when the system is subject to arbitrary or fast switching. There are works that derive a Multiple Lyapunov functions (MLF) -based [15] or dwell time -based switching rules for slowly switching between different modes to ensure stability. Most of these research works focus on optimizing resources or control costs utilizing multi-rate switching strategies [2], [16]-[18]. In this work, we intend to switch between different controller sampling rates in runtime to reduce the inferability and vulnerability of a deployed schedule towards posterior SBAs. To enable this arbitrary switching, we utilize the CQLF-based fast-switching rules that ensure stability.

We propose a novel Multi-Rate Attack-Aware Schedule Randomization (MAARS) Framework to secure all the safetycritical control tasks that are scheduled to execute in a uniprocessor embedded platform against schedule-based posterior attacks [9]. This essentially combines (I) an offline schedule diversification technique that chooses a set of schedules with minimum inferability /predictability for a schedule-based attacker and (II) an online schedule selection technique that suitably deploys schedules to minimize the vulnerability of an attack-affected safety-critical task. To the best of our knowledge, this is the first work that proposes an attack-aware schedule randomization policy. The following are the main contributions of this work:

- 1. We present a novel approach for judiciously choosing performance-aware sampling rates for a safety-critical control task such that the inferability of its future arrival instances are minimized, thereby effectively thwarting the leakage of critical task information (such as periodicity, initial task offset, etc.)
- 2. We propose a novel methodology that generates a set of schedules offline using slot-level randomization techniques for the chosen set of sampling rates for each control task. We also develop a runtime schedule selection algorithm that intelligently deploys schedules from this set by observing the posterior attacks' effect on a control loop such that the vulnerability of the corresponding control task is minimized in that schedule.
- 3. We experimentally evaluate how well the proposed MAARS framework balances the trade-off between security and system performance compared to state-of-the-art techniques by applying it to a synthetic automotive task set. We implement the same task set in a Hardware-in-Loop (HIL) testbed setup to judge the real-time applicability of the MAARS framework.

## II. SYSTEM MODEL

## A. Task and Scheduler Model

Let Γ denote a set of N periodic tasks s.t. Γ = { τ 1 , τ 2 , ...τ N } , that are scheduled on a uniprocessor system by a static priority scheduler with fixed priority. Each task has three parameters ( e , p , d i i i ) , where e i is the worst-case execution time (WCET), p i is the sampling period, and d i is the relative deadline. We assume d i = p , i ∀ i ≤ N and the WCET of a task includes jitter and context-switch overheads. We consider a mixed-criticality system, i.e., it comprises control tasks of varying criticality levels in order of their priority. Following the work in [5], we consider all the safety-critical control tasks as trusted and hard to compromise. Whereas other tasks are considered to be untrusted and can be compromised by a schedule-based attacker. Any safety-critical control task from the trusted set Γ t ⊆ Γ can be a victim to a schedule-based attack (SBA) launched by an adversary who has compromised a non-safety-critical task from the untrusted set Γ u ⊆ Γ . Due to the high criticality level, the trusted tasks are mostly assigned with higher priority than the untrusted tasks. Hence, their executions are not delayed by the non-critical tasks as they are promptly scheduled as they arrive by a fixedpriority preemptive scheduler . In this work, we consider these trusted safety-critical control tasks to be designed with different sampling rates, which changes their periodicities of execution. We denote the set of periodicities for i th control task as P i = { p 1 i , p 2 i , · · · , pl i } . We assume that the task set Γ is schedulable by a fixed-priority preemptive scheduler such that the worst-case response time (WCRT) wcrt i for any task τ i ∈ Γ satisfies, wcrt i = e i + ∑ τ j ∈ hp τ i ( ) ⌈ r k i p j ⌉ e j ≤ d i . Here r 0 i = e i , wcrt i = r k +1 i = r k i for some k ≥ 0 and for every τ i ∈ Γ t , p i = minimum periodicity from the set P i . This criteria ensures that the tasks are schedulable for their maximum execution rates and assuming no precedence constraints among the tasks, valid schedules can be generated without any deadline misses.

## B. Control Task Model

We express the plant model as a Linear time-invariant (LTI) system having dynamics as follows.

$$& \dot { x } = A _ { c } x ( t ) + B _ { c } u ( t ), \ y ( t ) = C x ( t ) + v ( t ) \quad & \text{discret} \\ & \hat { x } [ k + 1 ] = ( A - L C ) \hat { x } [ k ] + B u [ k ] + L y [ k ] \quad & \text{in $Eq$} \\ & u [ k + 1 ] = K \hat { x } [ k + 1 ] \quad & \text{(1)} \quad & \text{period}$$

Here, the vectors x ∈ R n , x ˆ ∈ R n , y ∈ R m , and u ∈ R p describe the plant state, the estimated plant state, output and the control input, respectively. The matrices A c , and B c , are continuous time matrices that define the continuous-time state and input-to-state transition matrices, respectively. C is the output transition matrix. At the k th sampling instance, the real-time is t = kh , where h is the sampling period. We can, therefore, define the discrete-time matrices corresponding to their continuous-time counterparts as A = e A h c , B = ∫ h 0 e A t c B dt K c · . and L are Linear Quadratic Regulator (LQR) controller gain and Kalman estimator gain, respectively. Each control task samples the sensed plant measurement vector y at each sampling iteration, using which future states of the plant are estimated. Based on the estimated plant state, a control task calculates the required control input u to transmit it to the actuator to actuate and control the plant output.

Fig. 1: System and Control Task Model

![Image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00341v2-figure-d0088c0f-fd6e-4e44-84a0-b69456283e6d.jpg)

1) Closed Loop Under Sampling Period Variation: As discussed above, the discrete-time system characteristic matrices depend on the sampling period h . Since the LQR gain is designed to minimize a user-defined quadratic cost function, which is sampled once in every h time interval, the LQR control gain is also dependent on the sampling period. So is the estimator Kalman gain L , as it is also designed to minimize the variance of the estimation error, i.e., the difference between the estimated plant state ˆ x and actual plant state x at every sampling iteration. Therefore, the discretetime matrices A,B,K,L in Eq. 1 can be replaced with their sampling period-dependent versions, i.e., A ,B ,K ,L h h h h . By discretizing the continuous-time plant equation in Eq. 1 we get x k [ +1] = A x k h [ ] + B u k h [ ] . Since we intend to capture the change in the progression of the control loop w.r.t. the change in its sampling period, we define an extended augmented state vector of the control task as X = [ x T , x ˆ T T ] that captures both plant and estimator/controller dynamics. By replacing u with -K x h ˆ and y with Cx , the overall closed-loop system evolves as follows.

$$X [ k + 1 ] = \mathbb { A } _ { h } X [ k ], \mathbb { A } _ { h } = \begin{bmatrix} A _ { h } & - B _ { h } K _ { h } \\ L _ { h } C & A _ { h } - L _ { h } C - B _ { h } K _ { h } \end{bmatrix} \quad ( 2 )$$

For two different sampling periods p 1 and p 2 , we denote the discrete-time augmented system matrices by A p 1 and A p 2 . Our methodology uses this augmented system representation in Eq. 2 to ensure a desired performance while varying periodicities of control tasks for security.

2) Residue-based Anomaly Detector: Each of the safetycritical control loops is equipped with a residue-based detector that observes changes in the system residue (i.e., the difference between the sensed and estimated outputs) for anomaly detection. We consider an integrated implementation of controller and detector functionalities as part of the control task to avoid data manipulation. We use a χ 2 -based detector in this work. The χ 2 detector utilises a normalized quadratic function of the residual to amplify and easily detect minute variations in system residue. For system residue res k [ ] at k th sampling iteration, its chi-square measure is z k [ ] = res k [ ] T Σ -1 res res k [ ] where Σ res is the variance of system residue. Considering the measurement noise to be a zero-mean Gaussian noise, res k [ ] ∼ N (0 , Σ res ) ⇒ z k [ ] ∼ χ 2 ( m, 2 m ) , where m is the number of output measurements, considered as the degree of freedom of the χ 2 distribution. We employ a windowed chi-square detector that compares the average value of the chi-square statistic of system residue over a pre-defined time window ( N ), i.e., g k [ ] = 1 N N -1 ∑ i =0 z k [ -i ] and compares it with a pre-defined threshold Th . The threshold is calculated to maintain a desired false alarm rate [19]. The chi-squared detector raises the alarm, denoting an attack attempt on a certain closed loop when g k [ ] &gt; Th at any k th sampling period of that closed loop.

## III. THREAT MODEL

In this section, we discuss in-depth how we model the schedule-based attacker and explain our assumptions about the attacker's objectives and capabilities. The objective of the attacker is to utilize the timing information exposed by the processor-level task execution schedules to compromise tasks with higher criticality. Since tasks with higher criticality are mostly developed by OEMs or trusted vendors and go through thorough security scans and functionality checks, they are usually very difficult to compromise [5], [6]. Hence, an attacker is more likely to attempt compromising less critical tasks, that are often assigned lower priorities. We denote such compromisable tasks as untrusted tasks. Since these untrusted tasks are part of the software that comes from a range of third-party vendors [6], compromising them using a man-in-the-middle-type attack is possible. As mentioned in Sec. I, depending on the timing relationship between the victim and attacker task, SBAs can be categorised into 4 types [5]. This work considers a posterior SBA model and provides a mitigation framework against it. The following are assumptions regarding the attacker's ability, objectives, and attack methods.

1) Attacker's Capabilities: We make the following assumptions about the attacker's capabilities: (1) The scheduler is trustworthy and can not be compromised by the attacker. Consequently, the attacker lacks direct control over task execution and is restricted to leveraging compromised tasks only when the scheduler permits.

![Image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00341v2-figure-e7c54e54-6c73-4dab-afaf-85df49de2b45.jpg)

(2) The adversary knows the scheduling policy used, and it can compromise one task among all the lower-priority untrusted tasks ( Γ u ). This enables the attacker to observe executions of this compromised untrusted task for several hyper-periods to find out partial information about its intended victim control task( ∈ Γ t ). (3) The attacker can partially deduce the sampling rates of any control task ( ∈ Γ t ) either by observing the message data packets in the network or physical system states. (4) Attacker can modify the data written by the victim control task inside an I/O buffer or cache only if it executes within an Attack Effective Window [5]. AEW is the specific time interval within which the attacker task must be executed for successful data manipulation. This duration is completely implementationdependent and can be derived by experiments [4]. The attacker must tamper the data in the I/O buffer before the transmission task reads and transmits it for actuation. Hence, AEW is the duration after which the transmission task transmits the control program-generated actuation data and is scheduled to execute with the same periodicity as the control task. In Fig. 2, we illustrate this where the AEW of the control task has been shaded in red. AEW starts when the control task (in blue shade) finishes execution, writes its data to the buffer and ends once the transmission task (in green stripe) starts. We denote the AEW length for a control task τ i ∈ Γ t by Ω i .

2) Attack Execution: We assume an attacker's objective is to manipulate control inputs by performing a schedule-based posterior attack on control tasks. To implement such an attack, the attacker must infer the exact future arrival instances of the victim task. Having compromised a lower-priority untrusted task, the attacker can log that task's start and end time as part of the overall schedule. Utilising this information, it attempts to predict the start and end times of other trusted tasks in the schedule. The attacker can achieve this by using a schedule ladder-based analysis proposed in the work [4]. We briefly discuss how the schedule ladder is constructed, and the attacker uses it to derive the future arrival instances of the victim task.

TABLE I: Example Task-Set 1

![Image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00341v2-figure-2a961d62-58b4-42b6-8417-1400d571b2ca.jpg)

| Tasks   | P       |   e |
|---------|---------|-----|
| τ 1     | { 4,5 } |   1 |
| τ 2     | 4       |   1 |
| τ 3     | 5       |   2 |

A schedule ladder represents a task schedule arranged vertically with adjacent timelines of equal row size. Each column in the ladder represents an atomic observation period, or unit time, of real-time duration δ . The attacker takes the row size of the ladder as equal to the victim task's sampling period measured in time units of size δ . Hence, for a given victim task τ i executing with a sampling rate p i time units, the row length of the ladder becomes δp i . The motive behind taking such a row length is that the victim task will arrive once in every row of the ladder and will occupy δe i columns. Moreover, all arrivals of τ i will be located in the same column. We illustrate a schedule ladder diagram for the task set in Tab. I in Fig. 3. The row length of the ladder is 4 since τ 1 (victim) sampling rate = 4. The first row represents the timeline [0 , 4] , second row [4 , 8] and so on. The blue arrow shows the arrival column of the victim task that arrives once in every row and occupies column 1 of the ladder. While performing an analysis, the starting point of analysis (observation) of the top row can be arbitrarily chosen by the attacker, which is decided by the start of its observation window. The attacker starts observing its own start and end times using the compromised untrusted task. Note the attacker task is a lower priority untrusted task (w.r.t victim). Hence, if the victim task arrives in the same column, it preempts the attacker task. This is shown in Fig. 3, where the attacker task τ 3 arrives at instances t = 0 20 , in the first column (since its sampling rate is 5) but gets preempted by τ 1 . In column 2 it gets preempted by τ 2 . Therefore, it always executes in the third and fourth column of the ladder.

Fig. 3: Ladder diagram of Task-Set-1 illustrated along with their corresponding AEI and AAI.

![Image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00341v2-figure-8f42e6fe-3f80-493c-98e9-d9ec35c04eb4.jpg)

After the end of observation, the attacker finds out Attack Arrival Instances (AAI) . The AAI is the set of ladder columns where the attacker task has arrived at least once during its entire observation window. For e.g. in Fig. 3, the AAI is [0 , 4] , shown below the ladder diagram. The set of ladder columns where the attacker task has been executed at least once during its entire observation window are termed as Attack Exe- cution Instances (AEI) . Note that the ladder columns where the attacker task arrives ( ∈ AAI ) but never gets executed ( / AEI ∈ since it is preempted by higher priority victim tasks) are the possible candidates for the columns where the victim task arrives. Hence, the attacker easily infers these ladder columns, which are in AAIs but not AEIs, as the victim task's arrival column (offset), predicting them as the victim's future arrival instances. We illustrated this in Fig. 3 for task-set Tab. II, where using τ 2 as an attacker task results in AAI = 4 and AEI = 2 . One immediate conclusion we draw from this discussion is that a longer execution time for the attacker task make it easier for an attacker to infer the arrival column of the victim task. This is because the attacker task execution will

span a greater proportion of ladder columns, making it easier to guess the correct victim task arrival column.

Consider the task set in Tab. II, where the trusted control task set Γ t = { τ 1 , τ 2 } and the untrusted task set Γ u = { τ 3 } (Fig.4). After determining the arrival time of the victim task τ 1 , the attacker uses untrusted task τ 3 to launch a posterior SBA on τ 1 . We assume the AEW of τ 1 is Ω 1 = 1 time unit (highlighted in the shaded region of the timeframe). Therefore, for a successful SBA, τ 3 must execute within this timeframe after τ 1 finishes executing. Using this threat model, we demonstrate how state-of-the-art secure scheduling policies can mitigate such attacks and discuss their shortcomings in balancing performance and security, which motivates our novel methodology.

## IV. MOTIVATING EXAMPLE

We motivate our proposed methodology with an example by discussing how (i) the conventional protection windowbased secure scheduling methods, such as [5], fail to ensure system performance, optimal resource utilisation, etc., and (ii) the randomization-based scheduling methods, such as [7], fail to guarantee security against SBAs. This, in turn, motivates our methodology, which utilises variable sampling period-based implementation of control tasks for balancing the trade-offs between security and performance without compromising the schedulability of the task set.

TABLE II: Example Task Set-2

![Image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00341v2-figure-554c02ad-6dff-4bba-bdf4-bef61595f0bb.jpg)

| Tasks   | P       |   e |
|---------|---------|-----|
| τ 1     | { 2,3 } |   1 |
| τ 2     | 4       |   1 |
| τ 3     | 4       |   1 |

We refer the task set in Tab. II, where the trusted control tasks Γ t = { τ 1 , τ 2 } and the untrusted tasks Γ u = { τ 3 } . The control task τ 3 executes at two different sampling rates 2 and 3 time units ( δ time unit = 10 ms ), respectively. We assume the attacker has compromised the untrusted task τ 3 to launch a posterior attack on the victim task τ 1 . The AEW duration for τ 1 is Ω 1 = 1 time unit.

Fig. 4: AEW-based scheduling of Taskset-2

![Image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00341v2-figure-196a8436-6e10-430a-8c5a-711e8399ece2.jpg)

Protection windowbased approaches such as in [5] propose restricting the execution of untrusted tasks' job instances within the AEW of all the trusted tasks. Fig. 4 demonstrates how a task schedule generated following [5] (for the task set in Tab. II) leads to deadline misses of untrusted tasks and wastage of CPU resources. The first job of τ 1 executes at [0 , 1] , In the next interval at [1 , 2] , job instance of τ 2 executes. In [2 , 3] , second job of task τ 1 arrives and executes. However, the job instance of τ 3 will not be allowed to execute at [3 , 4] and hence will miss its deadline, even though the CPU remains idle. This leads to inefficient CPU utilisation.

On the other hand, the schedule randomization methods are more suitable since they make sure every task meets its deadlines (irrespective of trust). However, the state-of-the-art randomization policies do not consider the attacker's model into consideration and hence are of- ten more vulnerable to SBAs while randomly changing the schedules [9]. Earlier works [7] have demonstrated that selecting schedules using such attack-unaware randomization policies can still lead to successful attacks.

![Image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00341v2-figure-45503e89-314b-4c72-9f15-55ba0ae72ff1.jpg)

For example, if we apply such a schedule randomization

Fig. 5: Feasible Schedules Generated using Task-Set 2 (Considering p 1 = 2 )

method [7] on the same task set for a single sampling rate of p 1 = 2 , for control task τ 1 , we can generate a total of 8 unique feasible task schedules of hyper-period length of 4 time units (see Fig. 5). But among them, 4 schedules s , s 4 5 , s 6 and s 7 are vulnerable for τ 1 , since instances of τ 3 appears within the AEW of the victim task τ 1 . However, if we use two different sampling periods for the control task τ 1 , P 1 = { 2 3 , } , we can form two possible task specifications Γ 1 and Γ 2 with unique sets of sampling period, i.e., { p 1 = 2 , p 2 = 4 , p 3 = 4 } and { p 1 = 3 , p 2 = 4 , p 3 = 4 } . For the task specification Γ 2 , we can generate 36 unique and feasible schedules (using TaskShuffler) with a hyper-period length of 12 time units. By analysing the vulnerability of τ 1 for all 36 schedules, 12 schedules are found to be safe (no posterior attackable instances within AEW) for victim task τ 1 . Thus, multi-rate execution enables the generation of a higher number of randomized schedules with minimal vulnerability. From these examples, we draw a conclusion that utilising multi-rate for trusted tasks along with imparting attack awareness to the task schedules (w.r.t trusted tasks) can hamper a schedule-based posterior attacker's success rate.

## V. PROPOSED METHODOLOGY

In this section, we present the methodology for generating multi-rate attack-aware randomized schedules. A step-wise

Fig. 6: Overview of the proposed MAARS Framework

![Image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00341v2-figure-8ca44fba-0890-4c65-8ef8-964440a0c98f.jpg)

overview of the MAARS methodology is shown in Fig. 6. During the design time, our proposed framework takes the following as inputs: (i) a task set Γ consisting of both trusted and untrusted set of tasks, Γ t , Γ ( u ⊆ Γ) respectively, (ii) trusted task specifications, i.e., criticality level/ priorities c i , a controllable, schedulable set of periodicities P i , WCRT e i of each trusted task τ i ∈ Γ t , (iii) trusted task specifications, i.e., criticality level or priority c j , periodicity p j , WCRT e j of each untrusted task τ j ∈ Γ u , (iv) physical system specifications corresponding to each control task τ i ∈ Γ t , its performance specification, (v) other tunable design parameters related to MAARS, like Tolerable Attack Probability , Maximum Schedule Vulnerability Index , etc. to constrain the vulnerability of MAARS as defined in Sec. V-C

As motivated in Sec. IV switching between the allowable set of sampling periods P i reduces the determinism (explained as inferability in Sec. V-B) in the real-time task execution pattern. The first step in our methodology is to prune a set of periodicities P i for a given critical/trusted task such that the system, in closed loop with this control task, delivers its desired performance (see Fig. 6). In the second step, we intelligently select a subset of secure sampling periods from this performance-aware set of periodicities, such that the attacker's schedule analysis is maximally hampered. We theoretically prove that the devised secure periodicity selection policy maximizes the non-determinism in the execution pattern of the victim control task, by preventing the attacker from inferring critical task parameters. The third step uses these performanceaware and secure set of sampling rates to generate all possible valid task schedules by following the schedule randomization strategy given in [7]. These valid schedules are generated by ensuring that no task misses their deadlines while switching between the periodicities. In the fourth step, we analyse the probability of posterior schedule-based attack (SBA) on each victim task for each schedule. By quantifying the vulnerability of each schedule, we rank and suitably store the schedules for using them in runtime to prevent posterior SBAs.

During run-time, MAARS deploys a secure schedule selection algorithm. As discussed earlier, each control task is implemented with a windowed χ 2 -detector that flags any attack attempt on its corresponding closed-loop ( box with black-dotted outline in Fig. 6, refer to Sec. II-B2). Under no attack, MAARS randomly selects and deploys different schedules from a designer-selected set of valid schedules with minimum vulnerability. We term this mode as Normal Mode ( green-dotted outlined box in Fig. 6). MAARS switches to an Alert Mode when the detector flags an attack on a certain victim task τ i ∈ Γ t ( red-outlined box in Fig. 6). In this mode, the schedule selection algorithm switches to the least vulnerable schedule for victim task τ i to ensure minimum posterior attack success. In the following sections, we discuss each design time step and run-time algorithm in detail.

## A. Performance-aware multi-rate Period Selection

↦

To ensure a desired performance while arbitrarily switching between the closed loops with a schedulable sampling periods to reduce the inferability of victim task parameters, we must constrain our switching choices. Let us consider, for the augmented closed loop system (as mentioned in Eq. 2) corresponding to a control task τ i ∈ Γ t , this sampling period switching signal is σ i : N → P i , where P i = { p 1 i , p 2 i , · · · , pn i } represents the chosen set of non- zero sampling periods. In presence of this switching signal, we can express Eq. 2 for the control task τ i as

$$X ^ { ( i ) } ( k + 1 ) = \mathbb { A } _ { \sigma _ { i } ( k ) } ^ { ( i ) } ( X ^ { ( i ) } ( k ) ) \, \text{ \quad \ \ } ( 3 )$$

the switching signal σ i ( k ) = pj signifies that at k th sampling instance, this augmented system switches to the controller designed with sampling period pj . For a switched system like Eq. 3, each such switchable closed loop systems are considered as its subsystems. As stated in [15], the following condition must be satisfied for maintaining a desired performance while arbitrarily switching between the closed loop subsystems.

Claim 1. In the case of a switched system like Eq. 3, in order to maintain a desired global uniform exponential stability (GUES) decay rate of γ while arbitrarily switching among different sub-systems, there must exist a common Lyapunov function (CLF) for all its arbitrarily switchable subsystems that satisfy the following set of equations

$$\dots \dots \dots \\ \inf \text{ferring } \kappa _ { 1 } ( \| X ^ { ( i ) } [ k ] \| ) \leq V _ { i } ( X ^ { ( i ) } [ k ] ) \leq \kappa _ { 2 } ( \| X ^ { ( i ) } [ k ] \| )$$

$$\text{rman} \underset { \text{rocible} } { \text{rman} } ^ { \ } \bigtriangleup V _ { i } ( X ^ { ( i ) } [ k ] ) \leq \alpha _ { i } V _ { i } ( ( X ^ { ( i ) } [ k ] ), \text{for} \, \alpha _ { i } = g ( \mathbb { A } _ { p j } ^ { ( i ) } ) s. t. \, \sigma _ { i } ( k ) = p j$$

Here, κ 1 , κ 2 are class K ∞ functions, and g : { A ( ) i p 1 , · · · , A ( ) i pn } ↦→ R \ { 0 } . Global uniform exponential stability (GUES) with a decay rate γ &lt; 0 signifies that at k th sampling iteration ∥ X k ( ) ∥ ≤ Me γk ∥ x [0] ∥ , where ∥ ∥ . is vector norm and M &gt; 0 . We consider a common quadratic Lyapunov function (CQLF) V i ( X ( ) i ) = X ( ) i P ( ) i X ( ) i T . We validate the existence of this CQLF for all switchable closed loops by solving the following linear matrix inequalities (LMIs) and finding out a positive definite matrix P ( ) i &gt; 0 such that for given α , j A ( ) i pj T P ( ) i A ( ) i pj -P ( ) i ≤ α j P ( ) i ∀ pj ∈ P i . Given a large set of periodicities, we only consider the set of sampling periods for which their corresponding closed loops have a CQLF that follows Claim 1 for a given performance criteria. This ensures that the desired performance is guaranteed while we devise an arbitrary switching strategy between these closed loops to minimize the vulnerabilities of the task execution schedules against posterior SBAs.

## B. Secure Sampling Period Selection and Schedule Generation

We devise a novel periodicity selection policy to further prune the set of performance-aware sampling periodicities for a victim control task to maximally reduce the leakage of its critical task parameters (eg,. arrival times, execution offsets). As discussed earlier, the attacker is capable of figuring out the victim task's sampling rate by observing the network traffic or characteristics of the physical plant [4]. The attacker chooses the smallest periodicity of the victim task to construct its schedule ladder as the smallest row length of the ladder increases the cardinality of Attack Arrival Instances ( AAI ) to infer the correct future arrival instances of the victim (refer Fig. 3). As discussed earlier, an attacker with a longer execution time is a more suitable choice since it increases the chance of getting preempted by a victim instance and, thereby, increasing the cardinality of Attack Execution Instances ( AEI ).

We defend against such an attacker by suitably choosing a set of sampling periods for the higher-priority victim tasks so that the chances of preemption are reduced (recall that an attacker infers the timing information of a victim task based on its preemption by the victim). To quantify the inferability of victim task arrivals, considering an attacker task in a schedule, we introduce a metric inferability ratio that represents the number of preemptions by the victim task.

Definition 1. (Inferability Ratio) The Inferability Ratio (IR) of a schedule s for a victim task, τ i having minimum sampling rate p i and an attacker task τ j , is defined as the ratio between the total number of columns in the schedule ladder where the attacker task τ j arrives and gets executed and the total number of columns where the attacker task τ j arrives. Mathematically, Inferability Ratio IR = | AEI | % | AAI | | AAI | , where | · | denotes cardinality of a set. The numerator uses the modulo operation to reset the numerator when the attacker executes wherever it arrives, indicating no inferability due to no preemptions by higher-priority tasks.

If an attacker task is executed in more number of columns in a schedule ladder designed for a victim task, the IR of that schedule, w.r.t. the victim, and its attacker choice is high . This limits the number of columns where the attacker task arrives but does not get executed due to preemption by higher-priority victim tasks. Therefore, it is easier for the attacker to guess the arrival column of the victim task. Intelligent selection of sampling rates can reduce the IR by reducing the number of columns where the attacker task is preempted by the victim task, i.e., the attacker arrives but does not execute. We claim the following to ensure reduced preemption of the attacker task by suitable selection of victim periodicities:

Claim 2. Consider an attacker task τ j ∈ Γ u and a victim control task τ i ∈ Γ t . For τ i , let the set of periodicities allowed be P i with minimum sampling period p i = min { p | p ∈ P i } . In this scenario, the generated fixed-priority preemptive schedules shall have the least Inferability Ratio (IR) if for each p ′ ∈ P i \ { p i } : p ′ = np i + e , n j ∈ N + .

Proof. We consider that an attacker constructs the schedule ladder with a row length equal to the minimum sampling period p i of the victim task τ i ∈ Γ t and observes the AAI and AEI of an attacker task τ j ∈ Γ u . The duration between the attacker task's arrival and the subsequent victim task's arrival repeats after every LCM p ,p ( i j ) unit of time. Note that the e j time units are covered by every execution instance of the attacker task. As long as this the duration between the attacker's and the subsequent victim's arrival is smaller than e j time units, the attacker task will be preempted by the victim task, and the same preemption will repeat after every multiple of LCM p ,p ( i j ) in the timeline.

Now, let us consider that at k -th instance of the victim task, there is a predicted chance of preemption while the victim is running with some np i periodicity where n, k ∈ N + .

Therefore, this k -th victim instance, that arrives at knp i time may preempt the ⌊ knp i p j ⌋ -th instance of the attacker task. Therefore, for successful preemption, the k -th victim task instance must arrive before the execution of ⌊ knp i p j ⌋ -th attacker instance is finished, i.e., ⌊ knp i p j ⌋ p j + e j &gt; knp i Now, consider changing the periodicity of the victim task to some p ′ i , to avoid this preemption. Therefore p ′ i must ensure that the k -th victim instance arrives after the ⌊ kp ′ i p j ⌋ -th attacker instance finishes, i.e., ⌊ kp ′ i p j ⌋ p j + e j ≤ kp ′ i . By substituting p ′ i with np i + e j , this equation becomes as follows.

$$\ e f _ { \ g l } \ g _ { \ g l } \, \leq \lfloor \frac { k ( n p _ { i } + e _ { j } ) } { p _ { j } } \rfloor p _ { j } + e _ { j } = \lfloor \frac { k ( n p _ { i } ) } { p _ { j } } + \frac { k ( e _ { j } ) } { p _ { j } } \rfloor p _ { j } + e _ { j } \\ \ h e _ { \ } e f _ { \ g l } \frac { k ( n p _ { i } ) } { p _ { j } } \rfloor p _ { j } + e _ { j } + e _ { j } \% p _ { j } \rfloor p _ { j } + e _ { j }, \frac { s } { s } = \lfloor \frac { s } { s } \rfloor + a \% b, \\ \ e f _ { \ g l } \frac { k ( n p _ { i } ) } { p _ { j } } \rfloor p _ { j } + e _ { j } + e _ { j } \% p _ { j } + e _ { j }, \, \since { k }, e _ { j }, p _ { j } \in N ^ { + } \\ \ h y, \quad \geq k n p _ { i } - k n p _ { i } \% p _ { j } + e _ { j } - k e _ { j } \% p _ { j } \\ \ e s \quad \geq k ( n p _ { i } + e _ { j } ) - k ( n p _ { i } \% p _ { j } - e _ { j } \% p _ { j } ) \\ \ e n \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cdot \, \cd.$$

This always holds true since k np ( i % p j -e j % p j ) &gt; 0 , because for τ j to be schedulable p j &gt; e j . Note that, e , j p j are considered as whole numbers since we express them in multiples of δ , and the analysis assumes δ as the notion of unit time. Therefore, this choice of periodicity p ′ i = np i + e j ensures no preemption of the attacker by any k -th victim instance. This, in turn, proves the claim that scheduling the victim with a set of periodicities P i such that ∀ p ′ ∈ P i { p i } , p ′ i = np i + e j ensures the least IR for an attacker task τ j ∈ Γ u in any execution schedule.

The periodicity selection criteria used in Claim 2 heavily restricts the periodicity choices since higher values of n ∈ N + are often not supported by Claim 1. We update the criteria as follows in order to get multiple periodicity choices for a victim task with reduced IR.

Remark 1. For a victim task τ i , let the set of periodicities allowed be P i with minimum sampling period p i = min { p | p ∈ P i } . In this scenario, the generated fixed-priority preemptive schedules shall have a reduced Inferability Ratio if for each p ′ ∈ P i \ { p i } : p ′ = np i + k , n ′ ∈ N + , such that k ′ ∈ [ e , p j i -1] considering an attacker task τ j with periodicity p j and execution time e j . Since, k ′ ≥ e j , it ensures zero preemption against any attacker, i.e., IR = 0 . Since, k ≤ ( p i -1) , the predicted preemption after every LCM p ,p ( i j ) time is not repeated and delayed. This clearly reduces the cardinality of AEI, ensuring the reduction in IR compared to the situation when the victim task was scheduled with p i .

We thus prune the performance-aware set of periodicities P i to make it security-aware. For each victim task τ i , we eliminate the periodicities from the set P i that do not satisfy the criteria given in Remark 1.

Once all the possible sets of P i for each victim control task τ i are pruned, we utilise TaskShuffler [7], a schedule randomization technique. Note that after previous steps our task set Γ = Γ t ∪ Γ u , has a set of period choices for tasks in Γ t .

Each control task τ i ∈ Γ t is assigned a performance-aware and secure set of sampling periodicities, i.e. P i = { p , p 1 i 2 i ..., p n 1 i } . For | Γ t | = q , the number of task specifications for Γ is given by: | P 1 | × · · · × | P q | , as the periods of tasks ∈ Γ u are assumed as unique. Each task specification is given as input to the TaskShuffler algorithm for generating the possible set of randomized as well as feasible schedules where no job instance misses the deadline. We denote the overall set of randomized schedules generated considering all task-specifications by S .

## C. Schedule Vulnerability Analysis

In order to characterize each valid /feasible fixed-priority preemptive schedule's vulnerability level, we first formalise the task schedule s as an array, s = { s [1] , s [2] , · · · , s l [ ] } , ∀ s j [ ] ∈ { 0 1 , , · · · , N } . Here, l is the number of time units (each time unit of size δ , same as the column sizes of the schedule ladder, refer to Sec. III-2) in the schedule hyperperiod (the time duration after which a static task schedule repeats itself). The j th element s j [ ] in this array denotes the priority of the task executed at j th time unit, i.e., s j [ ] = i ⇒ τ i ∈ Γ is executed at δj time. We use 0 to denote an idle period in the schedule, and i ∈ { 0 1 , , ...N } denotes the fixed priority assigned to the executed task at a certain time unit. For example, s = { 1 2 1 3 , , , } refers to a fixed-priority preemptive schedule for a task set II. Job 1 of task 1 with priority 1 executes first in the execution order, then job 1 of task 2 with priority 2, and so on.

Given any schedule s ∈ S , executing multiple trusted and untrusted tasks from the task set Γ , first we count the total number of possible posterior attacks on s . Given a victim task τ i with an AEW length of Ω i , Eq.5 gives a total count of all possible posterior attacks on task τ i denoted by C p ( τ i ) in a schedule s of length l .

$$C _ { p } ( \tau _ { i } ) = \sum _ { j = 1 } ^ { l } I \left ( ( s [ j ] = = i ) \wedge \bigvee _ { \vee k \in [ 1, \Omega _ { i } ] } \exists \tau _ { p } \in \Gamma _ { u }, ( s [ j + k ] = = p ) \right ) \quad ( 5 ) \quad \overset { n } { \text{Index, } \alpha } \text{attack } I$$

Here, I ( x ) is an indicator function defined as follows: I ( x ) = 1 if x is true, else I ( x ) = 0 for a proposition x that returns true/false. The indicator function returns 1 if any job from τ p ∈ Γ u executes in any of the AEW Ω i of task τ i ∈ Γ t . Note that even though the attacker can compromise a single untrusted task, the system designer analyses the vulnerability of a posterior attack on each trusted task τ i ∈ Γ t by assuming every untrusted task τ j ∈ Γ u as a potential attacker.

Since sampling rates of all the control tasks τ i ∈ Γ u across different schedules vary, the number of job executions of the task that arrive in each schedule hyper-period will also vary. Therefore, it is necessary to express this posterior attack counts on a trusted task τ i for a schedule s k ∈ S in probabilistic terms. We denote this as the Attack Probability , which is defined as follows:

Definition 2. (Attack Probability) Given a valid schedule s k ( ∈ S ) generated for a task set Γ , the Attack Probability AP &lt;τ ,s i k &gt; of a victim task τ i ∈ Γ t ⊆ Γ is the ratio between the total number of attacker tasks getting executed within the AEW length Ω i of victim control task τ i , and the total number of job-arrivals of the task τ i in the schedule hyper-period of length l k . Mathematically, AP &lt;τ ,s i k &gt; = C p ( τ i ) × p i l k .

For each trusted control task τ i ∈ Γ t , the AP &lt;τ ,s i k &gt; is different in a schedule s k . For each safety-critical control task τ i ∈ Γ t , we define its Tolerable Attack Probability (TAP) as the maximum attack probability on a schedule s that can be tolerated by the closed-loop system, associated with τ i such that the plant operates in a safe and preferable operating region. For a control task τ i , we denote its TAP by TAP i,s k .

In a mixed-criticality system, the system designer chooses the criticality values of the tasks based on their importance to the system's operations and how their compromise would affect the system's overall performance [20]. Considering tasks with a higher index have a lower priority value, the q safetycritical tasks { τ 1 , τ 2 , .., τ q } are arranged in decreasing order of priorities. We assign them with their criticality values { q, ( q -1) , · · · , 2 1 , } respectively. We normalize the criticality values by their total sum of criticality values to derive a criticality level of each task. Therefore, we denote the normalized criticality levels for a task τ i as cl i = c / i ∑ k j =1 c , j ∀ τ j ∈ Γ t . Since AP is task-specific, a schedule may have a minimum attack probability associated with one safety-critical task, whereas it might have the highest AP for the other safetycritical tasks. To secure the schedule w.r.t. all victim tasks, we use these criticality levels to decide the APs of which higher criticality tasks should be given more importance while quantifying the level of vulnerability of the overall task execution schedule. We define a Schedule Vulnerability Index (SVI) for each schedule that is expressed as a weighted (with criticality levels) average of the APs of all high-criticality tasks.

Definition 3. (Schedule Vulnerability Index) Given a schedule s k ∈ S generated by a task set Γ , its Schedule Vulnerability Index , denoted by the symbol SV I k , is the weighted sum of attack probability AP &lt;τ ,s i k &gt; , weighted with normalized task criticality levels c i for each control task τ i . Mathematically, we can write SV I k = ∑ ∀ ∈ τ Γ t AP &lt;τ ,s i k &gt; × cl i ∀ τ j ∈ Γ t

Similar to TAP, we intend to find a tolerable upper limit of SVI. We term this as Schedule Vulnerability Threshold (SVT). The schedules having SVI above SVT are not normally (we shall define what we mean by normally in the next section) deployed in order to reduce vulnerability against posterior SBAs. This ensures that the attack probability thresholds of the higher-criticality (here same as priority) trusted tasks are taken more into consideration during this vulnerable schedule elimination process than that of the lower-criticality victim tasks. Therefore, the Schedule Vulnerability Threshold denoted by SV T can be determined by replacing the Attack Probability with TAP as SV T k = q ∑ i =1 TAP i × cl i . The attack- aware schedules generated using the methodology mentioned in Sec. V-B are pre-computed and stored along with their SVIs and victim task-wise AP values after this vulnerability analysis (See Fig. 6). This process eliminates the need for complex online computations in real-time, thereby minimizing

the runtime overhead associated with schedule randomization. All valid fixed-priority schedules are stored in an array A , sorted in the order of their respective SV I s. At the K -th index, the schedule with SV T value is stored. Another data structure, Schedule Lookup Table (denoted with LUT ), stores task-wise an array of schedule indices (from A ) which show less attack probabilities w.r.t. a victim task than its TAP. An array of schedule indices stored in the j -th row of LUT is sorted in the increasing order of AP w.r.t. task τ j . For example, if the i 1 , i 2 -th schedules from A (i.e., A [ i 1 ] = s i 1 , A [ i 2 ] = s i 2 ) are stored at k, k ′ -th positions of LUT j [ ] ( j -th row in LUT ) respectively, with k &lt; k ′ , then AP ⟨ τ j ,s i 1 ⟩ &lt; AP &lt;τ ,s j i 2 &gt; ≤ TAP j . In the next section, we discuss the online counterpart of the MAARS framework that uses these stored data structures after the design time analysis for randomized deployment of task execution schedules in an attack-aware manner.

## D. Schedule Selection Algorithm

## Algorithm 1 Runtime Schedule Selection Algorithm

Input Schedule Array A , Schedule vulnerability threshold SV T , Lookup table LUT , Detector flag Atkflag , current schedule s k

̸

̸

![Image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00341v2-figure-ec400dbd-778e-473f-83e8-d3349045dc32.jpg)

The runtime algorithm in the MAARS framework is responsible for randomly deploying schedules in an attack-aware fashion. The runtime schedule selection function SCHEDSEL () in Algo. 1 takes the following inputs, (i) The lookup table LUT and the stored schedule array A , (ii) the χ 2 -detector flag Atkflag , (iii) the schedule vulnerability threshold SV T and (iv) the schedule deployed in the current hyper-period s k . The algorithm starts by storing the schedule index in A , which has the same SVI as the input SVT. We use the INDEXOFSVI () method, which takes the sorted schedule array A and the SV T as inputs to find out this index and store in K (see line 2). In line 3, by using INDEXOF () method we find out the index k of the input schedule s k that is currently deployed. Another variable, k ′ , is also initialised (with -1 ) to store the index of the next schedule. The algorithm has two distinct modes of schedule selection and deployment operations depending on the detector flag Atkflag .

(1) Normal mode: When there are no attack flags raised, i.e., Atkflag = 0 denoting no attack on any control task, the algorithm operates in Normal Mode (lines 5 to 8). In this mode, schedules with SV I less than SV T are randomly

̸

selected from the array A . Line 4 of the algorithm checks if the AtkFlag value is zero. If it is zero, then the algorithm selects a random number in the range [0 , K -1] and stores it in k ′ (see line 6). Since MAARS randomly deploys new non-vulnerable schedules at every hyper-period, the random schedule index k ′ must not match with the currently deployed schedule index k . The algorithm keeps picking another random number until k = k ′ for this purpose. (see the while loop in line 5). The next schedule s k ′ is selected from the k ′ -th row of the schedule array A (see line 8).

̸

(2) Alert Mode: If the χ 2 -detector running inside the control task raises an alarm by detecting an attack ( g k [ ] &gt; Th ⇒ AtkFlag &gt; 0 , see Sec. II-B2) on a control task τ i , the algorithm runs in Alert mode . In this mode, schedules are selected from the schedule array A such that the attack probability for the victim control task τ i is lower than its tolerable attack probability TAP i . In line 9, if AtkFlag is non-zero, we first store its value in i . The value of the Atkflg denotes a potential attack on task τ i . In line 11, we find out the length of the i -th row in LUT and store it in M . This is used to find a random number ki in the range [0 , M -1] (see line 12). This number is then used to get the index of the next schedule k ′ from the ki -th column and i -th row of LUT . Note that each such schedule index picked from LUT satisfies AP &lt;τ , i A ′ k &gt; &lt; TAP i . As stated earlier, this random number selection is repeated if the index of the current schedule k matches with the randomly picked next schedule index k ′ (see the while loop in line 10). We select the schedule s k ′ from the k ′ (= k ) -th row of A (see line 14).

Finally, SCHEDSEL () returns the new schedule s ′ k for deployment. Algo 1 is run once every hyper-period in order to select and deploy new schedules randomly. This online schedule selection is done in an attack-informed way. As a result, the vulnerability level of the task execution schedule is minimized while maintaining the system's performance.

Overhead Analysis: The time complexity of Algo. 1 depends on the complexity of selecting a random number so that it does not match the current value. Since we store the schedules in the sorted orders of SVI and AP in arrays, the algorithm can access them in O (1) . The total memory cost for storing A and LUT can also be calculated, assuming that each element(of the arrays) takes b data bytes. Each schedule, therefore, comprises rows equal to the length of its hyperperiod, say l k for the k -th schedule. Considering a total of M schedules, the total cost is ( ∑ M k =1 l k ) · b bytes. LUT , is stored as a 2-D array of q rows (number of trusted control tasks) and M columns, the cost is qM . Hence, the total memory cost is [ qM + ( ∑ M k =1 l k ) · M ] · b bytes . In the next section, we demonstrate the efficacy of this runtime schedule selection algorithm guided by the design-time analysis in realtime system setup.

## VI. EXPERIMENTAL EVALUATION

Experimental Setup: We experimentally evaluate our proposed MAARS framework in a Hardware-in-Loop (HIL)

Fig. 7: IR in Low Utilization: MAARS (a),(b),(c),(d) and TaskShuffler (e) IR in High Utilization Case: MAARS (f),(g),(h),(i) and TaskShuffler (j)

![Image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00341v2-figure-ce7b4797-7718-4bac-8964-e747a2e41de1.jpg)

testbed and compare it with state-of-the-art (SOTA) approaches against posterior SBAs. The first step of the experiment involves design-time schedule generation and analysis for inferability and vulnerability of safety-critical trusted control tasks. This is performed using MATLAB and Python on an 8-core 7th generation Intel i7 CPU with 16 GB of RAM. The implementations can be found in [21]. In the next step, we perform a run-time analysis of the control tasks under posterior SBA. For this purpose, we employ an ARM-based 32-bit Infineon Tricore Aurix-397 ECU , connected to ETAS Labcar , a Real-time PC (RTPC), via Controller Area Network (CAN). The implementations can be found in [21].

control (CC) system that ensures a desired vehicle speed, and iv) suspension control (SC) system that maintains vehicle suspension across varied roads and driving conditions. All four control tasks' parameters, their respective AEWs, criticality levels, and TAPs are tabulated in Tab. III. The parameters of the untrusted task set are listed in Tab. IV. We have performed the analysis on two different processor utilization scenarios: Low Utilization (LU) ( ≤ 60% with less no. of untrusted tasks, refer to utilization column in Tab. IV) and High utilization (HU) ( ≥ 90%) .

TABLE III: Trusted Task Set Parameters

| Task   | Control Loop   | P i (ms)     |   WCET |   C i |   TAP |   Ω i | Schedules under TAP   |
|--------|----------------|--------------|--------|-------|-------|-------|-----------------------|
| τ 1    | ESP            | { 10,15,25 } |      1 |   0.4 |   0.1 |     3 | 15,68                 |
| τ 2    | TTC            | { 10,15,25 } |      1 |   0.3 |   0.2 |     4 | 122,762               |
| τ 3    | CC             | { 10,25,35 } |      1 |   0.2 |   0.1 |     1 | 72,1088               |
| τ 4    | SC             | { 20,25,30 } |      1 |   0.1 |   0.2 |     8 | 297,4023              |

The physical system/plant is implemented on the RTPC, which sends the sensor measurement to the ECU via CAN, where the control tasks are co-scheduled. Following AUTOSAR mandates [22], we design separate reception tasks to filter and receive sensor IDs transmitted by the ETAS Labcar RTPC over CAN. After processing these sensor data the control tasks (scheduled by fixed-priority preemptive scheduler in the ECU) are executed. Subsequently, corresponding transmission tasks send computed control input through CAN to the RTPC facilitating plant actuation. Our proposed run-time schedule selection process SCHEDSEL () is scheduled to run once during each hyper-period in the same core as the other control tasks on the ECUs. Note that SCHEDSEL () doesn't use data from the buffer; rather, it receives the detector signal in an interrupt-driven manner and provides a new schedule to the scheduler for the next hyperperiod. So the attacker cannot compromise its operations.

TABLE IV: Experiment: Untrusted Task Set

| Task   |   p i (ms) |   e i (ms) | Utilization (Low/High)   |
|--------|------------|------------|--------------------------|
| τ 5    |         10 |          1 | Low, High                |
| τ 6    |         30 |          1 | Low, High                |
| τ 7    |         20 |          1 | Low, High                |
| τ 8    |         30 |          5 | High                     |
| τ 9    |         10 |          2 | High                     |

We implement four distinct automotive controllers similar to the experimental setup in [13], [19]. These control tasks include i) an electronic stability program (ESP), responsible for maintaining yaw stability, ii) trajectory tracking control (TTC) system that regulates deviation from a desired longitudinal trajectory, iii) cruise

(1) Design-time Analysis: To generate a set of securityaware task schedules, first, it is required to synthesize a set of periodicities for the control tasks (Tab. III) that ensures their control performance. To achieve this, we solve the LMIs given in Claim 1 using YALMIP [23] along with Gurobi solver [24]. The performance-preserving set of periodicities of each control task is further pruned following Claim 2 and Remark 1, to derive the secure sampling rates for all the control tasks. The final pruned set of security-aware performance-preserving periodicities P i of each control task are presented in the 3 -rd column of Tab. III). Next, we extend the TaskShuffler algorithm

![Image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00341v2-figure-d9a40c6d-6529-48e8-846f-bad3648da5a9.jpg)

Fig. 8: Average AP: Static Priority Scheduler (Blue), Attack-Unaware Randomization (grey), MAARS (brown)

![Image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00341v2-figure-73a92816-fb98-4a66-858d-e882499fbefb.jpg)

for multi-rate scheduling, as described in Sec. V-B to generate a set S of valid and randomly deployable schedules using P i 's in both HU and LU scenarios. For each victim task in Tab. III, we find the number of schedules for all victim tasks with attack probability under their respective TAPs. The last column of Tab III shows the number of such schedules. Now, using our experimental results, we discuss and show that our proposed randomized schedule generation method outperforms the SOTA in terms of inferability ratio , attack probability , and schedule vulnerability . As SOTA, we consider two cases: i) processor with static priority schedules, and ii) attack-unware randomized schedules are deployed where the set of randomized schedules is generated by TaskShuffler , only considering the minimum sampling rates of each control task. (A) Inferability Ratio (IR): IR of 1 000 , randomized schedules generated by our proposed MAARS framework are presented in Fig. 7a, 7b, 7c, 7d for LU and Fig. 7f, 7g 7h, 7i for HU. The above plots depict the IRs of a certain victim-attacker combination among all possible ones that exhibit the maximum IR. For example, the schedules of τ 1 , τ 2 , and τ 4 show highest inferability for the untrusted task τ 5 and schedules of τ 3 show maximum inferability for the untrusted task τ 6 in case of LU. Fig. 7e and Fig. 7j (the red plots) represents the highest IR among all the victim-attacker combinations when attackunaware randomized schedules are deployed. We can observe that in the case of attack-unaware schedule randomization, most of the randomized schedules show higher IR values compared to the schedules generated by MAARS framework. It implies that MAARS is much better at hiding timing information of safety-critical control tasks than SOTA.

(B) Average Attack Probability: For each schedule in S , we determine the attack probability of each trusted task using Def. 2. For each trusted task τ i , we compute the attack probability AP j i considering the untrusted task τ j . The average attack probability ¯ AP i = ∑ M j =1 AP ⟨ τ i ,s j ⟩ M is computed for each trusted task τ i where M is the total number of schedules generated by MAARS. Fig. 8 shows the average AP for each of the four trusted tasks in Tab. III for both LU and HU. The blue, grey, and brown plots in Fig. 8 represent the average APs in case of the schedules generated by static priority schedule, attack-unaware randomized schedule, and the MAARS framework. We can observe in Fig. 8a, under LU, schedules generated by MAARS (dark brown plot) show 88% and 38 5% . reduction in average AP compared to the static (blue) and SOTA (light grey) respectively. Fig. 8b shows that under HU, schedules generated by MAARS (dark brown plot) show 83 7% . and 47 5% . reduction in average AP compared to the static (blue) and SOTA (light grey), respectively.

Fig. 9: % of schedules under SVT: attack-unaware Randomization (grey), MAARS (brown)

![Image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00341v2-figure-d8e72be1-f01e-4007-8813-c705d4626f87.jpg)

(C) Schedule Vulnerability Index: In Fig. 9, we plot the percentage of schedules out of all the schedules generated by MAARS (in brown) and SOTAs (in grey) that have SVIs below the schedule vulnerability threshold or SVT. The SVT

value calculated with the TAP values corresponding to our control task set (given in Tab. III) is 0 14 . (refer to Sec. V-C). Our results show that in the LU scenario, 68% of MAARS schedules have SV I &lt; SV T compared to only 31% for attack-unaware randomization. Similarly, in the HU scenario, our results show that 52% and 20% schedules have SVI below SVT for MAARS and attack-unaware scheduling, respectively. Therefore, by using MAARS, we can generate more schedules with lower vulnerability against posterior SBAs.

From the above analysis, we can state that our proposed MAARS framework reduces the inferability ratio and vulnerability index of the schedules and attack probabilities of the tasks compared to the SOTAs.

(2) Runtime Deployment in HIL: Since τ 2 exhibits the highest average attack probability (Fig. 8b) and τ 8 has the highest schedule inference capability (Fig. 7g) in HU scenario, henceforth we consider τ 2 to be victim task and τ 8 to be the attacker task. We consider settling time ( t s ) and GUES decay rate ( λ ) metrics to evaluate the plant's performance. To launch the attack, τ 8 executes a malicious code on the same ECU in which τ 2 is implemented. The malicious code overrides the control input data sent to ETAS RTPC via CAN. A windowed χ 2 -detector (window length=1) is implemented along with τ 2 to detect any unnatural deviation in the plant states. The detector's threshold is set to 4 for the false alarm rate (FAR) to be less than 2%. We compare the performance of the TTC system under posterior SBA in Fig. 10 when schedules generated by MAARS are deployed and when a static fixed priority schedule is deployed. In Fig. 10, the green, blue, red, and magenta plots respectively represent the control input acceleration, plant state deviation from the reference trajectory, the detector's threshold, and χ 2 statistics of the detector. Under no SBA, we note t s = 4 3 . s ( &lt; desired t s = 10 ), and λ = 95% when a fixed priority schedule is used in Fig. 10a. However, we can observe in Fig. 10b that the plant becomes unstable due to posterior SBA under the static fixed priority schedule. On the other hand, Fig. 10c shows the behavior of the TTC system under no attack when MAARS is deployed. We can observe t s = 6 s and λ = 93% . Under posterior SBA, the scheduler switches from normal mode to alert mode once χ 2 residue &gt; 4 (red highlighted area in Fig. 10d). In alert mode, we note t s = 9 2 . s and λ = 89% . This implies that the system is resilient against posterior attack when MAARS is deployed and subsequently the performance of the system is preserved.

Fig. 10: Plant Response with TTC: (a),(b) Using static priority scheduler and (c),(d) using MAARS Scheduling Framework

![Image](https://ac.marcodsn.me/arxiv-markdown-images/2408.00341v2-figure-02b82564-90ac-4228-afc1-1dbe016afd54.jpg)

## VII. CONCLUSION

Existing schedule randomization methodologies for secureing real-time task-schedules are attack-unaware, hence susceptible to schedule-based attacks. In this paper we present MAARS framework, a novel attack-aware schedule randomization approach that selects performance-aware multiple sampling rates such that the exposure of task parameters is reduced and the vulnerability against posterior schedule-based attacks are mitigated. Our results show that MAARS framework is effective in reducing inferability of critical trusted task parameters, while also reducing posterior attack probability.

In future, we aim to extend this work for multiprocessor systems to provide security against other practical schedulebased attacks.

## REFERENCES

- [1] S. K. Baruah, A. Burns, and R. I. Davis, 'Response-time analysis for mixed criticality systems,' in 2011 IEEE 32nd Real-Time Systems Symposium , pp. 34-43, IEEE, 2011.
- [2] E. Bini et al. , 'Delay-aware period assignment in control systems,' in RTSS , IEEE, 2008.
- [3] N. Prates, A. Verg¨ utz, R. T. Macedo, A. Santos, and M. Nogueira, 'A defense mechanism for timing-based side-channel attacks on iot traffic,' in GLOBECOM 2020-2020 IEEE Global Communications Conference , pp. 1-6, IEEE, 2020.
- [4] C.-Y. Chen, S. Mohan, R. Pellizzoni, R. B. Bobba, and N. Kiyavash, 'A novel side-channel in real-time schedulers,' in 2019 IEEE Real-Time and Embedded Technology and Applications Symposium (RTAS) , pp. 90-102, IEEE, 2019.
- [5] J. Chen, T. Kloda, R. Tabish, A. Bansal, C.-Y. Chen, B. Liu, S. Mohan, M. Caccamo, and L. Sha, 'Schedguard++: Protecting against schedule leaks using linux containers on multi-core processors,' ACM Trans. Cyber-Phys. Syst. , 2022.
- [6] J. Ren, C. Liu, C. Lin, R. Bi, S. Li, Z. Wang, Y. Qian, Z. Zhao, and G. Tan, 'Protection window based security-aware scheduling against schedule-based attacks,' ACM Transactions on Embedded Computing Systems , vol. 22, no. 5s, pp. 1-22, 2023.
- [7] M.-K. Yoon, S. Mohan, C.-Y. Chen, and L. Sha, 'Taskshuffler: A schedule randomization protocol for obfuscation against timing inference attacks in real-time systems,' in 2016 IEEE Real-Time and Embedded Technology and Applications Symposium (RTAS) , pp. 1-12, IEEE, 2016.
- [8] K. Kr¨ uger, M. Volp, and G. Fohler, 'Vulnerability analysis and mitigation of directed timing inference based attacks on time-triggered systems,' LIPIcs-Leibniz International Proceedings in Informatics , vol. 106, p. 22, 2018.
- [9] M. Nasri, T. Chantem, G. Bloom, and R. M. Gerdes, 'On the pitfalls and vulnerabilities of schedule randomization against schedule-based attacks,' in 2019 IEEE Real-Time and Embedded Technology and Applications Symposium (RTAS) , pp. 103-116, IEEE, 2019.
- [10] C.-Y. Chen, D. Sanyal, and S. Mohan, 'Indistinguishability prevents scheduler side channels in real-time systems,' in Proceedings of the 2021 ACM SIGSAC Conference on Computer and Communications Security , pp. 666-684, 2021.
- [11] D. Henriksson and A. Cervin, 'Optimal on-line sampling period assignment for real-time control tasks based on plant state information,' in Proceedings of the 44th IEEE Conference on Decision and Control , pp. 4469-4474, IEEE, 2005.
- [12] M. Schinkel et al. , 'Optimal control for systems with varying sampling rate,' in ACC , IEEE, 2002.
- [13] S. Adhikary et al. , 'Work-in-progress: Control skipping sequence synthesis to counter schedule-based attacks,' in RTSS , IEEE, 2022.
- [14] A. Sain, S. Singh, S. Adhikary, I. Koley, and S. Dey, 'Work-inprogress: Securing safety-critical control tasks with attack-aware multirate scheduling,' in 2023 IEEE 29th Real-Time and Embedded Technology and Applications Symposium (RTAS) , pp. 345-348, IEEE, 2023.
- [15] D. Liberzon and A. S. Morse, 'Basic problems in stability and design of switched systems,' IEEE control systems magazine , vol. 19, no. 5, pp. 59-70, 1999.
- [16] M. Zamani, S. Dey, S. Mohamed, P. Dasgupta, and M. Mazo, 'Scheduling of controllers' update-rates for residual bandwidth utilization,' in Formal Modeling and Analysis of Timed Systems: 14th International Conference, FORMATS 2016, Quebec, QC, Canada, August 24-26, 2016, Proceedings 14 , pp. 85-101, Springer, 2016.
- [17] V. M. Moraes, M. Jungers, U. F. Moreno, and E. B. Castelan, 'Sampling period assignment: A cooperative design approach,' in 53rd IEEE Conference on Decision and Control , pp. 4361-4366, IEEE, 2014.
- [18] M. Schinkel and A. Rantzer, 'Sample data control with varyingsampling time,' in 2001 European Control Conference (ECC) , pp. 624-628, IEEE, 2001.
- [19] I. Koley, S. Adhikary, and S. Dey, 'Catch me if you learn: real-time attack detection and mitigation in learning enabled cps,' in 2021 IEEE Real-Time Systems Symposium (RTSS) , pp. 136-148, IEEE, 2021.
- [20] J. Lee and J. Lee, 'Mc-flex: Flexible mixed-criticality real-time scheduling by task-level mode switch,' IEEE Transactions on Computers , vol. 71, no. 8, pp. 1889-1902, 2021.
- [21] 'Anonymous Git Repo.' https://anonymous.4open.science/r/RTSS 2024-4551, 2024.
- [22] S. F¨ urst, J. M¨ ossinger, S. Bunzel, T. Weber, F. Kirschke-Biller, P. Heitk¨ amper, G. Kinkelin, K. Nishikawa, and K. Lange, 'Autosar-a worldwide standard is on the road,' in 14th International VDI Congress Electronic Systems for Vehicles, Baden-Baden , vol. 62, Citeseer, 2009.
- [23] J. Lofberg, 'Yalmip: A toolbox for modeling and optimization in matlab,' in 2004 IEEE international conference on robotics and automation (IEEE Cat. No. 04CH37508) , pp. 284-289, IEEE, 2004.
- [24] L. Gurobi Optimization, 'Gurobi optimizer reference manual,' 2021.
Arkaprava Sain Sunandan Adhikary Ipsita Koley Soumyajit Dey
Enhancing Attack Resilience in Real-Time Systems through Variable Control Task Sampling Rates
Cyber-physical systems (CPSs) in modern real-time applications integrate
numerous control units linked through communication networks, each responsible
for executing a mix of real-time safety-critical and non-critical tasks. To
ensure predictable timing behaviour, most safety-critical tasks are scheduled
with fixed sampling periods, which supports rigorous safety and performance
analyses. However, this deterministic execution can be exploited by attackers
to launch inference-based attacks on safety-critical tasks. This paper
addresses the challenge of preventing such timing inference or schedule-based
attacks by dynamically adjusting the execution rates of safety-critical tasks
while maintaining their performance. We propose a novel schedule vulnerability
analysis methodology, enabling runtime switching between valid schedules for
various control task sampling rates. Leveraging this approach, we present the
Multi-Rate Attack-Aware Randomized Scheduling (MAARS) framework for preemptive
fixed-priority schedulers, designed to reduce the success rate of timing
inference attacks on real-time systems. To our knowledge, this is the first
method that combines attack-aware schedule randomization with preserved control
and scheduling integrity. The framework's efficacy in attack prevention is
evaluated on automotive benchmarks using a Hardware-in-the-Loop (HiL) setup.