Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

num_req_outstanding might overflow in tlul_socket_1n #10328

Closed
nodix95 opened this issue Jan 25, 2022 · 8 comments
Closed

num_req_outstanding might overflow in tlul_socket_1n #10328

nodix95 opened this issue Jan 25, 2022 · 8 comments
Assignees
Labels
Component:RTL Component:Security Earlgrey-PROD Candidate Temporary label to triage issues into Earlgrey-PROD Milestones IP:tlul Priority:P2 Priority: medium triaged-security

Comments

@nodix95
Copy link

nodix95 commented Jan 25, 2022

Suppose a host has one outstanding request to some peripheral. In that case, the host's 1:N socket will have its num_req_outstanding set to "1" and dev_select_outstanding pointing to the appropriate device. The device responds by raising the d_valid signal, which is considered accepted if the host's d_ready signal is also HIGH. If the response is accepted, num_req_outstanding decrements to "0", and assuming the host is not making any new requests, dev_select_outstanding retains its previous value.

If the peripheral continues holding the d_valid signal HIGH, a new "response" might be registered by the socket if the d_ready signal is still HIGH (as is always the case with e.g. the main core). This is because the response routing logic only takes the dev_select_outstanding signal into account:

  always_comb begin
    tl_t_p = tl_u_i[N];
    for (int idx = 0 ; idx < N ; idx++) begin
      if (dev_select_outstanding == NWD'(idx)) tl_t_p = tl_u_i[idx];
    end
  end

This extra response will then get registered as accepted and gets forwarded to the host. More importantly, the num_req_outstanding gets decremented again resulting in an overflow, which then raises the hold_all_requests signal, essentially blocking the host from making any further requests to the crossbar.

I have managed to create this scenario by adding a corrupted peripheral to the system for the purposes of my research:

image

Even though this behavior is not anticipated from any of the peripheral devices during normal operation, I think a small change of the response routing logic code would add to the security of the system, like for example:

  always_comb begin
    tl_t_p = tl_u_i[N];
    for (int idx = 0 ; idx < N ; idx++) begin
      if (dev_select_outstanding == NWD'(idx) && num_req_outstanding != '0) tl_t_p = tl_u_i[idx];
    end
  end
@msfschaffner msfschaffner added Priority:P3 Priority: low Priority:P2 Priority: medium and removed Priority:P3 Priority: low labels Feb 11, 2022
@msfschaffner msfschaffner added this to the Project: M2 milestone Feb 11, 2022
@tjaychen
Copy link

that's a reasonable change although I'm not quite sure what security this would add to the system.
Are you worried about a denial of service..?

@nodix95 nodix95 closed this as completed Feb 11, 2022
@nodix95 nodix95 reopened this Feb 11, 2022
@nodix95
Copy link
Author

nodix95 commented Feb 11, 2022

Yes, exactly. Denial of service of a host in the system.

@eunchan
Copy link
Contributor

eunchan commented Feb 11, 2022

The attack scenario, even with the changes, cannot be prevented in my opinion. As d_valid somehow was corrupted already, the transactions are not paired anymore.

The list goes on and on to completely block this attack. I think it would be simpler to rely on Watchdog timer in this case as the crossbar hangs.

@tjaychen
Copy link

yeah i tend to agree with @eunchan. The denial of service of type attacks are not something we really cover.
Because someone could attack the clock, the processor, the memory etc and the results would all be the same.

Still I think this particular enhancement is not cumbersome, i could just absorb it.

@tjaychen tjaychen added Type:FutureRelease Not relevant to currently planned releases/milestones and removed Type:Enhancement Feature requests, enhancements labels Apr 15, 2022
@msfschaffner
Copy link
Contributor

@msfschaffner

@tjaychen
Copy link

This is not something we are going to address for M3 since it is a guard against something that is not really in scope.
The thread is acknowledged, but we will probably want to find a more holistic ways to tackle issues like these.

@tjaychen tjaychen modified the milestones: Project: M3, Backlog Jan 12, 2023
@andreaskurth
Copy link
Contributor

Triaged for tlul. Keeping Type:FutureRelease Not relevant to currently planned releases/milestones as per the last comment.

@msfschaffner msfschaffner added the Earlgrey-PROD Candidate Temporary label to triage issues into Earlgrey-PROD Milestones label Oct 6, 2023
@msfschaffner msfschaffner added the Hotlist:Security Security Opinion Needed label Nov 3, 2023
@msfschaffner msfschaffner modified the milestones: Backlog, Earlgrey-PROD.M3 Nov 3, 2023
@johannheyszl johannheyszl added triaged-security and removed Hotlist:Security Security Opinion Needed Type:FutureRelease Not relevant to currently planned releases/milestones labels Dec 12, 2023
@vogelpi
Copy link
Contributor

vogelpi commented Dec 19, 2023

I am closing this issue as not planned as it adds marginal defense against something that is not in scope anyway (denial of service on bus).

@vogelpi vogelpi closed this as not planned Won't fix, can't repro, duplicate, stale Dec 19, 2023
This was referenced Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component:RTL Component:Security Earlgrey-PROD Candidate Temporary label to triage issues into Earlgrey-PROD Milestones IP:tlul Priority:P2 Priority: medium triaged-security
Projects
None yet
Development

No branches or pull requests

8 participants