Arthur Sonzognigemini: You are missing many files. here there are:
arthursonzogni@arthursonzogni:/usr/local/google/btrfs_mount/7726244/src/sandbox$ git grep UNSAFE_BUFFERS_BUILD
linux/seccomp-bpf-helpers/baseline_policy_unittest.cc:#ifdef UNSAFE_BUFFERS_BUILD
linux/suid/common/suid_unsafe_environment_variables.h:#ifdef UNSAFE_BUFFERS_BUILD
linux/suid/sandbox.c:#ifdef UNSAFE_BUFFERS_BUILD
mac/sandbox_logging.cc:#ifdef UNSAFE_BUFFERS_BUILD
mac/seatbelt_exec.cc:#ifdef UNSAFE_BUFFERS_BUILD
policy/win/hook_util/hook_util.cc:#ifdef UNSAFE_BUFFERS_BUILD
win/src/lpc_policy_test.cc:#ifdef UNSAFE_BUFFERS_BUILD
win/src/sandbox_nt_util.cc:#ifdef UNSAFE_BUFFERS_BUILD
win/src/sandbox_nt_util_unittest.cc:#ifdef UNSAFE_BUFFERS_BUILD
win/src/sandbox_policy_base.cc:#ifdef UNSAFE_BUFFERS_BUILD
win/src/target_process.cc:#ifdef UNSAFE_BUFFERS_BUILD
For C file (.c extension or .h depending on usage), you keep the UNSAFE_BUFFERS_BUILD block but add this marker:
```
#ifdef UNSAFE_BUFFERS_BUILD
// PragmaAllocUnsafeBufferExclusion: C file can't be converted yet.
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif
```
Done
const size_t kTestTransferSize = 4;gemini: remove this. You can use kTestString.size() instead.
BPF_ASSERT_EQ(0,
UNSAFE_TODO(memcmp(kTestString, read_buf, kTestTransferSize)));Arthur Sonzognigemini: follow-up fix the UNSAFE_TODO, by turning kTestString and read_buff into span and comparing the span prefixes
Done
UNSAFE_TODO(memcpy(saved_envvar, "SANDBOX_", 8));
UNSAFE_TODO(memcpy(saved_envvar + 8, envvar, envvar_len));
UNSAFE_TODO(saved_envvar[8 + envvar_len] = 0);gemini: Revert this.
#ifdef __cplusplus
#include "base/compiler_specific.h"
#else
#define UNSAFE_TODO(...) \
_Pragma("clang unsafe_buffer_usage begin") \
__VA_ARGS__ _Pragma("clang unsafe_buffer_usage end")
#endifgemini: Revert this.
#ifndef UNSAFE_TODO
#if defined(__clang__)
#define UNSAFE_TODO(...) \
_Pragma("clang unsafe_buffer_usage begin") \
__VA_ARGS__ _Pragma("clang unsafe_buffer_usage end")
#else
#define UNSAFE_TODO(...) __VA_ARGS__
#endif
#endif
Arthur Sonzognigemini: please include the compiler_specific.h file defining this here. If you need to update the BUILD.gn file, you can.
Done
// PragmaAllowUnsafeBufferException: DEPS violation for base/gemini: PragmaAllowUnsafeBufferException should be **inside** the UNSAFE_BUFFERS_BUILD block
// PragmaAllowUnsafeBufferException: DEPS violation for base/gemini: PragmaAllowUnsafeBufferException should be **inside** the UNSAFE_BUFFERS_BUILD block
#include "base/compiler_specific.h"gemini: No need for this include if we don't add UNSAFE_TODO.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |