repo_name
stringlengths
1
62
dataset
stringclasses
1 value
lang
stringclasses
11 values
pr_id
int64
1
20.1k
owner
stringlengths
2
34
reviewer
stringlengths
2
39
diff_hunk
stringlengths
15
262k
code_review_comment
stringlengths
1
99.6k
ai-pr-reviewer
github_2023
typescript
5
coderabbitai
github-actions[bot]
@@ -117,17 +117,104 @@ export const codeReview = async ( if (files_to_review.length > 0) { const commenter: Commenter = new Commenter() - const [, review_begin_ids] = await bot.chat( - prompts.render_review_beginning(inputs), - {} - ) - let next_review_ids = review_begin_ids - + // Summa...
:robot: ChatGPT This patch adds a new feature to the code review process, which generates release notes and adds them to the PR description. The implementation looks good and well-structured. However, it would be better to add some error handling for the case when the tag is not found in the PR description. LGTM! <!-...
ai-pr-reviewer
github_2023
typescript
5
coderabbitai
github-actions[bot]
@@ -175,17 +262,6 @@ export const codeReview = async ( } else { next_review_ids = review_diff_ids } - - // summarize diff - const [summarize_resp, summarize_diff_ids] = await bot.chat( - prompts.render_summarize_file_diff(inputs), - next_summari...
:robot: ChatGPT This patch removes the code that summarizes the diff of each file. It seems like a reasonable decision to remove this feature, as it may not be necessary for every file and could potentially slow down the review process. LGTM! <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
typescript
5
coderabbitai
github-actions[bot]
@@ -232,76 +308,10 @@ export const codeReview = async ( } } } - // final summary - const [summarize_final_response, summarize_final_response_ids] = - await bot.chat(prompts.render_summarize(inputs), next_summarize_ids) - if (!summarize_final_response) { - core.info('summarize: no...
:robot: ChatGPT This patch removes the code that generates the final summary and release notes. It seems like a reasonable decision to remove this feature, as it may not be necessary for every review and could potentially slow down the review process. LGTM! <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
others
5
coderabbitai
github-actions[bot]
@@ -1,5 +1,7 @@ # ChatGPT based PR reviewer and summarizer +![AI](./docs/images/ai.png) + ## Overview This [ChatGPT](https://platform.openai.com/docs/guides/chat) based GitHub Action provides a summary, release notes and review of pull requests. The prompts have been tuned for concise response. To prevent excess...
:robot: ChatGPT LGTM! The developer has added an AI image to the README, which is a nice touch. <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
others
5
coderabbitai
github-actions[bot]
@@ -173,7 +175,6 @@ Set `debug: true` in the workflow file to enable debug mode, which will show the ### Special Thanks -This GitHub Action is based on +This GitHub Action is based on [ChatGPT Action](https://github.com/unsafecoerce/chatgpt-pr-reviewer) by [Tao He](https://github.com/sighingnow).
:robot: ChatGPT LGTM! The removal of the extra line improves readability. <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
typescript
5
coderabbitai
github-actions[bot]
@@ -147,7 +153,7 @@ export class Options { review_comment_lgtm = false, path_filters: string[] | null = null, system_message = '', - temperature = '0.2' + temperature = '0.0' ) { this.debug = debug this.chatgpt_reverse_proxy = chatgpt_reverse_proxy
:robot: ChatGPT This patch modifies the `Options` class constructor to set the default temperature value to 0.0 instead of 0.2. It seems reasonable and does not introduce any new issues. LGTM! <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
typescript
5
coderabbitai
github-actions[bot]
@@ -212,7 +288,8 @@ export const codeReview = async ( continue } next_review_ids = patch_ids - if (!options.review_comment_lgtm && response.includes('LGTM')) { + // if the response contains LGTM (case insensitive), then skip commenting + if (!options.review_comment_lgtm...
:robot: ChatGPT The patch improves the `codeReview` function by making it case-insensitive when checking for the "LGTM" response. This is a good improvement as it makes the code more robust and flexible. LGTM! <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
typescript
5
coderabbitai
github-actions[bot]
@@ -232,76 +309,10 @@ export const codeReview = async ( } } } - // final summary - const [summarize_final_response, summarize_final_response_ids] = - await bot.chat(prompts.render_summarize(inputs), next_summarize_ids) - if (!summarize_final_response) { - core.info('summarize: no...
:robot: ChatGPT The patch removes the `summarize_final_response` and `release_notes_response` functionality from the `codeReview` function. This is a good improvement as it reduces code duplication and makes the function more focused on its main purpose. LGTM! <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
others
5
coderabbitai
github-actions[bot]
@@ -26,4 +26,4 @@ jobs: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} with: debug: true - review_comment_lgtm: true + review_comment_lgtm: false
:robot: ChatGPT LGTM! This patch sets the `review_comment_lgtm` flag to false, which will prevent the bot from automatically commenting "LGTM" on pull requests. This seems like a reasonable change. <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
typescript
5
coderabbitai
github-actions[bot]
@@ -212,7 +288,8 @@ export const codeReview = async ( continue } next_review_ids = patch_ids - if (!options.review_comment_lgtm && response.includes('LGTM')) { + // if the response contains LGTM (case insensitive), then skip commenting + if (!options.review_comment_lgtm...
:robot: ChatGPT The code looks good. However, the regular expression used to match "LGTM" is case-insensitive, which may result in false positives if there are other words that contain "lgtm". Consider using a more specific regular expression or checking for an exact match of "LGTM". <!-- This is an auto-generated co...
ai-pr-reviewer
github_2023
others
6
coderabbitai
github-actions[bot]
@@ -26,4 +26,4 @@ jobs: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} with: debug: true - review_comment_lgtm: true + review_comment_lgtm: false
:robot: ChatGPT This patch changes the `review_comment_lgtm` flag from `true` to `false`. This means that the LGTM (Looks Good To Me) comment will not be automatically added to the pull request when the review is approved. LGTM! <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
others
6
coderabbitai
github-actions[bot]
@@ -1,5 +1,7 @@ # ChatGPT based PR reviewer and summarizer +![AI](./docs/images/ai.png) + ## Overview This [ChatGPT](https://platform.openai.com/docs/guides/chat) based GitHub Action provides a summary, release notes and review of pull requests. The prompts have been tuned for concise response. To prevent excess...
:robot: ChatGPT This patch adds an AI image to the README.md file. No bug risk or improvement suggestion found. LGTM! <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
others
6
coderabbitai
github-actions[bot]
@@ -173,7 +175,6 @@ Set `debug: true` in the workflow file to enable debug mode, which will show the ### Special Thanks -This GitHub Action is based on +This GitHub Action is based on [ChatGPT Action](https://github.com/unsafecoerce/chatgpt-pr-reviewer) by [Tao He](https://github.com/sighingnow).
:robot: ChatGPT This patch removes an unnecessary line break. No bug risk or improvement suggestion found. LGTM! <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
typescript
6
coderabbitai
github-actions[bot]
@@ -75,6 +75,7 @@ export class Inputs { system_message: string title: string description: string + summary: string filename: string file_content: string file_diff: string
:robot: ChatGPT This patch modifies the `Inputs` class to add a new field called `summary`. This change looks good and acceptable. LGTM! <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
typescript
6
coderabbitai
github-actions[bot]
@@ -85,6 +86,7 @@ export class Inputs { system_message = '', title = '', description = '', + summary = '', filename = '', file_content = '', file_diff = '',
:robot: ChatGPT This patch modifies the constructor of the `Inputs` class to include the new `summary` field. This change looks good and acceptable. LGTM! <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
typescript
6
coderabbitai
github-actions[bot]
@@ -94,6 +96,7 @@ export class Inputs { this.system_message = system_message this.title = title this.description = description + this.summary = summary this.filename = filename this.file_content = file_content this.file_diff = file_diff
:robot: ChatGPT This patch modifies the constructor of the `Inputs` class to set the value of the new `summary` field. This change looks good and acceptable. LGTM! <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
typescript
6
coderabbitai
github-actions[bot]
@@ -114,6 +117,9 @@ export class Inputs { if (this.description) { content = content.replace('$description', this.description) } + if (this.summary) { + content = content.replace('$summary', this.summary) + } if (this.filename) { content = content.replace('$filename', this.filenam...
:robot: ChatGPT This patch modifies the `render` method of the `Inputs` class to handle the new `summary` field. This change looks good and acceptable. LGTM! <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
typescript
6
coderabbitai
github-actions[bot]
@@ -147,7 +153,7 @@ export class Options { review_comment_lgtm = false, path_filters: string[] | null = null, system_message = '', - temperature = '0.2' + temperature = '0.0' ) { this.debug = debug this.chatgpt_reverse_proxy = chatgpt_reverse_proxy
:robot: ChatGPT This patch modifies the `Options` class to set the default value of the `temperature` field to 0.0 instead of 0.2. This change looks good and acceptable. LGTM! <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
typescript
6
coderabbitai
github-actions[bot]
@@ -117,17 +117,104 @@ export const codeReview = async ( if (files_to_review.length > 0) { const commenter: Commenter = new Commenter() - const [, review_begin_ids] = await bot.chat( - prompts.render_review_beginning(inputs), - {} - ) - let next_review_ids = review_begin_ids - + // Summa...
:robot: ChatGPT This patch adds a new feature to summarize the diff and generate release notes using ChatGPT. The code looks good, but it would be better to add some error handling for the case when `inputs.description` is undefined. Also, it would be helpful to add some comments to explain the purpose of each section...
ai-pr-reviewer
github_2023
typescript
6
coderabbitai
github-actions[bot]
@@ -175,17 +262,6 @@ export const codeReview = async ( } else { next_review_ids = review_diff_ids } - - // summarize diff - const [summarize_resp, summarize_diff_ids] = await bot.chat( - prompts.render_summarize_file_diff(inputs), - next_summari...
:robot: ChatGPT This patch removes the code that summarizes the diff for each file. It seems like this is intentional and part of a larger change to move the diff summarization to a separate stage. The code looks good. LGTM! <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
typescript
6
coderabbitai
github-actions[bot]
@@ -232,76 +308,10 @@ export const codeReview = async ( } } } - // final summary - const [summarize_final_response, summarize_final_response_ids] = - await bot.chat(prompts.render_summarize(inputs), next_summarize_ids) - if (!summarize_final_response) { - core.info('summarize: no...
:robot: ChatGPT This patch removes the final summary and release notes generation code from the `codeReview` function. It seems like this is intentional and part of a larger change to move the diff summarization to a separate stage. The code looks good. LGTM! <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
javascript
4
coderabbitai
github-actions[bot]
@@ -26762,7 +26762,7 @@ var ChatGPTUnofficialProxyAPI = class { constructor(opts) { const { accessToken, - apiReverseProxyUrl = "https://chat.duti.tech/api/conversation", + apiReverseProxyUrl = "https://bypass.duti.tech/api/conversation", model = "text-davinci-002-render-sha", deb...
:robot: ChatGPT LGTM! The change seems reasonable and does not introduce any new issues. <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
javascript
4
coderabbitai
github-actions[bot]
@@ -28663,15 +28663,17 @@ class Inputs { system_message; title; description; + summary; filename; file_content; file_diff; patch; diff; - constructor(system_message = '', title = '', description = '', filename = '', file_content = '', file_diff = '', patch = '', diff = '') ...
:robot: ChatGPT LGTM! The addition of the `summary` field to the `Inputs` class seems reasonable and does not introduce any new issues. <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
javascript
4
coderabbitai
github-actions[bot]
@@ -28691,6 +28693,9 @@ class Inputs { if (this.description) { content = content.replace('$description', this.description); } + if (this.summary) { + content = content.replace('$summary', this.summary); + } if (this.filename) { content = cont...
:robot: ChatGPT LGTM! The addition of the `summary` field to the `Inputs` class and its replacement in the `content` string seems reasonable and does not introduce any new issues. <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
javascript
4
coderabbitai
github-actions[bot]
@@ -29093,10 +29098,87 @@ const codeReview = async (bot, options, prompts) => { } if (files_to_review.length > 0) { const commenter = new Commenter(); - const [, review_begin_ids] = await bot.chat(prompts.render_review_beginning(inputs), {}); - let next_review_ids = review_begin_ids; + ...
:robot: ChatGPT LGTM! The addition of the summary stage to `codeReview` function that summarizes each file's diff and generates release notes for the PR seems reasonable and does not introduce any new issues. <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
javascript
4
coderabbitai
github-actions[bot]
@@ -29130,14 +29212,6 @@ const codeReview = async (bot, options, prompts) => { else { next_review_ids = review_diff_ids; } - // summarize diff - const [summarize_resp, summarize_diff_ids] = await bot.chat(prompts.re...
:robot: ChatGPT Improvement Suggestion: It seems that the `summarize diff` stage is removed from the `codeReview` function. It might be useful to keep this stage to provide more detailed information about the changes made in each file. <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
javascript
4
coderabbitai
github-actions[bot]
@@ -29170,68 +29244,9 @@ const codeReview = async (bot, options, prompts) => { } } } - // final summary - const [summarize_final_response, summarize_final_response_ids] = await bot.chat(prompts.render_summarize(inputs), next_summarize_ids); - if (!summarize_fi...
:robot: ChatGPT Improvement Suggestion: It seems that the final summary and release notes stages are removed from the `codeReview` function. It might be useful to keep these stages to provide a summary of all changes made in the PR and generate release notes for the PR. <!-- This is an auto-generated comment by Cha...
ai-pr-reviewer
github_2023
others
4
coderabbitai
github-actions[bot]
@@ -26,4 +26,3 @@ jobs: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} with: debug: true
:robot: ChatGPT Patch review for `.github/workflows/chatgpt-review.yml`: The patch removes the `review_comment_lgtm` flag from the `with` section of the `chatgpt-review.yml` workflow file. This flag was previously used to automatically add an LGTM comment to pull requests that passed the review process. This change...
ai-pr-reviewer
github_2023
typescript
4
coderabbitai
github-actions[bot]
@@ -75,6 +75,7 @@ export class Inputs { system_message: string title: string description: string + summary: string filename: string file_content: string file_diff: string
:robot: ChatGPT This patch adds a new `summary` field to the `Inputs` class. The changes seem reasonable and necessary for the new stage that was added in this pull request. The addition of the `summary` field will allow the summary of changes made during the code review process to be included in the release notes of ...
ai-pr-reviewer
github_2023
typescript
4
coderabbitai
github-actions[bot]
@@ -85,6 +86,7 @@ export class Inputs { system_message = '', title = '', description = '', + summary = '', filename = '', file_content = '', file_diff = '',
:robot: ChatGPT This patch updates the constructor of the `Inputs` class to include the new `summary` field. The changes seem appropriate and necessary for the new stage that was added in this pull request. LGTM! <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
typescript
4
coderabbitai
github-actions[bot]
@@ -94,6 +96,7 @@ export class Inputs { this.system_message = system_message this.title = title this.description = description + this.summary = summary this.filename = filename this.file_content = file_content this.file_diff = file_diff
:robot: ChatGPT This patch updates the constructor of the `Inputs` class to set the new `summary` field. The changes seem appropriate and necessary for the new stage that was added in this pull request. LGTM! <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
typescript
4
coderabbitai
github-actions[bot]
@@ -114,6 +117,9 @@ export class Inputs { if (this.description) { content = content.replace('$description', this.description) } + if (this.summary) { + content = content.replace('$summary', this.summary) + } if (this.filename) { content = content.replace('$filename', this.filenam...
:robot: ChatGPT This patch updates the `render` function of the `Inputs` class to include the new `summary` field. The changes seem appropriate and necessary for the new stage that was added in this pull request. LGTM! <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
typescript
4
coderabbitai
github-actions[bot]
@@ -117,17 +117,104 @@ export const codeReview = async ( if (files_to_review.length > 0) { const commenter: Commenter = new Commenter() - const [, review_begin_ids] = await bot.chat( - prompts.render_review_beginning(inputs), - {} - ) - let next_review_ids = review_begin_ids - + // Summa...
:robot: ChatGPT The patch looks good. However, I suggest breaking down the `codeReview` function into smaller, more focused functions for easier testing and maintenance. Also, use destructuring assignment to simplify object access. Finally, add error handling for all async functions, especially those that interact wit...
ai-pr-reviewer
github_2023
typescript
4
coderabbitai
github-actions[bot]
@@ -175,17 +262,6 @@ export const codeReview = async ( } else { next_review_ids = review_diff_ids } - - // summarize diff - const [summarize_resp, summarize_diff_ids] = await bot.chat( - prompts.render_summarize_file_diff(inputs), - next_summari...
:robot: ChatGPT The patch looks good. However, I suggest adding a comment explaining why the `summarize_diff` step was removed. <!-- This is an auto-generated comment by ChatGPT -->
ai-pr-reviewer
github_2023
typescript
4
coderabbitai
github-actions[bot]
@@ -232,76 +308,10 @@ export const codeReview = async ( } } } - // final summary - const [summarize_final_response, summarize_final_response_ids] = - await bot.chat(prompts.render_summarize(inputs), next_summarize_ids) - if (!summarize_final_response) { - core.info('summarize: no...
:robot: ChatGPT The patch looks good. However, I suggest adding a comment explaining why the `summarize_final_response` and `release_notes_response` steps were removed. <!-- This is an auto-generated comment by ChatGPT -->
yakGPT
github_2023
typescript
63
yakGPT
yakGPT
@@ -16,34 +17,45 @@ export const startRecording = async (router: NextRouter) => { clearTimeout(get().recorderTimeout); const { apiKeyAzure, apiKeyAzureRegion } = get(); - let lastTextUpdate = ""; + let textUpdates: string[] = []; - const updateText = (text: string, persist: boolean) => { - // Remove pre...
Ha, great catch, appears I completely overcomplicated this!
honox
github_2023
typescript
252
honojs
yusukebe
@@ -33,7 +33,7 @@ export const Script = (options: Options): any => { <script type='module' async={!!options.async} - src={`/${scriptInManifest.file}`} + src={`${import.meta.env.BASE_URL}${scriptInManifest.file}`}
Should we support without a trailing slash pattern? ```ts defineConfig({ base: '/subdir' // does not have a trailing slash }) ```
honox
github_2023
typescript
253
honojs
yusukebe
@@ -217,18 +217,18 @@ export function islandComponents(options?: IslandComponentsOptions): Plugin { root = config.root if (!reactApiImportSource) { - const tsConfigPath = path.resolve(process.cwd(), 'tsconfig.json') - const denoJsonPath = path.resolve(process.cwd(), 'deno.json') - l...
I think this `console.warn()` is okay!
honox
github_2023
typescript
181
honojs
yusukebe
@@ -0,0 +1,38 @@ +import type { FC } from 'hono/jsx' +import type { Manifest } from 'vite' + +type Options = { manifest?: Manifest; prod: boolean } & JSX.IntrinsicElements['link']
Should `prod` be `prod?`?
honox
github_2023
typescript
176
honojs
usualoma
@@ -29,20 +29,22 @@ export type ClientOptions = { */ triggerHydration?: TriggerHydration ISLAND_FILES?: Record<string, () => Promise<unknown>> + /** + * @deprecated + */ island_root?: string } export const createClient = async (options?: ClientOptions) => { const FILES = options?.ISLAND_FILES ?...
It has nothing to do with this PR change, In `matchIslandComponentId()`, only `.tsx` matches (`.ts does not), so I think only `.tsx` should be used here as well. https://github.com/honojs/honox/pull/176/files#diff-4b7b8acce4bb320abe3a28d1bb85d7ad346253af647225df7e62d19891192a27R25
honox
github_2023
typescript
171
honojs
usualoma
@@ -52,6 +52,18 @@ function isComponentName(name: string) { return /^[A-Z][A-Z0-9]*[a-z][A-Za-z0-9]*$/.test(name) } +/** + * Matches when id is the filename of Island component + * + * @param id - The id to match + * @returns The result object if id is matched or null + */ +export function matchIslandComponentId(...
Is it intended that there is no `/` under `routes` ? If not, I think it should be added. ```suggestion /(\/islands\/.+?\.tsx$)|(\/routes\/.*\_[a-zA-Z0-9[-]+\.island\.tsx$)|(\/routes\/.*\/\$[a-zA-Z0-9[-]+\.tsx$)/ ``` We might also want to take this opportunity to review our existing regular expressions as we...
honox
github_2023
typescript
168
honojs
yusukebe
@@ -62,6 +63,11 @@ export const createApp = <E extends Env>(options: BaseServerOptions<E>): Hono<E> const app = options.app ?? new Hono() const trailingSlash = options.trailingSlash ?? false + // Share context by AsyncLocalStorage + app.use(async function ShareContext(c, next) {
This is cool! Only a few code can adapt `AsyncLocalStorage` to a Hono app.
honox
github_2023
typescript
163
honojs
yusukebe
@@ -29,27 +29,34 @@ import { memberExpression, importDeclaration, importSpecifier, + exportNamedDeclaration, + exportSpecifier, } from '@babel/types' import { parse as parseJsonc } from 'jsonc-parser' // eslint-disable-next-line node/no-extraneous-import import type { Plugin } from 'vite' -function add...
I think the component name is `/^[A-Z][A-Za-z0-9]+/`. What do you think?
honox
github_2023
typescript
151
honojs
yusukebe
@@ -197,25 +197,46 @@ export type IslandComponentsOptions = { isIsland: IsIsland } +function getIslandComponentName( + root: string, + id: string, + options?: IslandComponentsOptions +): string | null { + const defaultIsIsland: IsIsland = (id) => { + const islandDirectoryPath = path.join(root, 'app') + ...
I think `?not-island` or `?inside-island` is better than `?no-island`. How about you?
honox
github_2023
typescript
81
honojs
yusukebe
@@ -30,10 +30,80 @@ export default WrappedBadge;` `const AsyncComponentOriginal = async function () { return <h1>Hello</h1>; }; -const WrappedAsyncComponent = async function (props) { +const WrappedAsyncComponent = function (props) { return import.meta.env.SSR ? <honox-island component-name="AsyncComponen...
It's good to test the utility function too!
honox
github_2023
others
67
honojs
yusukebe
@@ -466,6 +466,25 @@ export const POST = createRoute(zValidator('form', schema), async (c) => { }) ``` +Alternatively, you can use a `_middleware.(ts|tsx)` file in a directory to have that middleware applied to the current route, as well as all child routes. Middleware is ran in the order that it is listed within t...
I know it's a small detail, but wouldn't `/app/_middleware.ts` be better here?
cheriot-rtos
github_2023
cpp
468
CHERIoT-Platform
rmn30
@@ -863,22 +863,53 @@ __cheriot_minimum_stack(0x90) ssize_t return cap->quota; } -__cheriot_minimum_stack(0xd0) int heap_quarantine_empty() +__cheriot_minimum_stack(0xd0) int heap_quarantine_flush(Timeout *timeout) { STACK_CHECK(0xd0);
Aside: now that we have `__cheriot_minimum_stack__` can we introduce a variant of this macro that doesn't need repeat the stack size?
cheriot-rtos
github_2023
cpp
468
CHERIoT-Platform
rmn30
@@ -291,17 +291,36 @@ ssize_t __cheri_compartment("allocator") heap_quota_remaining(AllocatorCapability heapCapability); /** - * Block until the quarantine is empty. + * Try to empty the quarantine and defragment the heap. * - * This should be used only in testing, to place the system in a quiesced - * state. ...
```suggestion * This will start a revocation sweep and then try to empty the quarantine. In ```
cheriot-rtos
github_2023
cpp
468
CHERIoT-Platform
rmn30
@@ -291,17 +291,36 @@ ssize_t __cheri_compartment("allocator") heap_quota_remaining(AllocatorCapability heapCapability); /** - * Block until the quarantine is empty. + * Try to empty the quarantine and defragment the heap. * - * This should be used only in testing, to place the system in a quiesced - * state. ...
Could mark this deprecated and add a new version called `heap_quarantine_flush_block_forever`? Hopefully that's a sufficiently scary name to discourage inappropriate use and also consistent with naming convention?
cheriot-rtos
github_2023
cpp
468
CHERIoT-Platform
nwf
@@ -863,22 +863,54 @@ __cheriot_minimum_stack(0x90) ssize_t return cap->quota; } -__cheriot_minimum_stack(0xd0) int heap_quarantine_empty() +__cheriot_minimum_stack(0xd0) int heap_quarantine_flush(Timeout *timeout) { STACK_CHECK(0xd0); - LockGuard g{lock}; - while (gm->heapQuarantineSize > 0) + + if (!check_tim...
This probably wants to be repeated, like `while (gm->quarantine_dequeue()) { ; }`, possibly with a notion of time elapsing, because there may be lots of (that is, more than 4) objects for us to remove from quarantine before we need to kick and wait for any revocation passes to take place. We should re-check `gm->heapQ...
cheriot-rtos
github_2023
cpp
468
CHERIoT-Platform
rmn30
@@ -863,22 +863,54 @@ __cheriot_minimum_stack(0x90) ssize_t return cap->quota; } -__cheriot_minimum_stack(0xd0) int heap_quarantine_empty() +__cheriot_minimum_stack(0xd0) int heap_quarantine_flush(Timeout *timeout) { STACK_CHECK(0xd0); - LockGuard g{lock}; - while (gm->heapQuarantineSize > 0) + + if (!check_tim...
This sequence could be extracted as a method on `LockGuard` so that this would become `if (!g.unlock_temporarily(timeout, 1)) return -ETIMEDOUT;`. Do we have other instances of this pattern?
cheriot-rtos
github_2023
cpp
468
CHERIoT-Platform
rmn30
@@ -305,27 +333,8 @@ namespace revoker.system_bg_revoker_kick(); - if constexpr (Revocation::Revoker::IsAsynchronous) - { - wait_for_background_revoker( - timeout, needsRevocation->waitingEpoch, g); - } - else - { - // Drop and reacquire the lock while yielding. - // ...
Should this check the return value?
cheriot-rtos
github_2023
cpp
468
CHERIoT-Platform
nwf
@@ -291,17 +291,36 @@ ssize_t __cheri_compartment("allocator") heap_quota_remaining(AllocatorCapability heapCapability); /** - * Block until the quarantine is empty. + * Try to empty the quarantine and defragment the heap. * - * This should be used only in testing, to place the system in a quiesced - * state. ...
I don't think it's a certainty? ```suggestion * allocations, then calling this function will likely reduce fragmentation. ```
cheriot-rtos
github_2023
cpp
468
CHERIoT-Platform
nwf
@@ -291,17 +291,42 @@ ssize_t __cheri_compartment("allocator") heap_quota_remaining(AllocatorCapability heapCapability); /** - * Block until the quarantine is empty. + * Try to empty the quarantine and defragment the heap. * - * This should be used only in testing, to place the system in a quiesced - * state. ...
Since `heap_quarantine_flush` is now one-pass, this should also be guaranteed to terminate, now... or should it loop around `_flush`?
cheriot-rtos
github_2023
cpp
468
CHERIoT-Platform
nwf
@@ -216,20 +217,44 @@ namespace uint32_t epoch, LockGuard<decltype(lock)> &g, T &r = revoker) - requires(!Revocation::SupportsInterruptNotification<T>) + requires(!R...
At a glance, this implementation looks to be the same as the above?
cheriot-rtos
github_2023
cpp
476
CHERIoT-Platform
davidchisnall
@@ -104,7 +104,7 @@ namespace ds::pointer __always_inline Pointer<T> &operator=(Pointer const &p) { - ref = p.ref; + ref = (T *){p.ref};
Doesn't this trigger a clang-tidy warning about C-style casts?
cheriot-rtos
github_2023
others
250
CHERIoT-Platform
rmn30
@@ -223,6 +224,29 @@ For Ubuntu, you can do: # apt install xmake ``` +### Installing u2futils + +If you are working with Sonata, you will need to convert the ELF files that the linker produces to [USB Flashing Format (UF2)](https://github.com/microsoft/uf2) format.
```suggestion If you are working with Sonata, you will need to convert the ELF files that the linker produces to [USB Flashing Format (UF2)](https://github.com/microsoft/uf2). ```
cheriot-rtos
github_2023
others
250
CHERIoT-Platform
rmn30
@@ -352,3 +376,99 @@ issions are: Test runner: Global(0x0) ... ``` + +Running on Sonata +----------------- + +The Sonata board from lowRISC is an FPGA prototyping platform designed specifically to work with the CHERIoT Ibex. +If you have installed a [release of their system firmware](https://github.com/lowRISC/sonat...
I don't think it's a good idea to connect to all of them at the same time. I think one might be the debugger and actually halts CPU or something. ```suggestion If you are unsure which of Sonata's serial ports is the correct one, you can connect your serial console to each of them in turn and see which produces output...
cheriot-rtos
github_2023
others
235
CHERIoT-Platform
HU90m
@@ -0,0 +1,36 @@ +#!/bin/sh + +FIRMWARE_ELF=$1 + +SCRIPT_DIRECTORY="$(dirname "$(realpath "$0")")" +. ${SCRIPT_DIRECTORY}/includes/helper_find_llvm_install.sh + +OBJCOPY=$(find_llvm_tool_required llvm-objcopy) + +command -v uf2conv > /dev/null +if [ ! $? ] ; then + echo "uf2conv not found. On macOS / Linux systems wit...
```suggestion try_copy /run/media/$USER/ ```
cheriot-rtos
github_2023
others
235
CHERIoT-Platform
HU90m
@@ -0,0 +1,36 @@ +#!/bin/sh
```suggestion #!/usr/bin/env sh set -ue ``` Mainly care about `set -ue`, `env` is just a preference.
cheriot-rtos
github_2023
cpp
201
CHERIoT-Platform
rmn30
@@ -335,7 +336,13 @@ debug_log_message_write(const char *context, DebugPrinter printer; printer.write("\x1b[35m"); printer.write(context); +#if 0
Make make this a compile time option? ```suggestion #if defined(DEBUG_SHOW_THREAD_ID) ```
cheriot-rtos
github_2023
cpp
201
CHERIoT-Platform
rmn30
@@ -114,6 +116,11 @@ namespace return schedTStack; } + static bool any_ready() + { + return priorityMap != 0; + } + /** * When yielding inside the scheduler compartment, we almost always want
While you're here could you change this comment to fix #56 ?
cheriot-rtos
github_2023
cpp
201
CHERIoT-Platform
rmn30
@@ -28,34 +28,72 @@ namespace class Timer final : private TimerCore { + inline static uint64_t lastTickTime = 0; + inline static uint32_t accumulatedTickError = 0; + public: static void interrupt_setup() { static_assert(TIMERCYCLES_PER_TICK <= UINT32_MAX, "Cycles per tick ...
This is worthy of some comment. I think it is calculating error by assuming elapsed should be a multiples of TIMERCYCLES_PER_TICK and, if less than a tick has elapsed, it rounds up by one?
cheriot-rtos
github_2023
cpp
201
CHERIoT-Platform
nwf-msr
@@ -26,36 +26,81 @@ namespace IsTimer<TimerCore>, "Platform's timer implementation does not meet the required interface"); + /** + * Timer interface. Provides generic timer functionality to the scheduler, + * wrapping the platform's timer device. + */ class Timer final : private TimerCore { + inline ...
Expand comment to match code and maybe write something to make those of us stuck in the 1980s feel better about clearing the timer? Something like... "... no threads blocked with a timeout and no priority-peers of the current thread such that we'd need to timeslice the CPU. The timer can be re-enabled if this single ...
cheriot-rtos
github_2023
others
201
CHERIoT-Platform
nwf-msr
@@ -970,7 +970,13 @@ __Z13thread_id_getv: // Load the trusted stack pointer into a register that we will clobber in // the next instruction when we load the thread ID. cspecialr ca0, mtdc + //cgettag a1, ca0 + // If this is a null pointer, don't try to dereference it and report that + // we ar...
Do you want this to be commented out?
cheriot-rtos
github_2023
cpp
201
CHERIoT-Platform
nwf-msr
@@ -55,7 +55,7 @@ static inline BaseType_t xTaskCheckForTimeOut(TimeOut_t *pxTimeOut, static inline void vTaskDelay(const TickType_t xTicksToDelay) { struct Timeout timeout = {0, xTicksToDelay}; - thread_sleep(&timeout); + thread_sleep(&timeout, 0);
I don't think that's the semantics of `vTaskDelay`. https://www.freertos.org/a00127.html makes it sound like it's supposed to guarantee that time elapses.
cheriot-rtos
github_2023
cpp
201
CHERIoT-Platform
nwf-msr
@@ -72,6 +117,39 @@ namespace break; } } + if (!Thread::any_ready()) + { + for (Thread *iter = Thread::waitingList; iter;)
I think I'd prefer two `waitingList`-s, one for time elapsing and one for yielding, so that we wouldn't have to do this kind of two-pass rummaging and discrimination. I suppose with our thread counts it doesn't hugely matter, but still.
cheriot-rtos
github_2023
cpp
201
CHERIoT-Platform
nwf-msr
@@ -72,6 +117,39 @@ namespace break; } } + if (!Thread::any_ready()) + { + for (Thread *iter = Thread::waitingList; iter;) + { + if (iter->is_yielding()) + { + Debug::log("Woke thread {} {} cycles early", + iter->id_get(), + int64_t(iter->expiryTime)...
I don't think that's right; I think you want to keep scanning the queue for the first yielding thread, not bail if the head of the queue isn't yielding.
cheriot-rtos
github_2023
others
201
CHERIoT-Platform
nwf-msr
@@ -38,6 +38,21 @@ class StandardClint : private utils::NoCopyNoMove 2 * sizeof(uint32_t)); } + static uint64_t time() + { + /// the low 32 bits
Eh?
cheriot-rtos
github_2023
cpp
201
CHERIoT-Platform
nwf-msr
@@ -23,6 +23,17 @@ typedef struct [[cheri::interrupt_state(disabled)]] SystickReturn __cheri_compartment("sched") thread_systemtick_get(void); +enum ThreadSleepFlags : uint32_t +{ + /** + * Sleep for up to the specified timeout, but wake early if there are no + * other runnable threads. This allows a high-prio...
```suggestion * other threads runnable or blocked with earlier timeouts. * This allows a high-priority thread to yield for ``` I'm trying to capture the difference between "wake as soon as the system idles within the next N ticks" (which would be the "traverse the waiting queue until we found a yielding threa...
cheriot-rtos
github_2023
cpp
201
CHERIoT-Platform
nwf-msr
@@ -419,14 +435,17 @@ SystickReturn __cheri_compartment("sched") thread_systemtick_get() } __cheriot_minimum_stack(0x80) int __cheri_compartment("sched") - thread_sleep(Timeout *timeout) + thread_sleep(Timeout *timeout, uint32_t flags) { STACK_CHECK(0x80); if (!check_timeout_pointer(timeout)) { return -...
Nit: could you `ifdef 0` this or cut down the number of slashes so that it doesn't look like a doxygen-style comment?
cheriot-rtos
github_2023
cpp
201
CHERIoT-Platform
nwf-msr
@@ -616,7 +647,12 @@ namespace uint8_t priority; /// The original priority level for this thread. This never changes. const uint8_t OriginalPriority; - ThreadState state; + ThreadState state : 2; + /** + * If the thread is yielding, it may be scheduled before its timeout + * expires, as long as no ...
I might leave off the "as long as..." part here and just point at the docs for `ThreadSleepNoEarlyWake` or the comment down in the actual wake code.
cheriot-rtos
github_2023
cpp
201
CHERIoT-Platform
nwf-msr
@@ -26,36 +26,96 @@ namespace IsTimer<TimerCore>, "Platform's timer implementation does not meet the required interface"); + /** + * Timer interface. Provides generic timer functionality to the scheduler, + * wrapping the platform's timer device. + */ class Timer final : private TimerCore { + inline ...
```suggestion * threads runnable or sleeping with earlier timeouts. ```
cheriot-rtos
github_2023
cpp
201
CHERIoT-Platform
rmn30
@@ -26,36 +26,96 @@ namespace IsTimer<TimerCore>, "Platform's timer implementation does not meet the required interface"); + /** + * Timer interface. Provides generic timer functionality to the scheduler, + * wrapping the platform's timer device. + */ class Timer final : private TimerCore { + inline ...
@davidchisnall if the waiting list is non-empty *and* the current thread has peers I think this will set the timer for the next expiry time. Doesn't that mean the current thread could get more than one quantum?
cheriot-rtos
github_2023
others
225
CHERIoT-Platform
rmn30
@@ -352,7 +315,19 @@ struct DebugFormatArgumentAdaptor<CHERI::PermissionSet> construct(CHERI::PermissionSet value) { return {static_cast<uintptr_t>(value.as_raw()), - DebugFormatArgument::PermissionSet}; + DebugFormatArgumentKind::DebugFormatArgumentPermissionSet}; + } +}; + +/** + * Null point...
Curious why this is required?
cheriot-rtos
github_2023
cpp
225
CHERIoT-Platform
rmn30
@@ -0,0 +1,138 @@ +#pragma once +#include <__debug.h> +#include <__macro_map.h> + +#ifndef __cplusplus + +/** + * Helper macro to convert the type of an argument to the corresponding + * `DebugFormatArgument` value. + * + * Should not be used directly. + */ +# define CHERIOT_DEBUG_MAP_ARGUMENT(x) ...
Maybe prefix with `_` or something to discourage direct use?
cheriot-rtos
github_2023
others
226
CHERIoT-Platform
rmn30
@@ -13,9 +13,6 @@ .p2align 2 .type start,@function start: - cjal .Lregs_clear - // The common register clearing function will not zero these registers. - zeroRegisters ra, sp, gp, a0 // At this point all registers are cleared.
```suggestion // HW should have initialised all general purpose registers to NULL // but we don't rely on that. Most will be cleared below before jumping to loader. ```
cheriot-rtos
github_2023
cpp
311
CHERIoT-Platform
sleffler
@@ -61,23 +61,41 @@ using _Bool = bool; #define __section(x) __attribute__((section(x))) #define __alloc_size(x) __attribute__((alloc_size(x))) #define __alloc_align(x) __attribute__((alloc_align(x))) -#define __cheri_callback __attribute__((cheri_ccallback)) #if __has_attribute(cheriot_minimum_stack) # define __c...
<pre>__CHERIOT_BAREMETAL__</pre> or <pre>_CHERIOT_BAREMETAL_</pre> (I originally used the latter)
cheriot-rtos
github_2023
others
185
CHERIoT-Platform
rmn30
@@ -27,3 +27,99 @@ This is the kind of isolation that device drivers typically provide in operating Note in addition that we've added one more attribute to the function exposed here: `[[cheri::interrupt_state(disabled)]]`. This means that the uart compartment will write the entire string to the UART, so two different...
```suggestion We do this by writing a Rego module that encapsulates our policy. ```
cheriot-rtos
github_2023
others
185
CHERIoT-Platform
rmn30
@@ -27,3 +27,99 @@ This is the kind of isolation that device drivers typically provide in operating Note in addition that we've added one more attribute to the function exposed here: `[[cheri::interrupt_state(disabled)]]`. This means that the uart compartment will write the entire string to the UART, so two different...
```suggestion This uses `-b` to find the board description file and `-j` the report that the linker generated during the build. The query passed with `-q` asks which compartments or libraries import the UART's MMIO capability. ```
cheriot-rtos
github_2023
cpp
174
CHERIoT-Platform
nwf-msr
@@ -289,7 +289,13 @@ namespace displacement_proxy struct __packed __aligned(MallocAlignment) MChunkHeader { - static constexpr size_t OwnerIDWidth = 14; + /** + * Each chunk has a 16-bit metadata field that is used to store a small + * bitfield and the owner ID in the remaining bits. This is the space not + * co...
For a follow-up PR, perhaps: do we ever actually check that the `uint16_t` owner IDs we're passing around fit in this width? Maybe just in debug builds?
cheriot-rtos
github_2023
cpp
174
CHERIoT-Platform
nwf-msr
@@ -301,8 +307,15 @@ MChunkHeader /// The unique identifier of the allocator. uint16_t ownerID : OwnerIDWidth; - bool isPrevInUse : 1; - bool isCurrInUse : 1; + /** + * Is this a sealed object? If so, it should be exempted from free in + * `heap_free_all` because deallocation requires consensus between...
Probably also worth a quick comment that this, like `isCurrInUse`, effectively is a _type tag_ on the body of the chunk, indicating that it is a `struct SObjStruct`. By that token, it'd be good explicitly zero the bit in `mspace_free` (or maybe `quarantine_pending_push`) and to teach the `ok_free_chunk` consistency ...
cheriot-rtos
github_2023
c
162
CHERIoT-Platform
nwf-msr
@@ -88,3 +88,9 @@ void *__cheri_libcall memset(void *dst0, int c0, size_t length) } while (--t != 0); return (dst0); } + +void __cheri_libcall explicit_bzero(void *s, size_t n) +{ + memset(s, 0, n);
Does this result in an extra call/return within the library?
cheriot-rtos
github_2023
others
161
CHERIoT-Platform
nwf-msr
@@ -0,0 +1,65 @@ +#pragma once +#include "compartment-macros.h" +#include <platform/concepts/entropy.h> +#include <ds/xoroshiro.h> +#include <riscvreg.h> +#include <interrupt.h> +#include <fail-simulator-on-error.h> + +DECLARE_AND_DEFINE_INTERRUPT_CAPABILITY( + RevokerInterruptEntropy, I...
I am pretty sure you didn't mean `(interrupts & 0xff) >> 8`. ```suggestion for (uint32_t i = 0 ; i<((interrupts & 0xff00) >> 8); i++) ```
cheriot-rtos
github_2023
cpp
161
CHERIoT-Platform
nwf-msr
@@ -85,7 +142,15 @@ namespace ds::xoroshiro * * Parameters from https://prng.di.unimi.it/xoroshiro128plus.c . */ - using P128R64 = detail::XorOshiro<uint64_t, uint64_t, 24, 16, 37>; + using P128R64 = detail::XorOshiro<uint64_t, + uint64_t, + 2...
"Let's see... types, small numbers... omg". I trust that those are the right big numbers.
cheriot-rtos
github_2023
cpp
161
CHERIoT-Platform
nwf-msr
@@ -0,0 +1,36 @@ +#pragma once +#include <array> +#include <concepts> +#include <cstdint> + +/** + * Concept for an Ethernet adaptor. + */ +template<typename T> +concept IsEntropySource = requires(T source) +{ + /** + * Must export a flag indicating whether this is a cryptographically + * secure random number. + */ ...
Requiring distillation in the application-facing source is probably fine, but I'm not sure it's worth it if one starts stacking/pooling sources a la Fortuna.
cheriot-rtos
github_2023
others
161
CHERIoT-Platform
nwf-msr
@@ -0,0 +1,65 @@ +#pragma once +#include "compartment-macros.h" +#include <platform/concepts/entropy.h> +#include <ds/xoroshiro.h> +#include <riscvreg.h> +#include <interrupt.h> +#include <fail-simulator-on-error.h> + +DECLARE_AND_DEFINE_INTERRUPT_CAPABILITY( + RevokerInterruptEntropy, I...
Huh! That's kind of surprising. Maybe something like https://dl.acm.org/doi/10.1145/3610295 is worth adding to the FPGA image? But either way, this looks fine for testing and demo purposes.
cheriot-rtos
github_2023
cpp
155
CHERIoT-Platform
nwf-msr
@@ -53,34 +178,272 @@ xSemaphoreCreateCounting(UBaseType_t uxMaxCount, UBaseType_t uxInitialCount) } /** - * Delete a heap-allocated semaphore. + * Create a heap-allocated binary semaphore. + * + * Binary semaphores are implemented as counting semaphores with a maximum count + * of 1. + */ +__always_inline static i...
Not yet supported?
cheriot-rtos
github_2023
cpp
155
CHERIoT-Platform
nwf-msr
@@ -53,34 +178,272 @@ xSemaphoreCreateCounting(UBaseType_t uxMaxCount, UBaseType_t uxInitialCount) } /** - * Delete a heap-allocated semaphore. + * Create a heap-allocated binary semaphore. + * + * Binary semaphores are implemented as counting semaphores with a maximum count + * of 1. + */ +__always_inline static i...
This probably deserves the same comment about racing as below, with the (anti)caveat that an answer of "this thread" _is_ stable.
cheriot-rtos
github_2023
cpp
155
CHERIoT-Platform
nwf-msr
@@ -44,7 +169,7 @@ __always_inline static inline SemaphoreHandle_t xSemaphoreCreateCounting(UBaseType_t uxMaxCount, UBaseType_t uxInitialCount) { SemaphoreHandle_t semaphore = - (SemaphoreHandle_t)malloc(sizeof(struct CountingSemaphoreState)); + (SemaphoreHandle_t)malloc(sizeof(SemaphoreHandle_t));
Do you really mean `sizeof(SemaphoreHandle_t)`? ```suggestion (SemaphoreHandle_t)malloc(sizeof(StaticSemaphore_t)); ```
cheriot-rtos
github_2023
cpp
155
CHERIoT-Platform
nwf-msr
@@ -1,18 +1,141 @@ #pragma once +/** + * FreeRTOS semaphore compatibility layer. This maps FreeRTOS semaphore types + * to their CHERIoT RTOS equivalents. + * + * There is some overhead from dynamic dispatch that can be avoided if only one + * of the FreeRTOS semaphore types needs to be supported in a particular + * ...
While I don't object to these `EXPOSE`-less `define`s, are they doing anything that `defined(CHERIOT_EXPOSE_...)` can't?
cheriot-rtos
github_2023
cpp
155
CHERIoT-Platform
nwf-msr
@@ -53,34 +178,272 @@ xSemaphoreCreateCounting(UBaseType_t uxMaxCount, UBaseType_t uxInitialCount) } /** - * Delete a heap-allocated semaphore. + * Create a heap-allocated binary semaphore. + * + * Binary semaphores are implemented as counting semaphores with a maximum count + * of 1. + */ +__always_inline static i...
As above?
cheriot-rtos
github_2023
cpp
155
CHERIoT-Platform
nwf-msr
@@ -53,34 +178,272 @@ xSemaphoreCreateCounting(UBaseType_t uxMaxCount, UBaseType_t uxInitialCount) } /** - * Delete a heap-allocated semaphore. + * Create a heap-allocated binary semaphore. + * + * Binary semaphores are implemented as counting semaphores with a maximum count + * of 1. + */ +__always_inline static i...
Third time's the charm?
cheriot-rtos
github_2023
others
142
CHERIoT-Platform
rmn30
@@ -777,7 +777,7 @@ exception_entry_asm: // Restore the stack pointer. All other spilled values are spilled there. clc csp, TrustedStackFrame_offset_csp(ct1) // Update the current frame offset. - csw t2, TrustedStack_offset_frameoffset(ctp) + csh t2, TrustedStack_offs...
Was this previously a bug where this write was overflowing into the padding?
cheriot-rtos
github_2023
others
427
CHERIoT-Platform
nwf
@@ -1055,27 +1119,32 @@ namespace CHERI * all other cases. */ template<typename U> - bool is_subset_of(Capability<U> other) + bool is_subset_of(Capability<U, IsSealed> other) { return __builtin_cheri_subset_test(other.ptr, ptr); } /** * Seal this capability with the given key. */ - ...
Do you want to `requires IsSealed` here?
cheriot-rtos
github_2023
others
427
CHERIoT-Platform
nwf
@@ -1055,27 +1119,32 @@ namespace CHERI * all other cases. */ template<typename U> - bool is_subset_of(Capability<U> other) + bool is_subset_of(Capability<U, IsSealed> other) { return __builtin_cheri_subset_test(other.ptr, ptr); } /** * Seal this capability with the given key. */ - ...
Do you mean `!defined` here as everywhere else? I don't see `CHERIOT_NO_SEALED_POINTERS` documented anywhere, so I'm not quite sure what it's supposed to be doing...
cheriot-rtos
github_2023
others
427
CHERIoT-Platform
nwf
@@ -132,8 +132,8 @@ namespace /** * Append a capability. */ - template<typename T> - __always_inline void append(CHERI::Capability<T> capability) + template<typename T, bool IsSealed> + __always_inline void append(CHERI::Capability<T, IsSealed> capability)
I wonder if it's worth a check and warning if the sealed state of the capability differs from the static annotation?
cheriot-rtos
github_2023
others
427
CHERIoT-Platform
nwf
@@ -1055,27 +1119,32 @@ namespace CHERI * all other cases. */ template<typename U> - bool is_subset_of(Capability<U> other) + bool is_subset_of(Capability<U, IsSealed> other) { return __builtin_cheri_subset_test(other.ptr, ptr); } /** * Seal this capability with the given key. */ - ...
The lack of write-back to `ptr` is a breaking change. The `[[nodiscard]]` is nice, and I think you've updated all the call-sites in tree, but... some more words in the commentary might be useful and an announcement on the blog or signal group or something could be good, too.
cheriot-rtos
github_2023
cpp
427
CHERIoT-Platform
nwf
@@ -40,7 +41,10 @@ struct AllocatorCapabilityState uintptr_t reserved[2]; }; -struct SObjStruct; +/** + * Type for allocator capabilities. + */ +typedef CHERI_SEALED(struct AllocatorCapabilityState *) AllocatorCapability;
Why this wasn't a `typedef` far longer ago... sorry.
cheriot-rtos
github_2023
others
460
CHERIoT-Platform
davidchisnall
@@ -10,7 +10,8 @@ riscv32-unknown-unknown -fshort-wchar -nostdinc -fomit-frame-pointer --fno-builtin +-fno-builtin-setjmp +-fno-builtin-longjmp
These are only used for clangd, so don't matter too much.