diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000000000000000000000000000000000..d87f5613ec4234f82f8eaeebc563711f587fdf88 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.xz filter=lfs diff=lfs merge=lfs -text diff --git a/.lfsconfig b/.lfsconfig new file mode 100644 index 0000000000000000000000000000000000000000..906f16d3993cc8930f32c2905aa6751be06744bb --- /dev/null +++ b/.lfsconfig @@ -0,0 +1,2 @@ +[lfs] + url = https://artlfs.openeuler.openatom.cn/src-openEuler/qt6-qtwebengine diff --git a/0001-qtwebengine-fix-building-with-system-ffmpeg7.1.patch b/0001-qtwebengine-fix-building-with-system-ffmpeg7.1.patch deleted file mode 100644 index 822b15906d7fa8a6236ee65ba185aaaeab3283e9..0000000000000000000000000000000000000000 --- a/0001-qtwebengine-fix-building-with-system-ffmpeg7.1.patch +++ /dev/null @@ -1,537 +0,0 @@ -From 3cf7fbed8c99818a54c2fd052a55dbe2e1969131 Mon Sep 17 00:00:00 2001 -From: peijiankang -Date: Fri, 14 Feb 2025 17:13:09 +0800 -Subject: [PATCH] qtwebengine-fix-building-with-system-ffmpeg7.1 - ---- - .../clear_key_cdm/ffmpeg_cdm_audio_decoder.cc | 18 ++++++++++-------- - .../chromium/media/ffmpeg/ffmpeg_common.cc | 15 +++++++++------ - .../media/ffmpeg/ffmpeg_regression_tests.cc | 19 +++++++++++-------- - .../media/filters/audio_decoder_unittest.cc | 2 +- - .../media/filters/audio_file_reader.cc | 17 +++++------------ - .../filters/audio_file_reader_unittest.cc | 14 +++++++------- - .../filters/ffmpeg_aac_bitstream_converter.cc | 7 ++++--- - ...ffmpeg_aac_bitstream_converter_unittest.cc | 2 +- - .../media/filters/ffmpeg_audio_decoder.cc | 13 +++++++------ - .../media/filters/ffmpeg_video_decoder.cc | 17 +++++++++++++---- - .../media/filters/ffmpeg_video_decoder.h | 16 ++++++++++++++++ - .../codecs/h264/h264_decoder_impl.cc | 7 ------- - 12 files changed, 84 insertions(+), 63 deletions(-) - -diff --git a/src/3rdparty/chromium/media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.cc b/src/3rdparty/chromium/media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.cc -index dffdbcfa3..c3e9dcf16 100644 ---- a/src/3rdparty/chromium/media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.cc -+++ b/src/3rdparty/chromium/media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.cc -@@ -74,7 +74,7 @@ void CdmAudioDecoderConfigToAVCodecContext( - codec_context->sample_fmt = AV_SAMPLE_FMT_NONE; - } - -- codec_context->channels = config.channel_count; -+ codec_context->ch_layout.nb_channels = config.channel_count; - codec_context->sample_rate = config.samples_per_second; - - if (config.extra_data) { -@@ -124,8 +124,8 @@ void CopySamples(cdm::AudioFormat cdm_format, - case cdm::kAudioFormatPlanarS16: - case cdm::kAudioFormatPlanarF32: { - const int decoded_size_per_channel = -- decoded_audio_size / av_frame.channels; -- for (int i = 0; i < av_frame.channels; ++i) { -+ decoded_audio_size / av_frame.ch_layout.nb_channels; -+ for (int i = 0; i < av_frame.ch_layout.nb_channels; ++i) { - memcpy(output_buffer, av_frame.extended_data[i], - decoded_size_per_channel); - output_buffer += decoded_size_per_channel; -@@ -185,13 +185,14 @@ bool FFmpegCdmAudioDecoder::Initialize( - // Success! - decoding_loop_ = std::make_unique(codec_context_.get()); - samples_per_second_ = config.samples_per_second; -- bytes_per_frame_ = codec_context_->channels * config.bits_per_channel / 8; -+ bytes_per_frame_ = -+ codec_context_->ch_layout.nb_channels * config.bits_per_channel / 8; - output_timestamp_helper_ = - std::make_unique(config.samples_per_second); - is_initialized_ = true; - - // Store initial values to guard against midstream configuration changes. -- channels_ = codec_context_->channels; -+ channels_ = codec_context_->ch_layout.nb_channels; - av_sample_format_ = codec_context_->sample_fmt; - - return true; -@@ -291,7 +292,8 @@ cdm::Status FFmpegCdmAudioDecoder::DecodeBuffer( - for (auto& frame : audio_frames) { - int decoded_audio_size = 0; - if (frame->sample_rate != samples_per_second_ || -- frame->channels != channels_ || frame->format != av_sample_format_) { -+ frame->ch_layout.nb_channels != channels_ || -+ frame->format != av_sample_format_) { - DLOG(ERROR) << "Unsupported midstream configuration change!" - << " Sample Rate: " << frame->sample_rate << " vs " - << samples_per_second_ -@@ -302,7 +304,7 @@ cdm::Status FFmpegCdmAudioDecoder::DecodeBuffer( - } - - decoded_audio_size = av_samples_get_buffer_size( -- nullptr, codec_context_->channels, frame->nb_samples, -+ nullptr, codec_context_->ch_layout.nb_channels, frame->nb_samples, - codec_context_->sample_fmt, 1); - if (!decoded_audio_size) - continue; -@@ -322,7 +324,7 @@ bool FFmpegCdmAudioDecoder::OnNewFrame( - std::vector>* audio_frames, - AVFrame* frame) { - *total_size += av_samples_get_buffer_size( -- nullptr, codec_context_->channels, frame->nb_samples, -+ nullptr, codec_context_->ch_layout.nb_channels, frame->nb_samples, - codec_context_->sample_fmt, 1); - audio_frames->emplace_back(av_frame_clone(frame)); - return true; -diff --git a/src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.cc b/src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.cc -index 281d716cb..9c106e16d 100644 ---- a/src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.cc -+++ b/src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.cc -@@ -353,10 +353,11 @@ bool AVCodecContextToAudioDecoderConfig(const AVCodecContext* codec_context, - codec_context->sample_fmt, codec_context->codec_id); - - ChannelLayout channel_layout = -- codec_context->channels > 8 -+ codec_context->ch_layout.nb_channels > CHANNEL_LAYOUT_QUAD - ? CHANNEL_LAYOUT_DISCRETE -- : ChannelLayoutToChromeChannelLayout(codec_context->channel_layout, -- codec_context->channels); -+ : ChannelLayoutToChromeChannelLayout( -+ codec_context->ch_layout.u.mask, -+ codec_context->ch_layout.nb_channels); - - switch (codec) { - // For AC3/EAC3 we enable only demuxing, but not decoding, so FFmpeg does -@@ -408,7 +409,7 @@ bool AVCodecContextToAudioDecoderConfig(const AVCodecContext* codec_context, - extra_data, encryption_scheme, seek_preroll, - codec_context->delay); - if (channel_layout == CHANNEL_LAYOUT_DISCRETE) -- config->SetChannelsForDiscrete(codec_context->channels); -+ config->SetChannelsForDiscrete(codec_context->ch_layout.nb_channels); - - #if BUILDFLAG(ENABLE_PLATFORM_AC3_EAC3_AUDIO) - // These are bitstream formats unknown to ffmpeg, so they don't have -@@ -427,7 +428,9 @@ bool AVCodecContextToAudioDecoderConfig(const AVCodecContext* codec_context, - - // TODO(dalecurtis): Just use the profile from the codec context if ffmpeg - // ever starts supporting xHE-AAC. -- if (codec_context->profile == FF_PROFILE_UNKNOWN) { -+ constexpr uint8_t kXHEAAc = 41; -+ if (codec_context->profile == FF_PROFILE_UNKNOWN || -+ codec_context->profile == kXHEAAc) { - // Errors aren't fatal here, so just drop any MediaLog messages. - NullMediaLog media_log; - mp4::AAC aac_parser; -@@ -477,7 +480,7 @@ void AudioDecoderConfigToAVCodecContext(const AudioDecoderConfig& config, - - // TODO(scherkus): should we set |channel_layout|? I'm not sure if FFmpeg uses - // said information to decode. -- codec_context->channels = config.channels(); -+ codec_context->ch_layout.nb_channels = config.channels(); - codec_context->sample_rate = config.samples_per_second(); - - if (config.extra_data().empty()) { -diff --git a/src/3rdparty/chromium/media/ffmpeg/ffmpeg_regression_tests.cc b/src/3rdparty/chromium/media/ffmpeg/ffmpeg_regression_tests.cc -index ba7180908..47d2f0d03 100644 ---- a/src/3rdparty/chromium/media/ffmpeg/ffmpeg_regression_tests.cc -+++ b/src/3rdparty/chromium/media/ffmpeg/ffmpeg_regression_tests.cc -@@ -90,16 +90,16 @@ FFMPEG_TEST_CASE(Cr62127, - PIPELINE_ERROR_DECODE, - PIPELINE_ERROR_DECODE); - FFMPEG_TEST_CASE(Cr93620, "security/93620.ogg", PIPELINE_OK, PIPELINE_OK); --FFMPEG_TEST_CASE(Cr100492, -- "security/100492.webm", -- DECODER_ERROR_NOT_SUPPORTED, -- DECODER_ERROR_NOT_SUPPORTED); -++FFMPEG_TEST_CASE(Cr100492, "security/100492.webm", PIPELINE_OK, PIPELINE_OK); - FFMPEG_TEST_CASE(Cr100543, "security/100543.webm", PIPELINE_OK, PIPELINE_OK); - FFMPEG_TEST_CASE(Cr101458, - "security/101458.webm", - PIPELINE_ERROR_DECODE, - PIPELINE_ERROR_DECODE); --FFMPEG_TEST_CASE(Cr108416, "security/108416.webm", PIPELINE_OK, PIPELINE_OK); -+FFMPEG_TEST_CASE(Cr108416, -+ "security/108416.webm", -+ PIPELINE_ERROR_DECODE, -+ PIPELINE_ERROR_DECODE); - FFMPEG_TEST_CASE(Cr110849, - "security/110849.mkv", - DEMUXER_ERROR_COULD_NOT_OPEN, -@@ -154,7 +154,10 @@ FFMPEG_TEST_CASE(Cr234630b, - "security/234630b.mov", - DEMUXER_ERROR_NO_SUPPORTED_STREAMS, - DEMUXER_ERROR_NO_SUPPORTED_STREAMS); --FFMPEG_TEST_CASE(Cr242786, "security/242786.webm", PIPELINE_OK, PIPELINE_OK); -+FFMPEG_TEST_CASE(Cr242786, -+ "security/242786.webm", -+ PIPELINE_OK, -+ PIPELINE_ERROR_DECODE); - // Test for out-of-bounds access with slightly corrupt file (detection logic - // thinks it's a MONO file, but actually contains STEREO audio). - FFMPEG_TEST_CASE(Cr275590, -@@ -372,8 +375,8 @@ FFMPEG_TEST_CASE(WEBM_2, - DEMUXER_ERROR_NO_SUPPORTED_STREAMS); - FFMPEG_TEST_CASE(WEBM_4, - "security/out.webm.68798.1929", -- DECODER_ERROR_NOT_SUPPORTED, -- DECODER_ERROR_NOT_SUPPORTED); -+ PIPELINE_OK, -+ PIPELINE_OK); - FFMPEG_TEST_CASE(WEBM_5, "frame_size_change.webm", PIPELINE_OK, PIPELINE_OK); - - // General MKV test cases. -diff --git a/src/3rdparty/chromium/media/filters/audio_decoder_unittest.cc b/src/3rdparty/chromium/media/filters/audio_decoder_unittest.cc -index e7f422a37..adfd09415 100644 ---- a/src/3rdparty/chromium/media/filters/audio_decoder_unittest.cc -+++ b/src/3rdparty/chromium/media/filters/audio_decoder_unittest.cc -@@ -461,7 +461,7 @@ const TestParams kAudioToolboxTestParams[] = { - {AudioCodec::kAAC, "noise-xhe-aac.mp4", kNoiseXheAAcExpectations, 0, 48000, - CHANNEL_LAYOUT_STEREO}, - {AudioCodec::kAAC, "noise-xhe-aac-mono.mp4", kNoiseMonoXheAAcExpectations, -- 0, 29400, CHANNEL_LAYOUT_MONO}, -+ 0, 29400, CHANNEL_LAYOUT_UNSUPPORTED}, - }; - #endif // BUILDFLAG(IS_MAC) && BUILDFLAG(USE_PROPRIETARY_CODECS) - -diff --git a/src/3rdparty/chromium/media/filters/audio_file_reader.cc b/src/3rdparty/chromium/media/filters/audio_file_reader.cc -index 39ec7b240..200788edc 100644 ---- a/src/3rdparty/chromium/media/filters/audio_file_reader.cc -+++ b/src/3rdparty/chromium/media/filters/audio_file_reader.cc -@@ -113,14 +113,15 @@ bool AudioFileReader::OpenDecoder() { - - // Verify the channel layout is supported by Chrome. Acts as a sanity check - // against invalid files. See http://crbug.com/171962 -- if (ChannelLayoutToChromeChannelLayout(codec_context_->channel_layout, -- codec_context_->channels) == -+ if (ChannelLayoutToChromeChannelLayout( -+ codec_context_->ch_layout.u.mask, -+ codec_context_->ch_layout.nb_channels) == - CHANNEL_LAYOUT_UNSUPPORTED) { - return false; - } - - // Store initial values to guard against midstream configuration changes. -- channels_ = codec_context_->channels; -+ channels_ = codec_context_->ch_layout.nb_channels; - audio_codec_ = CodecIDToAudioCodec(codec_context_->codec_id); - sample_rate_ = codec_context_->sample_rate; - av_sample_format_ = codec_context_->sample_fmt; -@@ -223,7 +224,7 @@ bool AudioFileReader::OnNewFrame( - if (frames_read < 0) - return false; - -- const int channels = frame->channels; -+ const int channels = frame->ch_layout.nb_channels; - if (frame->sample_rate != sample_rate_ || channels != channels_ || - frame->format != av_sample_format_) { - DLOG(ERROR) << "Unsupported midstream configuration change!" -@@ -242,18 +243,10 @@ bool AudioFileReader::OnNewFrame( - // silence from being output. In the case where we are also discarding some - // portion of the packet (as indicated by a negative pts), we further want to - // adjust the duration downward by however much exists before zero. --#if BUILDFLAG(USE_SYSTEM_FFMPEG) -- if (audio_codec_ == AudioCodec::kAAC && frame->pkt_duration) { --#else - if (audio_codec_ == AudioCodec::kAAC && frame->duration) { --#endif // BUILDFLAG(USE_SYSTEM_FFMPEG) - const base::TimeDelta pkt_duration = ConvertFromTimeBase( - glue_->format_context()->streams[stream_index_]->time_base, --#if BUILDFLAG(USE_SYSTEM_FFMPEG) -- frame->pkt_duration + std::min(static_cast(0), frame->pts)); --#else - frame->duration + std::min(static_cast(0), frame->pts)); --#endif // BUILDFLAG(USE_SYSTEM_FFMPEG) - const base::TimeDelta frame_duration = - base::Seconds(frames_read / static_cast(sample_rate_)); - -diff --git a/src/3rdparty/chromium/media/filters/audio_file_reader_unittest.cc b/src/3rdparty/chromium/media/filters/audio_file_reader_unittest.cc -index a1c633d40..5784fe146 100644 ---- a/src/3rdparty/chromium/media/filters/audio_file_reader_unittest.cc -+++ b/src/3rdparty/chromium/media/filters/audio_file_reader_unittest.cc -@@ -61,15 +61,14 @@ class AudioFileReaderTest : public testing::Test { - // Verify packets are consistent across demuxer runs. Reads the first few - // packets and then seeks back to the start timestamp and verifies that the - // hashes match on the packets just read. -- void VerifyPackets() { -- const int kReads = 3; -+ void VerifyPackets(int packet_reads) { - const int kTestPasses = 2; - - AVPacket packet; - base::TimeDelta start_timestamp; - std::vector packet_md5_hashes_; - for (int i = 0; i < kTestPasses; ++i) { -- for (int j = 0; j < kReads; ++j) { -+ for (int j = 0; j < packet_reads; ++j) { - ASSERT_TRUE(reader_->ReadPacketForTesting(&packet)); - - // On the first pass save the MD5 hash of each packet, on subsequent -@@ -98,7 +97,8 @@ class AudioFileReaderTest : public testing::Test { - int sample_rate, - base::TimeDelta duration, - int frames, -- int expected_frames) { -+ int expected_frames, -+ int packet_reads = 3) { - Initialize(fn); - ASSERT_TRUE(reader_->Open()); - EXPECT_EQ(channels, reader_->channels()); -@@ -112,7 +112,7 @@ class AudioFileReaderTest : public testing::Test { - EXPECT_EQ(reader_->HasKnownDuration(), false); - } - if (!packet_verification_disabled_) -- ASSERT_NO_FATAL_FAILURE(VerifyPackets()); -+ ASSERT_NO_FATAL_FAILURE(VerifyPackets(packet_reads)); - ReadAndVerify(hash, expected_frames); - } - -@@ -219,7 +219,7 @@ TEST_F(AudioFileReaderTest, AAC_ADTS) { - } - - TEST_F(AudioFileReaderTest, MidStreamConfigChangesFail) { -- RunTestFailingDecode("midstream_config_change.mp3", 42624); -+ RunTestFailingDecode("midstream_config_change.mp3", 0); - } - #endif - -@@ -229,7 +229,7 @@ TEST_F(AudioFileReaderTest, VorbisInvalidChannelLayout) { - - TEST_F(AudioFileReaderTest, WaveValidFourChannelLayout) { - RunTest("4ch.wav", "131.71,38.02,130.31,44.89,135.98,42.52,", 4, 44100, -- base::Microseconds(100001), 4411, 4410); -+ base::Microseconds(100001), 4411, 4410, /*packet_reads=*/2); - } - - TEST_F(AudioFileReaderTest, ReadPartialMP3) { -diff --git a/src/3rdparty/chromium/media/filters/ffmpeg_aac_bitstream_converter.cc b/src/3rdparty/chromium/media/filters/ffmpeg_aac_bitstream_converter.cc -index 76b41aa6a..e26b6cd19 100644 ---- a/src/3rdparty/chromium/media/filters/ffmpeg_aac_bitstream_converter.cc -+++ b/src/3rdparty/chromium/media/filters/ffmpeg_aac_bitstream_converter.cc -@@ -195,14 +195,15 @@ bool FFmpegAACBitstreamConverter::ConvertPacket(AVPacket* packet) { - if (!header_generated_ || codec_ != stream_codec_parameters_->codec_id || - audio_profile_ != stream_codec_parameters_->profile || - sample_rate_index_ != sample_rate_index || -- channel_configuration_ != stream_codec_parameters_->channels || -+ channel_configuration_ != -+ stream_codec_parameters_->ch_layout.nb_channels || - frame_length_ != header_plus_packet_size) { - header_generated_ = - GenerateAdtsHeader(stream_codec_parameters_->codec_id, - 0, // layer - stream_codec_parameters_->profile, sample_rate_index, - 0, // private stream -- stream_codec_parameters_->channels, -+ stream_codec_parameters_->ch_layout.nb_channels, - 0, // originality - 0, // home - 0, // copyrighted_stream -@@ -214,7 +215,7 @@ bool FFmpegAACBitstreamConverter::ConvertPacket(AVPacket* packet) { - codec_ = stream_codec_parameters_->codec_id; - audio_profile_ = stream_codec_parameters_->profile; - sample_rate_index_ = sample_rate_index; -- channel_configuration_ = stream_codec_parameters_->channels; -+ channel_configuration_ = stream_codec_parameters_->ch_layout.nb_channels; - frame_length_ = header_plus_packet_size; - } - -diff --git a/src/3rdparty/chromium/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc b/src/3rdparty/chromium/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc -index 3b46f7f6b..1897eb098 100644 ---- a/src/3rdparty/chromium/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc -+++ b/src/3rdparty/chromium/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc -@@ -34,7 +34,7 @@ class FFmpegAACBitstreamConverterTest : public testing::Test { - memset(&test_parameters_, 0, sizeof(AVCodecParameters)); - test_parameters_.codec_id = AV_CODEC_ID_AAC; - test_parameters_.profile = FF_PROFILE_AAC_MAIN; -- test_parameters_.channels = 2; -+ test_parameters_.ch_layout.nb_channels = 2; - test_parameters_.extradata = extradata_header_; - test_parameters_.extradata_size = sizeof(extradata_header_); - } -diff --git a/src/3rdparty/chromium/media/filters/ffmpeg_audio_decoder.cc b/src/3rdparty/chromium/media/filters/ffmpeg_audio_decoder.cc -index 46a481de5..be6500139 100644 ---- a/src/3rdparty/chromium/media/filters/ffmpeg_audio_decoder.cc -+++ b/src/3rdparty/chromium/media/filters/ffmpeg_audio_decoder.cc -@@ -28,7 +28,7 @@ namespace media { - - // Return the number of channels from the data in |frame|. - static inline int DetermineChannels(AVFrame* frame) { -- return frame->channels; -+ return frame->ch_layout.nb_channels; - } - - // Called by FFmpeg's allocation routine to allocate a buffer. Uses -@@ -233,7 +233,7 @@ bool FFmpegAudioDecoder::OnNewFrame(const DecoderBuffer& buffer, - // Translate unsupported into discrete layouts for discrete configurations; - // ffmpeg does not have a labeled discrete configuration internally. - ChannelLayout channel_layout = ChannelLayoutToChromeChannelLayout( -- codec_context_->channel_layout, codec_context_->channels); -+ codec_context_->ch_layout.u.mask, codec_context_->ch_layout.nb_channels); - if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED && - config_.channel_layout() == CHANNEL_LAYOUT_DISCRETE) { - channel_layout = CHANNEL_LAYOUT_DISCRETE; -@@ -350,11 +350,11 @@ bool FFmpegAudioDecoder::ConfigureDecoder(const AudioDecoderConfig& config) { - // Success! - av_sample_format_ = codec_context_->sample_fmt; - -- if (codec_context_->channels != config.channels()) { -+ if (codec_context_->ch_layout.nb_channels != config.channels()) { - MEDIA_LOG(ERROR, media_log_) - << "Audio configuration specified " << config.channels() - << " channels, but FFmpeg thinks the file contains " -- << codec_context_->channels << " channels"; -+ << codec_context_->ch_layout.nb_channels << " channels"; - ReleaseFFmpegResources(); - state_ = DecoderState::kUninitialized; - return false; -@@ -405,7 +405,7 @@ int FFmpegAudioDecoder::GetAudioBuffer(struct AVCodecContext* s, - if (frame->nb_samples <= 0) - return AVERROR(EINVAL); - -- if (s->channels != channels) { -+ if (s->ch_layout.nb_channels != channels) { - DLOG(ERROR) << "AVCodecContext and AVFrame disagree on channel count."; - return AVERROR(EINVAL); - } -@@ -438,7 +438,8 @@ int FFmpegAudioDecoder::GetAudioBuffer(struct AVCodecContext* s, - ChannelLayout channel_layout = - config_.channel_layout() == CHANNEL_LAYOUT_DISCRETE - ? CHANNEL_LAYOUT_DISCRETE -- : ChannelLayoutToChromeChannelLayout(s->channel_layout, s->channels); -+ : ChannelLayoutToChromeChannelLayout(s->ch_layout.u.mask, -+ s->ch_layout.nb_channels); - - if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED) { - DLOG(ERROR) << "Unsupported channel layout."; -diff --git a/src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.cc b/src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.cc -index 78195a324..b1c5835ff 100644 ---- a/src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.cc -+++ b/src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.cc -@@ -110,7 +110,7 @@ SupportedVideoDecoderConfigs FFmpegVideoDecoder::SupportedConfigsForWebRTC() { - } - - FFmpegVideoDecoder::FFmpegVideoDecoder(MediaLog* media_log) -- : media_log_(media_log) { -+ : media_log_(media_log), timestamp_map_(128) { - DVLOG(1) << __func__; - DETACH_FROM_SEQUENCE(sequence_checker_); - } -@@ -215,7 +215,6 @@ int FFmpegVideoDecoder::GetVideoBuffer(struct AVCodecContext* codec_context, - frame->width = coded_size.width(); - frame->height = coded_size.height(); - frame->format = codec_context->pix_fmt; -- frame->reordered_opaque = codec_context->reordered_opaque; - - // Now create an AVBufferRef for the data just allocated. It will own the - // reference to the VideoFrame object. -@@ -354,7 +353,10 @@ bool FFmpegVideoDecoder::FFmpegDecode(const DecoderBuffer& buffer) { - DCHECK_GT(packet->size, 0); - - // Let FFmpeg handle presentation timestamp reordering. -- codec_context_->reordered_opaque = buffer.timestamp().InMicroseconds(); -+ const int64_t timestamp = buffer.timestamp().InMicroseconds(); -+ const TimestampId timestamp_id = timestamp_id_generator_.GenerateNextId(); -+ timestamp_map_.Put(std::make_pair(timestamp_id, timestamp)); -+ packet->opaque = reinterpret_cast(timestamp_id.GetUnsafeValue()); - } - FFmpegDecodingLoop::DecodeStatus decode_status = decoding_loop_->DecodePacket( - packet, base::BindRepeating(&FFmpegVideoDecoder::OnNewFrame, -@@ -394,7 +396,13 @@ bool FFmpegVideoDecoder::OnNewFrame(AVFrame* frame) { - - scoped_refptr video_frame = - reinterpret_cast(av_buffer_get_opaque(frame->buf[0])); -- video_frame->set_timestamp(base::Microseconds(frame->reordered_opaque)); -+ const auto ts_id = TimestampId(reinterpret_cast(frame->opaque)); -+ const auto ts_lookup = timestamp_map_.Get(ts_id); -+ if (ts_lookup == timestamp_map_.end()) { -+ return false; -+ } -+ const auto pts = base::Microseconds(std::get<1>(*ts_lookup)); -+ video_frame->set_timestamp(pts); - video_frame->metadata().power_efficient = false; - output_cb_.Run(video_frame); - return true; -@@ -422,6 +430,7 @@ bool FFmpegVideoDecoder::ConfigureDecoder(const VideoDecoderConfig& config, - FF_THREAD_SLICE | (low_delay ? 0 : FF_THREAD_FRAME); - codec_context_->opaque = this; - codec_context_->get_buffer2 = GetVideoBufferImpl; -+ codec_context_->flags |= AV_CODEC_FLAG_COPY_OPAQUE; - - if (decode_nalus_) - codec_context_->flags2 |= AV_CODEC_FLAG2_CHUNKS; -diff --git a/src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.h b/src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.h -index 753651166..0dfd66e61 100644 ---- a/src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.h -+++ b/src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.h -@@ -7,10 +7,12 @@ - - #include - -+#include "base/containers/lru_cache.h" - #include "base/callback.h" - #include "base/memory/raw_ptr.h" - #include "base/memory/ref_counted.h" - #include "base/sequence_checker.h" -+#include "base/types/id_type.h" - #include "media/base/supported_video_decoder_config.h" - #include "media/base/video_decoder.h" - #include "media/base/video_decoder_config.h" -@@ -88,6 +90,20 @@ class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder { - // FFmpeg structures owned by this object. - std::unique_ptr codec_context_; - -+ // The gist here is that timestamps need to be 64 bits to store microsecond -+ // precision. A 32 bit integer would overflow at ~35 minutes at this level of -+ // precision. We can't cast the timestamp to the void ptr object used by the -+ // opaque field in ffmpeg then, because it would lose data on a 32 bit build. -+ // However, we don't actually have 2^31 timestamped frames in a single -+ // playback, so it's fine to use the 32 bit value as a key in a map which -+ // contains the actual timestamps. Additionally, we've in the past set 128 -+ // outstanding frames for re-ordering as a limit for cross-thread decoding -+ // tasks, so we'll do that here too with the LRU cache. -+ using TimestampId = base::IdType; -+ -+ TimestampId::Generator timestamp_id_generator_; -+ base::LRUCache timestamp_map_; -+ - VideoDecoderConfig config_; - - VideoFramePool frame_pool_; -diff --git a/src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc b/src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc -index c96a1c80c..0c6b49ef8 100644 ---- a/src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc -+++ b/src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc -@@ -212,7 +212,6 @@ int H264DecoderImpl::AVGetBuffer2(AVCodecContext* context, - int total_size = y_size + 2 * uv_size; - - av_frame->format = context->pix_fmt; -- av_frame->reordered_opaque = context->reordered_opaque; - - // Create a VideoFrame object, to keep a reference to the buffer. - // TODO(nisse): The VideoFrame's timestamp and rotation info is not used. -@@ -360,8 +359,6 @@ int32_t H264DecoderImpl::Decode(const EncodedImage& input_image, - return WEBRTC_VIDEO_CODEC_ERROR; - } - packet->size = static_cast(input_image.size()); -- int64_t frame_timestamp_us = input_image.ntp_time_ms_ * 1000; // ms -> μs -- av_context_->reordered_opaque = frame_timestamp_us; - - int result = avcodec_send_packet(av_context_.get(), packet.get()); - -@@ -378,10 +375,6 @@ int32_t H264DecoderImpl::Decode(const EncodedImage& input_image, - return WEBRTC_VIDEO_CODEC_ERROR; - } - -- // We don't expect reordering. Decoded frame timestamp should match -- // the input one. -- RTC_DCHECK_EQ(av_frame_->reordered_opaque, frame_timestamp_us); -- - // TODO(sakal): Maybe it is possible to get QP directly from FFmpeg. - h264_bitstream_parser_.ParseBitstream(input_image); - absl::optional qp = h264_bitstream_parser_.GetLastSliceQp(); --- -2.25.1 - diff --git a/CVE-2023-6112.patch b/CVE-2023-6112.patch deleted file mode 100644 index 077156948a9b09e8a06929e8c4e3d0bc69bc5cc5..0000000000000000000000000000000000000000 --- a/CVE-2023-6112.patch +++ /dev/null @@ -1,29 +0,0 @@ -From b727ffde2b4ffe8b979927d6dc9f056eb916a8b8 Mon Sep 17 00:00:00 2001 -From: peijiankang -Date: Tue, 30 Jan 2024 09:43:39 +0800 -Subject: [PATCH] CVE-2023-6112 - ---- - .../content/browser/loader/navigation_url_loader_impl.cc | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/3rdparty/chromium/content/browser/loader/navigation_url_loader_impl.cc b/src/3rdparty/chromium/content/browser/loader/navigation_url_loader_impl.cc -index f54cfd9a6..41c78e2fe 100644 ---- a/src/3rdparty/chromium/content/browser/loader/navigation_url_loader_impl.cc -+++ b/src/3rdparty/chromium/content/browser/loader/navigation_url_loader_impl.cc -@@ -560,10 +560,10 @@ void NavigationURLLoaderImpl::MaybeStartLoader( - next_interceptor->MaybeCreateLoader( - *resource_request_, browser_context_, - base::BindOnce(&NavigationURLLoaderImpl::MaybeStartLoader, -- base::Unretained(this), next_interceptor), -+ weak_factory_.GetWeakPtr(), next_interceptor), - base::BindOnce( - &NavigationURLLoaderImpl::FallbackToNonInterceptedRequest, -- base::Unretained(this))); -+ weak_factory_.GetWeakPtr())); - return; - } - --- -2.41.0 - diff --git a/qt6-qtwebengine.spec b/qt6-qtwebengine.spec index 372b908b5d776625eaf60b53d369402bd0e63d9a..f211b60f6a94da641538f8c064e42baa9fc13e20 100644 --- a/qt6-qtwebengine.spec +++ b/qt6-qtwebengine.spec @@ -1,9 +1,14 @@ %global qt_module qtwebengine +%global qtbase_version 6.8.0 + +%global examples 1 + +%bcond_without doc %global _hardened_build 1 # package-notes causes FTBFS (#2043178) -%undefine _package_note_file +%undefine _package_note_flags %global use_system_libwebp 1 %global use_system_jsoncpp 1 @@ -38,21 +43,16 @@ Summary: Qt6 - QtWebEngine components Name: qt6-qtwebengine -Version: 6.5.2 -Release: 4 +Version: 6.9.0 +Release: 1 # See LICENSE.GPL LICENSE.LGPL LGPL_EXCEPTION.txt, for details # See also http://qt-project.org/doc/qt-5.0/qtdoc/licensing.html # The other licenses are from Chromium and the code it bundles License: BSD-3-Clause and GPL-3.0-only and LGPL-3.0-only -URL: http://www.qt.io -# cleaned tarball with patent-encumbered codecs removed from the bundled FFmpeg -# ./qtwebengine-release.sh -# ./clean_qtwebengine.sh 6.4.1 -# remove Source0 file for fix Eulermaker failure -Source0: qtwebengine-everywhere-src-%{version}-clean.tar.xz -Source100: qtwebengine-everywhere-src-%{version}-clean.tar.xz.0 -Source101: qtwebengine-everywhere-src-%{version}-clean.tar.xz.1 +URL: https://www.qt.io +%global majmin %(echo %{version} | cut -d. -f1-2) +Source0: https://download.qt.io/official_releases/qt/%{majmin}/%{version}/submodules/qtwebengine-everywhere-src-%{version}.tar.xz # cleanup scripts used above Source2: clean_qtwebengine.sh @@ -69,49 +69,40 @@ Patch1: qtwebengine-SIOCGSTAMP.patch Patch2: qtwebengine-link-pipewire.patch # Fix/workaround FTBFS on aarch64 with newer glibc Patch3: qtwebengine-aarch64-new-stat.patch -Patch4: qtwebengine-ffmpeg-first_dts.patch # FTBS warning: elaborated-type-specifier for a scoped enum must not # use the 'class' keyword Patch50: qtwebengine-fix-build.patch ## Upstream patches: -# https://webrtc-review.googlesource.com/c/src/+/285464 -Patch100: qtwebengine-webrtc-dlopen-h264.patch +# https://bugreports.qt.io/browse/QTBUG-129985 +Patch80: qtwebengine-fix-arm-build.patch -## Upstreamable patches: -Patch110: qtwebengine-blink-dlopen-h264.patch -#https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/518607 -Patch111: CVE-2023-6112.patch +## Upstream patches: +# https://webrtc-review.googlesource.com/c/src/+/285464 +Patch110: qtwebengine-rtc-dont-use-h264.patch # handled by qt6-srpm-macros, which defines %%qt6_qtwebengine_arches # FIXME use/update qt6_qtwebengine_arches # 32-bit arches not supported (https://bugreports.qt.io/browse/QTBUG-102143) ExclusiveArch: aarch64 x86_64 riscv64 -Patch120: qtwebengine-icu-74.patch -Patch121: 0001-qtwebengine-fix-building-with-system-ffmpeg7.1.patch - ## Add riscv64 patches -Patch1000: riscv-angle.patch -Patch1001: riscv-breakpad.patch -Patch1002: riscv-crashpad.patch Patch1003: riscv-dav1d.patch Patch1004: riscv-sandbox.patch BuildRequires: cmake BuildRequires: make BuildRequires: qt6-srpm-macros -BuildRequires: qt6-qtbase-devel +BuildRequires: qt6-qtbase-devel >= %{qtbase_version} BuildRequires: qt6-qtbase-private-devel # TODO: check of = is really needed or if >= would be good enough -- rex %{?_qt6:Requires: %{_qt6}%{?_isa} = %{_qt6_version}} -BuildRequires: qt6-qtdeclarative-devel -BuildRequires: qt6-qtlocation-devel -BuildRequires: qt6-qtsensors-devel -BuildRequires: qt6-qtsvg-devel -BuildRequires: qt6-qttools-static -BuildRequires: qt6-qtquickcontrols2-devel -BuildRequires: qt6-qtwebchannel-devel +BuildRequires: qt6-qtdeclarative-devel >= %{qtbase_version} +BuildRequires: qt6-qtlocation-devel >= %{qtbase_version} +BuildRequires: qt6-qtsensors-devel >= %{qtbase_version} +BuildRequires: qt6-qtsvg-devel >= %{qtbase_version} +BuildRequires: qt6-qttools-static >= %{qtbase_version} +BuildRequires: qt6-qtwebchannel-devel >= %{qtbase_version} # for examples? BuildRequires: ninja-build BuildRequires: cmake @@ -191,6 +182,9 @@ BuildRequires: pkgconfig(vpx) >= 1.8.0 BuildRequires: pkgconfig(libavcodec) BuildRequires: pkgconfig(libavformat) BuildRequires: pkgconfig(libavutil) +%if %{with doc} +BuildRequires: /usr/bin/qdoc-qt6 +%endif # extra (non-upstream) functions needed, see # src/3rdparty/chromium/third_party/sqlite/README.chromium for details @@ -212,7 +206,7 @@ Requires: qt6-qtpdf%{?_isa} = %{version}-%{release} # Of course, Chromium itself is bundled. It cannot be unbundled because it is # not a library, but forked (modified) application code. -Provides: bundled(chromium) = 102.0.5005.177 +Provides: bundled(chromium) = 118.0.5993.220 # Bundled in src/3rdparty/chromium/third_party: # Check src/3rdparty/chromium/third_party/*/README.chromium for version numbers, @@ -302,7 +296,7 @@ Provides: bundled(nsURLParsers) # Bundled outside of third_party, apparently not considered as such by Chromium: Provides: bundled(mojo) # see src/3rdparty/chromium/v8/include/v8_version.h for the version number -Provides: bundled(v8) = 10.2.154.16 +Provides: bundled(v8) = 11.8.172.18 # bundled by v8 (src/3rdparty/chromium/v8/src/base/ieee754.cc) # The version number is 5.3, the last version that upstream released, years ago: # http://www.netlib.org/fdlibm/readme @@ -316,8 +310,8 @@ Provides: bundled(fdlibm) = 5.3 %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} -Requires: qt6-qtbase-devel%{?_isa} -Requires: qt6-qtdeclarative-devel%{?_isa} +Requires: qt6-qtbase-devel%{?_isa} >= %{_qt6_version} +Requires: qt6-qtdeclarative-devel%{?_isa} >= %{_qt6_version} Requires: qt6-qtpdf-devel%{?_isa} = %{version}-%{release} # not arch'd for now, see if can get away with avoiding multilib'ing -- rex Requires: %{name}-devtools = %{version}-%{release} @@ -344,8 +338,8 @@ Summary: Qt6 - QtPdf components %package -n qt6-qtpdf-devel Summary: Development files for qt6-qtpdf Requires: qt6-qtpdf%{?_isa} = %{version}-%{release} -Requires: qt6-qtbase-devel%{?_isa} -Requires: qt6-qtdeclarative-devel%{?_isa} +Requires: qt6-qtbase-devel%{?_isa} >= %{_qt6_version} +Requires: qt6-qtdeclarative-devel%{?_isa} >= %{_qt6_version} %description -n qt6-qtpdf-devel %{summary}. @@ -355,39 +349,23 @@ Summary: Example files for qt6-qtpdf %description -n qt6-qtpdf-examples %{summary}. +%package doc +Summary: Documentation for %{qt_module} +Buildarch: noarch + +%description doc +Documentation for %{qt_module}. + %prep -cat %{SOURCE100} %{SOURCE101} > %{SOURCE0} %setup -q -n %{qt_module}-everywhere-src-%{version} -a20 - +%autopatch -p1 -M 999 mv pulse src/3rdparty/chromium/ -pushd src/3rdparty/chromium +pushd src/3rdparty +# Add riscv64 patches +%autopatch -p0 -m 1000 -M 1999 popd -%patch -P1 -p1 -b .SIOCGSTAMP -%patch -P2 -p1 -b .link-pipewire -%patch -P3 -p1 -b .aarch64-new-stat -%patch -P4 -p1 -b .qtwebengine-ffmpeg-first_dts - -%patch -P50 -p1 -b .fix-build.patch - -## upstream patches -%patch -P100 -p1 -b .webrtc-dlopen-h264 - -## upstreamable patches -%patch -P110 -p1 -b .blink-dlopen-h264 -%patch -P111 -p1 - -%patch -P120 -p1 -%patch -P121 -p1 - -## Add riscv64 patches -%patch -P1000 -p0 -d src/3rdparty -%patch -P1001 -p0 -d src/3rdparty -%patch -P1002 -p0 -d src/3rdparty -%patch -P1003 -p0 -d src/3rdparty -%patch -P1004 -p0 -d src/3rdparty - # delete all "toolprefix = " lines from build/toolchain/linux/BUILD.gn, as we # never cross-compile in native Fedora RPMs, fixes ARM and aarch64 FTBFS sed -i -e '/toolprefix = /d' -e 's/\${toolprefix}//g' \ @@ -427,6 +405,8 @@ cp -p src/3rdparty/chromium/LICENSE LICENSE.Chromium export STRIP=strip export NINJAFLAGS="%{__ninja_common_opts}" export NINJA_PATH=%{__ninja} +export LDFLAGS="%{build_ldflags} -Wl,--no-keep-memory" +%define _lto_cflags %{nil} %cmake_qt6 \ -DCMAKE_TOOLCHAIN_FILE:STRING="%{_libdir}/cmake/Qt6/qt.toolchain.cmake" \ @@ -434,6 +414,7 @@ export NINJA_PATH=%{__ninja} -DFEATURE_webengine_developer_build:BOOL=OFF \ -DFEATURE_webengine_embedded_build:BOOL=OFF \ -DFEATURE_webengine_extensions:BOOL=ON \ + -DFEATURE_webengine_jumbo_build:BOOL=OFF \ -DFEATURE_webengine_kerberos:BOOL=ON \ -DFEATURE_webengine_native_spellchecker:BOOL=OFF \ -DFEATURE_webengine_printing_and_pdf:BOOL=ON \ @@ -443,14 +424,22 @@ export NINJA_PATH=%{__ninja} -DFEATURE_webengine_system_ffmpeg:BOOL=ON \ -DFEATURE_webengine_webrtc:BOOL=ON \ -DFEATURE_webengine_webrtc_pipewire:BOOL=ON \ - -DQT_BUILD_EXAMPLES:BOOL=ON + -DQT_BUILD_EXAMPLES:BOOL=%{?examples:ON}%{!?examples:OFF} \ + -DQT_INSTALL_EXAMPLES_SOURCES=%{?examples:ON}%{!?examples:OFF} %cmake_build +%if %{with doc} +%cmake_build --target docs +%endif %install %cmake_install +%if %{with doc} +DESTDIR="%{buildroot}" %{__cmake} --build %{__cmake_builddir} --target install_docs +%endif + # rpm macros install -p -m644 -D %{SOURCE10} \ %{buildroot}%{_rpmmacrodir}/macros.qt6-qtwebengine @@ -484,7 +473,6 @@ sed -i -e "s|%{version} \${_Qt6WebEngine|%{lesser_version} \${_Qt6WebEngine|" \ %{buildroot}%{_qt6_libdir}/cmake/Qt6WebEngine*/Qt6WebEngine*Config.cmake -#%filetriggerin -- %{_datadir}/myspell %filetriggerin -- %{_datadir}/hunspell while read filename ; do @@ -498,9 +486,7 @@ done %files %license LICENSE.* -%if 0%{?docs} -%license src/webengine/doc/src/qtwebengine-3rdparty.qdoc -%endif +%{_qt6_archdatadir}/sbom/%{qt_module}-%{version}.spdx %{_qt6_libdir}/libQt6WebEngineCore.so.* %{_qt6_libdir}/libQt6WebEngineQuick.so.* %{_qt6_libdir}/libQt6WebEngineQuickDelegatesQml.so.* @@ -508,10 +494,12 @@ done %{_qt6_libdir}/qt6/libexec/gn %{_qt6_libdir}/qt6/libexec/qwebengine_convert_dict %{_qt6_libdir}/qt6/libexec/QtWebEngineProcess +%{_qt6_libdir}/qt6/libexec/webenginedriver %dir %{_qt6_libdir}/qt6/qml/QtWebEngine %{_qt6_libdir}/qt6/qml/QtWebEngine/* %{_qt6_plugindir}/designer/libqwebengineview.so %dir %{_qt6_datadir}/resources/ +%{_qt6_datadir}/resources/v8_context_snapshot.bin %{_qt6_datadir}/resources/qtwebengine_resources.pak %{_qt6_datadir}/resources/qtwebengine_resources_100p.pak %{_qt6_datadir}/resources/qtwebengine_resources_200p.pak @@ -582,8 +570,8 @@ done %{_qt6_headerdir}/QtWebEngineQuick/* %dir %{_qt6_headerdir}/QtWebEngineWidgets %{_qt6_headerdir}/QtWebEngineWidgets/* -%{_qt6_libdir}/qt6/metatypes/qt6webengine*.json -%{_qt6_libdir}/qt6/modules/WebEngine*.json +%{_qt6_metatypesdir}/qt6webengine*.json +%{_qt6_descriptionsdir}/WebEngine*.json %{_qt6_libdir}/libQt6WebEngineCore.so %{_qt6_libdir}/libQt6WebEngineQuick.so %{_qt6_libdir}/libQt6WebEngineQuickDelegatesQml.so @@ -611,7 +599,7 @@ done %{_qt6_libdir}/pkgconfig/Qt6WebEngineQuick.pc %{_qt6_libdir}/pkgconfig/Qt6WebEngineQuickDelegatesQml.pc %{_qt6_libdir}/pkgconfig/Qt6WebEngineWidgets.pc -%{_qt6_archdatadir}/mkspecs/modules/qt_lib_webengine*.pri +%{_qt6_mkspecsdir}/modules/qt_lib_webengine*.pri %files devtools %{_qt6_datadir}/resources/qtwebengine_devtools_resources.pak @@ -619,13 +607,14 @@ done %files examples %{_qt6_examplesdir}/webengine* -%if 0%{?docs} +%if %{with doc} %files doc %{_qt6_docdir}/* %endif %files -n qt6-qtpdf %license LICENSE.* +%{_qt6_archdatadir}/sbom/qtpdf-%{version}.spdx %{_qt6_libdir}/libQt6Pdf.so.* %{_qt6_libdir}/libQt6PdfQuick.so.* %{_qt6_libdir}/libQt6PdfWidgets.so.* @@ -640,8 +629,8 @@ done %{_qt6_headerdir}/QtPdfQuick/* %dir %{_qt6_headerdir}/QtPdfWidgets %{_qt6_headerdir}/QtPdfWidgets/* -%{_qt6_libdir}/qt6/metatypes/qt6pdf*.json -%{_qt6_libdir}/qt6/modules/Pdf*.json +%{_qt6_metatypesdir}/qt6pdf*.json +%{_qt6_descriptionsdir}/Pdf*.json %{_qt6_libdir}/libQt6Pdf.so %{_qt6_libdir}/libQt6PdfQuick.so %{_qt6_libdir}/libQt6PdfWidgets.so @@ -659,13 +648,16 @@ done %{_qt6_libdir}/pkgconfig/Qt6Pdf.pc %{_qt6_libdir}/pkgconfig/Qt6PdfQuick.pc %{_qt6_libdir}/pkgconfig/Qt6PdfWidgets.pc -%{_qt6_archdatadir}/mkspecs/modules/qt_lib_pdf*.pri +%{_qt6_mkspecsdir}/modules/qt_lib_pdf*.pri %files -n qt6-qtpdf-examples %{_qt6_examplesdir}/pdf* %changelog +* Wed Apr 30 2025 Funda Wang - 6.9.0-1 +- update to 6.9.0 + * Mon Feb 17 2025 peijiankang - 6.5.2-4 - qtwebengine fix build error with ffmpeg-7.1 diff --git a/qtwebengine-blink-dlopen-h264.patch b/qtwebengine-blink-dlopen-h264.patch deleted file mode 100644 index 5cf7cc470f40a83a16a575ead94ff808d3743a0e..0000000000000000000000000000000000000000 --- a/qtwebengine-blink-dlopen-h264.patch +++ /dev/null @@ -1,154 +0,0 @@ -From 828d03c76b3b108019b1cf66062b0e9679012207 Mon Sep 17 00:00:00 2001 -From: Jan Grulich -Date: Mon, 23 Jan 2023 11:04:00 +0100 -Subject: [Blink] mediarecorder: allow to dlopen openh264 - - -diff --git a/src/3rdparty/chromium/third_party/blink/renderer/modules/mediarecorder/BUILD.gn b/src/3rdparty/chromium/third_party/blink/renderer/modules/mediarecorder/BUILD.gn -index cf6de49bef6b2..61e8879d6b97f 100644 ---- a/src/3rdparty/chromium/third_party/blink/renderer/modules/mediarecorder/BUILD.gn -+++ b/src/3rdparty/chromium/third_party/blink/renderer/modules/mediarecorder/BUILD.gn -@@ -5,12 +5,23 @@ - import("//build/buildflag_header.gni") - import("//third_party/blink/renderer/modules/modules.gni") - import("//third_party/webrtc/webrtc.gni") -+import("//tools/generate_stubs/rules.gni") - - buildflag_header("buildflags") { - header = "buildflags.h" - flags = [ "RTC_USE_H264=$rtc_use_h264" ] - } - -+if (rtc_use_h264 && rtc_dlopen_openh264) { -+ # When OpenH264 is not directly linked, use stubs to allow for dlopening of -+ # the binary. -+ generate_stubs("openh264_stubs") { -+ extra_header = "openh264_stub_header.fragment" -+ output_name = "openh264_stubs" -+ sigs = [ "openh264.sigs" ] -+ } -+} -+ - blink_modules_sources("mediarecorder") { - sources = [ - "audio_track_encoder.cc", -@@ -56,6 +67,11 @@ blink_modules_sources("mediarecorder") { - "h264_encoder.h", - ] - -- deps += [ "//third_party/openh264:encoder" ] -+ if (rtc_dlopen_openh264) { -+ defines = [ "BLINK_DLOPEN_OPENH264" ] -+ deps += [ ":openh264_stubs" ] -+ } else { -+ deps += [ "//third_party/openh264:encoder" ] -+ } - } - } -diff --git a/src/3rdparty/chromium/third_party/blink/renderer/modules/mediarecorder/h264_encoder.cc b/src/3rdparty/chromium/third_party/blink/renderer/modules/mediarecorder/h264_encoder.cc -index c9aee6f3a..0f4ef593d 100644 ---- a/src/3rdparty/chromium/third_party/blink/renderer/modules/mediarecorder/h264_encoder.cc -+++ b/src/3rdparty/chromium/third_party/blink/renderer/modules/mediarecorder/h264_encoder.cc -@@ -24,10 +24,22 @@ - #include "third_party/openh264/src/codec/api/svc/codec_def.h" - #include "ui/gfx/geometry/size.h" - -+#if defined(BLINK_DLOPEN_OPENH264) -+#include "third_party/blink/renderer/modules/mediarecorder/openh264_stubs.h" -+#endif // defined(BLINK_DLOPEN_OPENH264) -+ - namespace blink { - - namespace { - -+#if defined(BLINK_DLOPEN_OPENH264) -+using third_party_blink_renderer_modules_mediarecorder::InitializeStubs; -+using third_party_blink_renderer_modules_mediarecorder::kModuleOpenh264; -+using third_party_blink_renderer_modules_mediarecorder::StubPathMap; -+ -+static constexpr char kOpenH264Lib[] = "libopenh264.so.7"; -+#endif -+ - absl::optional ToOpenH264Profile( - media::VideoCodecProfile profile) { - static const HashMap -@@ -98,6 +110,13 @@ H264Encoder::H264Encoder( - codec_profile_(codec_profile) { - DCHECK(encoding_thread_); - DCHECK_EQ(codec_profile_.codec_id, VideoTrackRecorder::CodecId::kH264); -+ -+#if defined(BLINK_DLOPEN_OPENH264) -+ StubPathMap paths; -+ paths[kModuleOpenh264].push_back(kOpenH264Lib); -+ -+ openh264_dlopened_ = InitializeStubs(paths); -+#endif - } - - H264Encoder::~H264Encoder() { -@@ -180,6 +199,14 @@ void H264Encoder::EncodeOnEncodingTaskRunner( - bool H264Encoder::ConfigureEncoderOnEncodingTaskRunner(const gfx::Size& size) { - TRACE_EVENT0("media", "H264Encoder::ConfigureEncoderOnEncodingTaskRunner"); - DCHECK(encoding_task_runner_->RunsTasksInCurrentSequence()); -+ -+#if defined(BLINK_DLOPEN_OPENH264) -+ if (!openh264_dlopened_) { -+ NOTREACHED() << "Failed to dlopen openh264"; -+ return false; -+ } -+#endif -+ - ISVCEncoder* temp_encoder = nullptr; - if (WelsCreateSVCEncoder(&temp_encoder) != 0) { - NOTREACHED() << "Failed to create OpenH264 encoder"; -diff --git a/src/3rdparty/chromium/third_party/blink/renderer/modules/mediarecorder/h264_encoder.h b/src/3rdparty/chromium/third_party/blink/renderer/modules/mediarecorder/h264_encoder.h -index e7aa2c338..79e902f67 100644 ---- a/src/3rdparty/chromium/third_party/blink/renderer/modules/mediarecorder/h264_encoder.h -+++ b/src/3rdparty/chromium/third_party/blink/renderer/modules/mediarecorder/h264_encoder.h -@@ -62,6 +62,8 @@ class MODULES_EXPORT H264Encoder final : public VideoTrackRecorder::Encoder { - // The |VideoFrame::timestamp()| of the first received frame. Only used on - // VideoTrackRecorder::Encoder::encoding_thread_. - base::TimeTicks first_frame_timestamp_; -+ -+ bool openh264_dlopened_ = false; - }; - - } // namespace blink - -diff --git a/src/3rdparty/chromium/third_party/blink/renderer/modules/mediarecorder/openh264.sigs b/src/3rdparty/chromium/third_party/blink/renderer/modules/mediarecorder/openh264.sigs -new file mode 100644 -index 0000000000000..4924f8e9a17de ---- /dev/null -+++ b/src/3rdparty/chromium/third_party/blink/renderer/modules/mediarecorder/openh264.sigs -@@ -0,0 +1,14 @@ -+// Copyright 2022 The WebRTC project authors. All rights reserved. -+// Use of this source code is governed by a BSD-style license that can be -+// found in the LICENSE file. -+ -+//------------------------------------------------ -+// Functions from OpenH264. -+//------------------------------------------------ -+int WelsCreateSVCEncoder(ISVCEncoder **ppEncoder); -+void WelsDestroySVCEncoder(ISVCEncoder *pEncoder); -+int WelsGetDecoderCapability(SDecoderCapability *pDecCapability); -+long WelsCreateDecoder(ISVCDecoder **ppDecoder); -+void WelsDestroyDecoder(ISVCDecoder *pDecoder); -+OpenH264Version WelsGetCodecVersion(void); -+void WelsGetCodecVersionEx(OpenH264Version *pVersion); -diff --git a/src/3rdparty/chromium/third_party/blink/renderer/modules/mediarecorder/openh264_stub_header.fragment b/src/3rdparty/chromium/third_party/blink/renderer/modules/mediarecorder/openh264_stub_header.fragment -new file mode 100644 -index 0000000000000..9bc0a7cbee038 ---- /dev/null -+++ b/src/3rdparty/chromium/third_party/blink/renderer/modules/mediarecorder/openh264_stub_header.fragment -@@ -0,0 +1,11 @@ -+// The extra include header needed in the generated stub file for defining -+// various OpenH264 types. -+ -+extern "C" { -+ -+#include "third_party/openh264/src/codec/api/svc/codec_api.h" -+#include "third_party/openh264/src/codec/api/svc/codec_app_def.h" -+#include "third_party/openh264/src/codec/api/svc/codec_def.h" -+#include "third_party/openh264/src/codec/api/svc/codec_ver.h" -+ -+} diff --git a/qtwebengine-everywhere-src-6.5.2-clean.tar.xz.0 b/qtwebengine-everywhere-src-6.5.2-clean.tar.xz.0 deleted file mode 100644 index a237aae3c4867a3f2d8b74584943f71b0d5edd15..0000000000000000000000000000000000000000 Binary files a/qtwebengine-everywhere-src-6.5.2-clean.tar.xz.0 and /dev/null differ diff --git a/qtwebengine-everywhere-src-6.5.2-clean.tar.xz.1 b/qtwebengine-everywhere-src-6.5.2-clean.tar.xz.1 deleted file mode 100644 index dfda535b42f9db5ff4ce6678b08d1fe84302a685..0000000000000000000000000000000000000000 Binary files a/qtwebengine-everywhere-src-6.5.2-clean.tar.xz.1 and /dev/null differ diff --git a/qtwebengine-everywhere-src-6.9.0.tar.xz b/qtwebengine-everywhere-src-6.9.0.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..2a4aa3aacfe562df820fc6972f335562bc690e9d --- /dev/null +++ b/qtwebengine-everywhere-src-6.9.0.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2b33d1c85e85ed58729db228448f92105ab746ffdc9b98f0c4e3bf00b789789e +size 672153992 diff --git a/qtwebengine-ffmpeg-first_dts.patch b/qtwebengine-ffmpeg-first_dts.patch deleted file mode 100644 index 0d8a3e8b6a0bd2ee035321eec7b422045983f7e7..0000000000000000000000000000000000000000 --- a/qtwebengine-ffmpeg-first_dts.patch +++ /dev/null @@ -1,168 +0,0 @@ -diff --git a/configure.cmake b/configure.cmake -index b20ab3b65..c41f66301 100644 ---- a/configure.cmake -+++ b/configure.cmake -@@ -203,25 +203,6 @@ int main(void){ - }" - ) - --qt_config_compile_test(libavformat -- LABEL "libavformat" -- LIBRARIES -- PkgConfig::FFMPEG -- CODE --" --#include \"libavformat/version.h\" --extern \"C\" { --#include \"libavformat/avformat.h\" --} --int main(void) { --#if LIBAVFORMAT_VERSION_MAJOR >= 59 -- AVStream stream; -- auto first_dts = av_stream_get_first_dts(&stream); --#endif -- return 0; --}" --) -- - #### Features - - qt_feature("qtwebengine-build" PUBLIC -@@ -542,11 +523,6 @@ add_check_for_support( - CONDITION NOT LINUX OR DBUS_FOUND - MESSAGE "Build requires dbus." - ) --add_check_for_support( -- MODULES QtWebEngine -- CONDITION NOT LINUX OR NOT QT_FEATURE_webengine_system_ffmpeg OR TEST_libavformat -- MESSAGE "Unmodified ffmpeg >= 5.0 is not supported." --) - # FIXME: This prevents non XCB Linux builds from building: - set(xcbSupport X11 LIBDRM XCOMPOSITE XCURSOR XRANDR XI XPROTO XSHMFENCE XTST) - foreach(xs ${xcbSupport}) -diff --git a/src/3rdparty/chromium/AUTHORS b/src/3rdparty/chromium/AUTHORS -index 8d638184b..80e4a9b35 100644 ---- a/src/3rdparty/chromium/AUTHORS -+++ b/src/3rdparty/chromium/AUTHORS -@@ -94,6 +94,7 @@ Andra Paraschiv - Andras Tokodi - Andreas Nazlidis - Andreas Papacharalampous -+Andreas Schneider - Andrei Borza - Andrei Parvu - Andrei Parvu -diff --git a/src/3rdparty/chromium/media/filters/ffmpeg_demuxer.cc b/src/3rdparty/chromium/media/filters/ffmpeg_demuxer.cc -index 7b709d70d..d97b6b4d0 100644 ---- a/src/3rdparty/chromium/media/filters/ffmpeg_demuxer.cc -+++ b/src/3rdparty/chromium/media/filters/ffmpeg_demuxer.cc -@@ -58,7 +58,7 @@ namespace media { - - namespace { - --constexpr int64_t kInvalidPTSMarker = static_cast(0x8000000000000000); -+constexpr int64_t kRelativeTsBase = static_cast(0x7ffeffffffffffff); - - void SetAVStreamDiscard(AVStream* stream, AVDiscard discard) { - DCHECK(stream); -@@ -101,7 +101,7 @@ static base::TimeDelta FramesToTimeDelta(int frames, double sample_rate) { - sample_rate); - } - --static base::TimeDelta ExtractStartTime(AVStream* stream) { -+static base::TimeDelta ExtractStartTime(AVStream* stream, int64_t first_dts) { - // The default start time is zero. - base::TimeDelta start_time; - -@@ -111,12 +111,12 @@ static base::TimeDelta ExtractStartTime(AVStream* stream) { - - // Next try to use the first DTS value, for codecs where we know PTS == DTS - // (excludes all H26x codecs). The start time must be returned in PTS. -- if (av_stream_get_first_dts(stream) != kInvalidPTSMarker && -+ if (first_dts != AV_NOPTS_VALUE && - stream->codecpar->codec_id != AV_CODEC_ID_HEVC && - stream->codecpar->codec_id != AV_CODEC_ID_H264 && - stream->codecpar->codec_id != AV_CODEC_ID_MPEG4) { - const base::TimeDelta first_pts = -- ConvertFromTimeBase(stream->time_base, av_stream_get_first_dts(stream)); -+ ConvertFromTimeBase(stream->time_base, first_dts); - if (first_pts < start_time) - start_time = first_pts; - } -@@ -285,6 +285,7 @@ FFmpegDemuxerStream::FFmpegDemuxerStream( - fixup_negative_timestamps_(false), - fixup_chained_ogg_(false), - num_discarded_packet_warnings_(0), -+ first_dts_(AV_NOPTS_VALUE), - last_packet_pos_(AV_NOPTS_VALUE), - last_packet_dts_(AV_NOPTS_VALUE) { - DCHECK(demuxer_); -@@ -351,6 +352,11 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) { - int64_t packet_dts = - packet->dts == AV_NOPTS_VALUE ? packet->pts : packet->dts; - -+ if (first_dts_ == AV_NOPTS_VALUE && packet->dts != AV_NOPTS_VALUE && -+ last_packet_dts_ != AV_NOPTS_VALUE) { -+ first_dts_ = packet->dts - (last_packet_dts_ + kRelativeTsBase); -+ } -+ - // Chained ogg files have non-monotonically increasing position and time stamp - // values, which prevents us from using them to determine if a packet should - // be dropped. Since chained ogg is only allowed on single track audio only -@@ -698,6 +704,7 @@ void FFmpegDemuxerStream::FlushBuffers(bool preserve_packet_position) { - ResetBitstreamConverter(); - - if (!preserve_packet_position) { -+ first_dts_ = AV_NOPTS_VALUE; - last_packet_pos_ = AV_NOPTS_VALUE; - last_packet_dts_ = AV_NOPTS_VALUE; - } -@@ -1449,7 +1456,8 @@ void FFmpegDemuxer::OnFindStreamInfoDone(int result) { - - max_duration = std::max(max_duration, streams_[i]->duration()); - -- base::TimeDelta start_time = ExtractStartTime(stream); -+ base::TimeDelta start_time = -+ ExtractStartTime(stream, streams_[i]->first_dts()); - - // Note: This value is used for seeking, so we must take the true value and - // not the one possibly clamped to zero below. -@@ -1606,7 +1614,7 @@ FFmpegDemuxerStream* FFmpegDemuxer::FindStreamWithLowestStartTimestamp( - for (const auto& stream : streams_) { - if (!stream || stream->IsEnabled() != enabled) - continue; -- if (av_stream_get_first_dts(stream->av_stream()) == kInvalidPTSMarker) -+ if (stream->first_dts() == AV_NOPTS_VALUE) - continue; - if (!lowest_start_time_stream || - stream->start_time() < lowest_start_time_stream->start_time()) { -@@ -1627,7 +1635,7 @@ FFmpegDemuxerStream* FFmpegDemuxer::FindPreferredStreamForSeeking( - if (stream->type() != DemuxerStream::VIDEO) - continue; - -- if (av_stream_get_first_dts(stream->av_stream()) == kInvalidPTSMarker) -+ if (stream->first_dts() == AV_NOPTS_VALUE) - continue; - - if (!stream->IsEnabled()) -diff --git a/src/3rdparty/chromium/media/filters/ffmpeg_demuxer.h b/src/3rdparty/chromium/media/filters/ffmpeg_demuxer.h -index 45ab0f348..6b093318f 100644 ---- a/src/3rdparty/chromium/media/filters/ffmpeg_demuxer.h -+++ b/src/3rdparty/chromium/media/filters/ffmpeg_demuxer.h -@@ -152,6 +152,8 @@ class MEDIA_EXPORT FFmpegDemuxerStream : public DemuxerStream { - base::TimeDelta start_time() const { return start_time_; } - void set_start_time(base::TimeDelta time) { start_time_ = time; } - -+ int64_t first_dts() const { return first_dts_; } -+ - private: - friend class FFmpegDemuxerTest; - -@@ -209,6 +211,7 @@ class MEDIA_EXPORT FFmpegDemuxerStream : public DemuxerStream { - bool fixup_chained_ogg_; - - int num_discarded_packet_warnings_; -+ int64_t first_dts_; - int64_t last_packet_pos_; - int64_t last_packet_dts_; - }; diff --git a/qtwebengine-fix-arm-build.patch b/qtwebengine-fix-arm-build.patch new file mode 100644 index 0000000000000000000000000000000000000000..7f30e1a56978b983428d4528c7a78b8286632fbc --- /dev/null +++ b/qtwebengine-fix-arm-build.patch @@ -0,0 +1,15 @@ +diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt +index cc992b4d2..ae1fba849 100644 +--- a/src/core/CMakeLists.txt ++++ b/src/core/CMakeLists.txt +@@ -566,6 +566,10 @@ foreach(arch ${archs}) + list(APPEND gnArgArg libyuv_use_sve=false) + endif() + endif() ++ if(cpu MATCHES "arm.*") ++ # https://bugreports.qt.io/browse/QTBUG-129985 ++ list(APPEND gnArgArg build_webnn_with_xnnpack=false) ++ endif() + unset(cpu) + endif() + diff --git a/qtwebengine-fix-build.patch b/qtwebengine-fix-build.patch index 52d9d39cbe5bd865e5474619ccb93670ccf4af9e..192a202b2f6a5b6b7e2ec177d18ba4c2dab7df76 100644 --- a/qtwebengine-fix-build.patch +++ b/qtwebengine-fix-build.patch @@ -1,75 +1,75 @@ diff --git a/src/3rdparty/chromium/base/debug/profiler.h b/src/3rdparty/chromium/base/debug/profiler.h -index 80c73feb9..d3921a6aa 100644 +index 035affc7c..d8e1a5346 100644 --- a/src/3rdparty/chromium/base/debug/profiler.h +++ b/src/3rdparty/chromium/base/debug/profiler.h @@ -5,6 +5,7 @@ #ifndef BASE_DEBUG_PROFILER_H_ #define BASE_DEBUG_PROFILER_H_ - + +#include #include - #include - + #include + diff --git a/src/3rdparty/chromium/cc/trees/target_property.cc b/src/3rdparty/chromium/cc/trees/target_property.cc -index 714bd5efe..cf0bb5fa9 100644 +index 7d73467a9..be4febd9a 100644 --- a/src/3rdparty/chromium/cc/trees/target_property.cc +++ b/src/3rdparty/chromium/cc/trees/target_property.cc @@ -8,6 +8,8 @@ - + #include "ui/gfx/animation/keyframe/target_property.h" - + +#include + namespace cc { - + static_assert(TargetProperty::LAST_TARGET_PROPERTY < diff --git a/src/3rdparty/chromium/device/base/synchronization/one_writer_seqlock.cc b/src/3rdparty/chromium/device/base/synchronization/one_writer_seqlock.cc index c62a00ee0..af54520b7 100644 --- a/src/3rdparty/chromium/device/base/synchronization/one_writer_seqlock.cc +++ b/src/3rdparty/chromium/device/base/synchronization/one_writer_seqlock.cc @@ -6,6 +6,8 @@ - + #include "base/threading/platform_thread.h" - + +#include + namespace device { - + OneWriterSeqLock::OneWriterSeqLock() : sequence_(0) {} diff --git a/src/3rdparty/chromium/extensions/common/constants.h b/src/3rdparty/chromium/extensions/common/constants.h -index b1a0d56ea..019bc0743 100644 +index 63af22b65..916d45a36 100644 --- a/src/3rdparty/chromium/extensions/common/constants.h +++ b/src/3rdparty/chromium/extensions/common/constants.h -@@ -12,6 +12,8 @@ +@@ -13,6 +13,8 @@ #include "build/chromeos_buildflags.h" #include "extensions/common/extensions_export.h" - + +#include + namespace extensions { - + // Scheme we serve extension content from. diff --git a/src/3rdparty/chromium/gpu/config/gpu_util.h b/src/3rdparty/chromium/gpu/config/gpu_util.h -index 574aca1ff..fca32671c 100644 +index 64d531be0..cc370a4bf 100644 --- a/src/3rdparty/chromium/gpu/config/gpu_util.h +++ b/src/3rdparty/chromium/gpu/config/gpu_util.h @@ -5,6 +5,8 @@ #ifndef GPU_CONFIG_GPU_UTIL_H_ #define GPU_CONFIG_GPU_UTIL_H_ - + +#include + #include "build/build_config.h" #include "gpu/config/gpu_feature_info.h" #include "gpu/gpu_export.h" diff --git a/src/3rdparty/chromium/net/base/parse_number.h b/src/3rdparty/chromium/net/base/parse_number.h -index ea360d1c9..dca84fd02 100644 +index f70619a75..5c4eee7f6 100644 --- a/src/3rdparty/chromium/net/base/parse_number.h +++ b/src/3rdparty/chromium/net/base/parse_number.h @@ -10,6 +10,8 @@ - #include "base/strings/string_piece.h" + #include "net/base/net_export.h" - + +#include + // This file contains utility functions for parsing numbers, in the context of @@ -93,142 +93,57 @@ index 7c0dcdecb..97054d476 100644 @@ -67,8 +71,6 @@ class ThreadSafeThreadTraits { int32_t ref_; }; - + - typedef pp::Lock Lock; - typedef pp::AutoLock AutoLock; }; - + /// The non-thread-safe version of thread traits. Using this class as the -diff --git a/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h b/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h -index 745b7b089..1e5dec4f5 100644 ---- a/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h -+++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/paint/effect_paint_property_node.h -@@ -291,7 +291,7 @@ class PLATFORM_EXPORT EffectPaintPropertyNode - return state_.compositor_element_id; - } - -- const blink::DocumentTransitionSharedElementId& -+ const cc::DocumentTransitionSharedElementId& - DocumentTransitionSharedElementId() const { - return state_.document_transition_shared_element_id; - } -diff --git a/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/handler/minidump_descriptor.h b/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/handler/minidump_descriptor.h -index c7e4f2b37..e491a1f68 100644 ---- a/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/handler/minidump_descriptor.h -+++ b/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/handler/minidump_descriptor.h -@@ -33,6 +33,7 @@ - #include - #include - -+#include - #include - - #include "client/linux/handler/microdump_extra_info.h" diff --git a/src/3rdparty/chromium/third_party/dawn/src/dawn/native/CacheKey.h b/src/3rdparty/chromium/third_party/dawn/src/dawn/native/CacheKey.h -index 6cec3b6b8..541bba5b1 100644 +index a65ea9a2a..ba967c018 100644 --- a/src/3rdparty/chromium/third_party/dawn/src/dawn/native/CacheKey.h +++ b/src/3rdparty/chromium/third_party/dawn/src/dawn/native/CacheKey.h -@@ -15,6 +15,7 @@ +@@ -28,6 +28,7 @@ #ifndef SRC_DAWN_NATIVE_CACHEKEY_H_ #define SRC_DAWN_NATIVE_CACHEKEY_H_ - + +#include #include - + #include "dawn/native/stream/ByteVectorSink.h" -diff --git a/src/3rdparty/chromium/third_party/dawn/src/tint/reader/spirv/entry_point_info.h b/src/3rdparty/chromium/third_party/dawn/src/tint/reader/spirv/entry_point_info.h -index 90077421d..f303f9e8b 100644 ---- a/src/3rdparty/chromium/third_party/dawn/src/tint/reader/spirv/entry_point_info.h -+++ b/src/3rdparty/chromium/third_party/dawn/src/tint/reader/spirv/entry_point_info.h -@@ -15,6 +15,7 @@ - #ifndef SRC_TINT_READER_SPIRV_ENTRY_POINT_INFO_H_ - #define SRC_TINT_READER_SPIRV_ENTRY_POINT_INFO_H_ - -+#include - #include - - #include "src/tint/ast/pipeline_stage.h" -diff --git a/src/3rdparty/chromium/third_party/dawn/src/tint/reader/spirv/namer.h b/src/3rdparty/chromium/third_party/dawn/src/tint/reader/spirv/namer.h -index 7a20e8738..655f69ce3 100644 ---- a/src/3rdparty/chromium/third_party/dawn/src/tint/reader/spirv/namer.h -+++ b/src/3rdparty/chromium/third_party/dawn/src/tint/reader/spirv/namer.h -@@ -15,6 +15,7 @@ - #ifndef SRC_TINT_READER_SPIRV_NAMER_H_ - #define SRC_TINT_READER_SPIRV_NAMER_H_ - -+#include - #include - #include - #include -diff --git a/src/3rdparty/chromium/third_party/dawn/src/tint/reader/wgsl/lexer.h b/src/3rdparty/chromium/third_party/dawn/src/tint/reader/wgsl/lexer.h -index 8e0306b6a..0fc0cc2b0 100644 ---- a/src/3rdparty/chromium/third_party/dawn/src/tint/reader/wgsl/lexer.h -+++ b/src/3rdparty/chromium/third_party/dawn/src/tint/reader/wgsl/lexer.h -@@ -15,6 +15,7 @@ - #ifndef SRC_TINT_READER_WGSL_LEXER_H_ - #define SRC_TINT_READER_WGSL_LEXER_H_ - -+#include - #include - #include - -diff --git a/src/3rdparty/chromium/third_party/dawn/src/tint/reader/wgsl/token.h b/src/3rdparty/chromium/third_party/dawn/src/tint/reader/wgsl/token.h -index 4cf9aad1b..3fa13e216 100644 ---- a/src/3rdparty/chromium/third_party/dawn/src/tint/reader/wgsl/token.h -+++ b/src/3rdparty/chromium/third_party/dawn/src/tint/reader/wgsl/token.h -@@ -15,6 +15,7 @@ - #ifndef SRC_TINT_READER_WGSL_TOKEN_H_ - #define SRC_TINT_READER_WGSL_TOKEN_H_ - -+#include - #include - #include - #include -diff --git a/src/3rdparty/chromium/third_party/dawn/src/tint/writer/spirv/operand.h b/src/3rdparty/chromium/third_party/dawn/src/tint/writer/spirv/operand.h -index 0601ca068..ac9dde64e 100644 ---- a/src/3rdparty/chromium/third_party/dawn/src/tint/writer/spirv/operand.h -+++ b/src/3rdparty/chromium/third_party/dawn/src/tint/writer/spirv/operand.h -@@ -15,6 +15,7 @@ - #ifndef SRC_TINT_WRITER_SPIRV_OPERAND_H_ - #define SRC_TINT_WRITER_SPIRV_OPERAND_H_ - -+#include - #include - #include - #include diff --git a/src/3rdparty/chromium/third_party/libgav1/src/src/utils/threadpool.cc b/src/3rdparty/chromium/third_party/libgav1/src/src/utils/threadpool.cc -index a3099e15d..2e6f0eea7 100644 +index 6fa2e8864..6b942abdf 100644 --- a/src/3rdparty/chromium/third_party/libgav1/src/src/utils/threadpool.cc +++ b/src/3rdparty/chromium/third_party/libgav1/src/src/utils/threadpool.cc -@@ -30,6 +30,7 @@ - #include +@@ -31,6 +31,7 @@ #include + #include #include +#include #include #include - + diff --git a/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/importers/proto/proto_importer_module.h b/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/importers/proto/proto_importer_module.h -index d047de1bf..d7fc91a59 100644 +index c8375dc69..8f290c302 100644 --- a/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/importers/proto/proto_importer_module.h +++ b/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/importers/proto/proto_importer_module.h -@@ -21,6 +21,8 @@ - #include "perfetto/trace_processor/status.h" +@@ -27,6 +27,8 @@ #include "src/trace_processor/importers/common/trace_parser.h" - + #include "src/trace_processor/importers/proto/packet_sequence_state_generation.h" + +#include + namespace perfetto { - - namespace protos { + + namespace protos::pbzero { diff --git a/src/3rdparty/chromium/third_party/skia/src/utils/SkParseColor.cpp b/src/3rdparty/chromium/third_party/skia/src/utils/SkParseColor.cpp -index 0101632c5..3f04a2dd2 100644 +index ae6a412fd..5fe0370ec 100644 --- a/src/3rdparty/chromium/third_party/skia/src/utils/SkParseColor.cpp +++ b/src/3rdparty/chromium/third_party/skia/src/utils/SkParseColor.cpp @@ -15,6 +15,10 @@ + #include #include - #include - + +#include +#include +#include @@ -237,76 +152,76 @@ index 0101632c5..3f04a2dd2 100644 "aliceblue", "antiquewhite", diff --git a/src/3rdparty/chromium/third_party/vulkan_memory_allocator/include/vk_mem_alloc.h b/src/3rdparty/chromium/third_party/vulkan_memory_allocator/include/vk_mem_alloc.h -index 9e073d4e1..da96f327c 100644 +index 0bbfeedb1..91f19f83e 100644 --- a/src/3rdparty/chromium/third_party/vulkan_memory_allocator/include/vk_mem_alloc.h +++ b/src/3rdparty/chromium/third_party/vulkan_memory_allocator/include/vk_mem_alloc.h -@@ -105,6 +105,8 @@ Documentation of all members: vk_mem_alloc.h - - [Source repository on GitHub](https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator) +@@ -122,6 +122,8 @@ See documentation chapter: \ref statistics. */ - + + +#include + #ifdef __cplusplus extern "C" { #endif -diff --git a/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/linux/wayland/xdg_session_details.h b/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/linux/wayland/xdg_session_details.h -index b70ac4aa5..7ba555564 100644 ---- a/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/linux/wayland/xdg_session_details.h -+++ b/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/linux/wayland/xdg_session_details.h +diff --git a/src/3rdparty/chromium/third_party/webrtc/modules/portal/xdg_session_details.h b/src/3rdparty/chromium/third_party/webrtc/modules/portal/xdg_session_details.h +index ab52508c2..050229a2f 100644 +--- a/src/3rdparty/chromium/third_party/webrtc/modules/portal/xdg_session_details.h ++++ b/src/3rdparty/chromium/third_party/webrtc/modules/portal/xdg_session_details.h @@ -13,6 +13,7 @@ - + #include - + +#include #include - + namespace webrtc { diff --git a/src/3rdparty/chromium/ui/events/gesture_event_details.h b/src/3rdparty/chromium/ui/events/gesture_event_details.h -index 41ff9906d..1864e9e21 100644 +index b4f797bca..95b144fd1 100644 --- a/src/3rdparty/chromium/ui/events/gesture_event_details.h +++ b/src/3rdparty/chromium/ui/events/gesture_event_details.h @@ -5,6 +5,7 @@ #ifndef UI_EVENTS_GESTURE_EVENT_DETAILS_H_ #define UI_EVENTS_GESTURE_EVENT_DETAILS_H_ - + +#include #include - + #include "base/check_op.h" diff --git a/src/3rdparty/chromium/ui/gfx/geometry/linear_gradient.h b/src/3rdparty/chromium/ui/gfx/geometry/linear_gradient.h -index ab0ce5808..9a9f187bb 100644 +index 7239ed516..975b88c51 100644 --- a/src/3rdparty/chromium/ui/gfx/geometry/linear_gradient.h +++ b/src/3rdparty/chromium/ui/gfx/geometry/linear_gradient.h -@@ -5,6 +5,7 @@ - #ifndef UI_GFX_LINEAR_GRADIENT_H_ - #define UI_GFX_LINEAR_GRADIENT_H_ - +@@ -7,6 +7,7 @@ + + #include + +#include #include + #include #include - #include diff --git a/src/3rdparty/chromium/v8/src/base/macros.h b/src/3rdparty/chromium/v8/src/base/macros.h -index cd5b91f74..a74c0021f 100644 +index 488729dd5..d497f123d 100644 --- a/src/3rdparty/chromium/v8/src/base/macros.h +++ b/src/3rdparty/chromium/v8/src/base/macros.h @@ -5,6 +5,7 @@ #ifndef V8_BASE_MACROS_H_ #define V8_BASE_MACROS_H_ - + +#include #include #include - + diff --git a/src/core/browsing_data_remover_delegate_qt.h b/src/core/browsing_data_remover_delegate_qt.h -index a611a710c..67743f52b 100644 +index d33af4acb..ce864b6bd 100644 --- a/src/core/browsing_data_remover_delegate_qt.h +++ b/src/core/browsing_data_remover_delegate_qt.h @@ -8,6 +8,8 @@ - + #include "content/public/browser/browsing_data_remover_delegate.h" - + +#include + namespace QtWebEngineCore { - + class BrowsingDataRemoverDelegateQt : public content::BrowsingDataRemoverDelegate { diff --git a/qtwebengine-icu-74.patch b/qtwebengine-icu-74.patch deleted file mode 100644 index f9e38706963c2940426d74f117e1232f359b671d..0000000000000000000000000000000000000000 --- a/qtwebengine-icu-74.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 45c6d06ced023d2be72a845ec85d0e7207c007a3 Mon Sep 17 00:00:00 2001 -From: desert-sailor -Date: Tue, 20 Feb 2024 18:25:13 +0800 -Subject: [PATCH] fix compile error caused by icu upgrade - ---- - .../blink/renderer/platform/text/text_break_iterator.cc | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/src/3rdparty/chromium/third_party/blink/renderer/platform/text/text_break_iterator.cc b/src/3rdparty/chromium/third_party/blink/renderer/platform/text/text_break_iterator.cc -index d305427d0..3c797c71e 100644 ---- a/src/3rdparty/chromium/third_party/blink/renderer/platform/text/text_break_iterator.cc -+++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/text/text_break_iterator.cc -@@ -161,7 +161,9 @@ static const unsigned char kAsciiLineBreakTable[][(kAsciiLineBreakTableLastChar - }; - // clang-format on - --#if U_ICU_VERSION_MAJOR_NUM >= 58 -+#if U_ICU_VERSION_MAJOR_NUM >= 74 -+#define BA_LB_COUNT (U_LB_COUNT - 8) -+#elif U_ICU_VERSION_MAJOR_NUM >= 58 - #define BA_LB_COUNT (U_LB_COUNT - 3) - #else - #define BA_LB_COUNT U_LB_COUNT --- -2.43.0 - diff --git a/qtwebengine-rtc-dont-use-h264.patch b/qtwebengine-rtc-dont-use-h264.patch new file mode 100644 index 0000000000000000000000000000000000000000..01b5f3afe5dd6e8343f99a363d7e342a64add393 --- /dev/null +++ b/qtwebengine-rtc-dont-use-h264.patch @@ -0,0 +1,28 @@ +From: Fabian Vogt +Subject: Don't require open264 when proprietary_codecs are supported + +diff --git a/src/3rdparty/chromium/third_party/webrtc/webrtc.gni b/chromium/third_party/webrtc/webrtc.gni +index ca8acdbf259..36897a72aa8 100644 +--- a/src/3rdparty/chromium/third_party/webrtc/webrtc.gni ++++ b/src/3rdparty/chromium/third_party/webrtc/webrtc.gni +@@ -183,18 +183,13 @@ + # + # Enabling H264 when building with MSVC is currently not supported, see + # bugs.webrtc.org/9213#c13 for more info. +- rtc_use_h264 = +- proprietary_codecs && !is_android && !is_ios && !(is_win && !is_clang) ++ rtc_use_h264 = false + + # Use system OpenH264 + rtc_system_openh264 = false + + # Enable to use H265 +- if (build_with_chromium) { +- rtc_use_h265 = enable_hevc_parser_and_hw_decoder +- } else { +- rtc_use_h265 = proprietary_codecs +- } ++ rtc_use_h265 = false + + # Enable this flag to make webrtc::Mutex be implemented by absl::Mutex. + rtc_use_absl_mutex = false diff --git a/qtwebengine-webrtc-dlopen-h264.patch b/qtwebengine-webrtc-dlopen-h264.patch deleted file mode 100644 index 07cecaa864b247bedc9d00dc97a08f8d8921021b..0000000000000000000000000000000000000000 --- a/qtwebengine-webrtc-dlopen-h264.patch +++ /dev/null @@ -1,163 +0,0 @@ -diff --git a/src/3rdparty/chromium/third_party/webrtc/modules/video_coding/BUILD.gn b/src/3rdparty/chromium/third_party/webrtc/modules/video_coding/BUILD.gn -index 640d6626d..3d1f62190 100644 ---- a/src/3rdparty/chromium/third_party/webrtc/modules/video_coding/BUILD.gn -+++ b/src/3rdparty/chromium/third_party/webrtc/modules/video_coding/BUILD.gn -@@ -7,6 +7,7 @@ - # be found in the AUTHORS file in the root of the source tree. - - import("//third_party/libaom/options.gni") -+import("//tools/generate_stubs/rules.gni") - import("../../webrtc.gni") - - rtc_library("encoded_frame") { -@@ -499,6 +500,21 @@ rtc_library("video_coding_utility") { - ] - } - -+if (rtc_use_h264 && rtc_dlopen_openh264) { -+ # When OpenH264 is not directly linked, use stubs to allow for dlopening of -+ # the binary. -+ generate_stubs("openh264_stubs") { -+ configs = [ "../../:common_config" ] -+ deps = [ "../../rtc_base" ] -+ extra_header = "codecs/h264/openh264_stub_header.fragment" -+ logging_function = "RTC_LOG(LS_VERBOSE)" -+ logging_include = "rtc_base/logging.h" -+ output_name = "codecs/h264/openh264_stubs" -+ path_from_source = "modules/video_coding/codecs/h264" -+ sigs = [ "codecs/h264/openh264.sigs" ] -+ } -+} -+ - rtc_library("webrtc_h264") { - visibility = [ "*" ] - sources = [ -@@ -542,10 +558,15 @@ rtc_library("webrtc_h264") { - ] - - if (rtc_use_h264) { -- deps += [ -- "//third_party/ffmpeg", -- "//third_party/openh264:encoder", -- ] -+ deps += [ "//third_party/ffmpeg" ] -+ -+ if (rtc_dlopen_openh264) { -+ defines = [ "WEBRTC_DLOPEN_OPENH264" ] -+ deps += [ ":openh264_stubs" ] -+ } else { -+ deps += [ "//third_party/openh264:encoder" ] -+ } -+ - if (!build_with_mozilla) { - deps += [ "../../media:rtc_media_base" ] - } -diff --git a/src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc b/src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc -index fc3fd195f..48eedcefd 100644 ---- a/src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc -+++ b/src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_encoder_impl.cc -@@ -36,10 +36,22 @@ - #include "third_party/openh264/src/codec/api/svc/codec_def.h" - #include "third_party/openh264/src/codec/api/svc/codec_ver.h" - -+#if defined(WEBRTC_DLOPEN_OPENH264) -+#include "modules/video_coding/codecs/h264/openh264_stubs.h" -+#endif // defined(WEBRTC_DLOPEN_OPENH264) -+ - namespace webrtc { - - namespace { - -+#if defined(WEBRTC_DLOPEN_OPENH264) -+using modules_video_coding_codecs_h264::InitializeStubs; -+using modules_video_coding_codecs_h264::kModuleOpenh264; -+using modules_video_coding_codecs_h264::StubPathMap; -+ -+static constexpr char kOpenH264Lib[] = "libopenh264.so.7"; -+#endif -+ - const bool kOpenH264EncoderDetailedLogging = false; - - // QP scaling thresholds. -@@ -167,6 +179,15 @@ H264EncoderImpl::~H264EncoderImpl() { - - int32_t H264EncoderImpl::InitEncode(const VideoCodec* inst, - const VideoEncoder::Settings& settings) { -+#if defined(WEBRTC_DLOPEN_OPENH264) -+ StubPathMap paths; -+ paths[kModuleOpenh264].push_back(kOpenH264Lib); -+ -+ static bool result = InitializeStubs(paths); -+ if (!result) -+ return WEBRTC_VIDEO_CODEC_UNINITIALIZED; -+#endif -+ - ReportInit(); - if (!inst || inst->codecType != kVideoCodecH264) { - ReportError(); -diff --git a/src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/openh264.sigs b/src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/openh264.sigs -new file mode 100644 -index 000000000..4924f8e9a ---- /dev/null -+++ b/src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/openh264.sigs -@@ -0,0 +1,14 @@ -+// Copyright 2022 The WebRTC project authors. All rights reserved. -+// Use of this source code is governed by a BSD-style license that can be -+// found in the LICENSE file. -+ -+//------------------------------------------------ -+// Functions from OpenH264. -+//------------------------------------------------ -+int WelsCreateSVCEncoder(ISVCEncoder **ppEncoder); -+void WelsDestroySVCEncoder(ISVCEncoder *pEncoder); -+int WelsGetDecoderCapability(SDecoderCapability *pDecCapability); -+long WelsCreateDecoder(ISVCDecoder **ppDecoder); -+void WelsDestroyDecoder(ISVCDecoder *pDecoder); -+OpenH264Version WelsGetCodecVersion(void); -+void WelsGetCodecVersionEx(OpenH264Version *pVersion); -diff --git a/src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/openh264_stub_header.fragment b/src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/openh264_stub_header.fragment -new file mode 100644 -index 000000000..e8a3727a0 ---- /dev/null -+++ b/src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/openh264_stub_header.fragment -@@ -0,0 +1,11 @@ -+// The extra include header needed in the generated stub file for defining -+// various OpenH264 types. -+ -+extern "C" { -+ -+#include "third_party/openh264/src/codec/api/svc/codec_api.h" -+#include "third_party/openh264/src/codec/api/svc/codec_app_def.h" -+#include "third_party/openh264/src/codec/api/svc/codec_def.h" -+#include "third_party/openh264/src/codec/api/svc/codec_ver.h" -+ -+} -diff --git a/src/3rdparty/chromium/third_party/webrtc/webrtc.gni b/src/3rdparty/chromium/third_party/webrtc/webrtc.gni -index 8ab7b27f0..2023102a8 100644 ---- a/src/3rdparty/chromium/third_party/webrtc/webrtc.gni -+++ b/src/3rdparty/chromium/third_party/webrtc/webrtc.gni -@@ -181,6 +181,10 @@ declare_args() { - rtc_use_h264 = - proprietary_codecs && !is_android && !is_ios && !(is_win && !is_clang) - -+ # Allow to use OpenH264 on systems where OpenH264 cannot be installed by -+ # default due to licensing, but can be installed later from other sources. -+ rtc_dlopen_openh264 = false -+ - # Enable this flag to make webrtc::Mutex be implemented by absl::Mutex. - rtc_use_absl_mutex = false - -diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt -index 1d183573f..d08fd1bcb 100644 ---- a/src/core/CMakeLists.txt -+++ b/src/core/CMakeLists.txt -@@ -413,6 +413,9 @@ foreach(arch ${archs}) - use_udev=true - is_cfi=false - use_ozone=true -+ media_use_openh264=false -+ rtc_use_h264=true -+ rtc_dlopen_openh264=true - ozone_auto_platforms=false - ozone_platform_headless=false - ozone_platform_external=true diff --git a/riscv-angle.patch b/riscv-angle.patch deleted file mode 100644 index 3be4dcaba16d70d65467af8ac071f02b159384e1..0000000000000000000000000000000000000000 --- a/riscv-angle.patch +++ /dev/null @@ -1,27 +0,0 @@ -Index: chromium/third_party/angle/gni/angle.gni -=================================================================== ---- chromium/third_party/angle/gni/angle.gni -+++ chromium/third_party/angle/gni/angle.gni -@@ -97,7 +97,8 @@ declare_args() { - - if (current_cpu == "arm64" || current_cpu == "x64" || - current_cpu == "mips64el" || current_cpu == "s390x" || -- current_cpu == "ppc64" || current_cpu == "loong64") { -+ current_cpu == "ppc64" || current_cpu == "loong64" || -+ current_cpu == "riscv64") { - angle_64bit_current_cpu = true - } else if (current_cpu == "arm" || current_cpu == "x86" || - current_cpu == "mipsel" || current_cpu == "s390" || -Index: chromium/third_party/angle/src/common/platform.h -=================================================================== ---- chromium/third_party/angle/src/common/platform.h -+++ chromium/third_party/angle/src/common/platform.h -@@ -102,7 +102,7 @@ - #endif - - // Mips and arm devices need to include stddef for size_t. --#if defined(__mips__) || defined(__arm__) || defined(__aarch64__) -+#if defined(__mips__) || defined(__arm__) || defined(__aarch64__) || defined(__riscv) - # include - #endif - diff --git a/riscv-breakpad.patch b/riscv-breakpad.patch deleted file mode 100644 index 316da8fb74c230e6d50bcc30801699cdb105f594..0000000000000000000000000000000000000000 --- a/riscv-breakpad.patch +++ /dev/null @@ -1,569 +0,0 @@ -Index: chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h -=================================================================== ---- chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h -+++ chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h -@@ -44,6 +44,8 @@ typedef MDRawContextARM RawContextCPU; - typedef MDRawContextARM64_Old RawContextCPU; - #elif defined(__mips__) - typedef MDRawContextMIPS RawContextCPU; -+#elif defined(__riscv) -+typedef MDRawContextRISCV64 RawContextCPU; - #else - #error "This code has not been ported to your platform yet." - #endif -Index: chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc -=================================================================== ---- chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc -+++ chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc -@@ -270,7 +270,23 @@ void ThreadInfo::FillCPUContext(RawConte - out->float_save.fir = mcontext.fpc_eir; - #endif - } --#endif // __mips__ -+#elif defined(__riscv) -+ -+uintptr_t ThreadInfo::GetInstructionPointer() const { -+ return mcontext.__gregs[REG_PC]; -+} -+ -+void ThreadInfo::FillCPUContext(RawContextCPU* out) const { -+ out->context_flags = MD_CONTEXT_RISCV64_FULL; -+ -+ my_memcpy (out->iregs, mcontext.__gregs, MD_CONTEXT_RISCV64_GPR_COUNT * 8); -+ -+ out->float_save.fcsr = mcontext.__fpregs.__d.__fcsr; -+ my_memcpy(&out->float_save.regs, &mcontext.__fpregs.__d.__f, -+ MD_FLOATINGSAVEAREA_RISCV64_FPR_COUNT * 8); -+} -+ -+#endif // __riscv - - void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) { - assert(gp_regs || size); -@@ -279,6 +295,11 @@ void ThreadInfo::GetGeneralPurposeRegist - *gp_regs = mcontext.gregs; - if (size) - *size = sizeof(mcontext.gregs); -+#elif defined(__riscv) -+ if (gp_regs) -+ *gp_regs = mcontext.__gregs; -+ if (size) -+ *size = sizeof(mcontext.__gregs); - #else - if (gp_regs) - *gp_regs = ®s; -@@ -294,6 +315,11 @@ void ThreadInfo::GetFloatingPointRegiste - *fp_regs = &mcontext.fpregs; - if (size) - *size = sizeof(mcontext.fpregs); -+#elif defined(__riscv) -+ if (fp_regs) -+ *fp_regs = &mcontext.__fpregs; -+ if (size) -+ *size = sizeof(mcontext.__fpregs); - #else - if (fp_regs) - *fp_regs = &fpregs; -Index: chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h -=================================================================== ---- chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h -+++ chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h -@@ -68,7 +68,7 @@ struct ThreadInfo { - // Use the structures defined in - struct user_regs_struct regs; - struct user_fpsimd_struct fpregs; --#elif defined(__mips__) -+#elif defined(__mips__) || defined(__riscv) - // Use the structure defined in . - mcontext_t mcontext; - #endif -Index: chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc -=================================================================== ---- chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc -+++ chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc -@@ -254,6 +254,27 @@ void UContextReader::FillCPUContext(RawC - out->float_save.fir = uc->uc_mcontext.fpc_eir; // Unused. - #endif - } -+ -+#elif defined(__riscv) -+ -+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) { -+ return uc->uc_mcontext.__gregs[REG_SP]; -+} -+ -+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) { -+ return uc->uc_mcontext.__gregs[REG_PC]; -+} -+ -+void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc) { -+ out->context_flags = MD_CONTEXT_RISCV64_FULL; -+ -+ for (int i = 0; i < MD_CONTEXT_RISCV64_GPR_COUNT; ++i) -+ out->iregs[i] = uc->uc_mcontext.__gregs[i]; -+ -+ out->float_save.fcsr = uc->uc_mcontext.__fpregs.__d.__fcsr; -+ for (int i = 0; i < MD_FLOATINGSAVEAREA_RISCV64_FPR_COUNT; ++i) -+ out->float_save.regs[i] = uc->uc_mcontext.__fpregs.__d.__f[i]; -+} - #endif - - } // namespace google_breakpad -Index: chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc -=================================================================== ---- chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc -+++ chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc -@@ -461,7 +461,7 @@ bool ExceptionHandler::HandleSignal(int - memcpy(&g_crash_context_.float_state, fp_ptr, - sizeof(g_crash_context_.float_state)); - } --#elif !defined(__ARM_EABI__) && !defined(__mips__) -+#elif !defined(__ARM_EABI__) && !defined(__mips__) && !defined(__riscv) - // FP state is not part of user ABI on ARM Linux. - // In case of MIPS Linux FP state is already part of ucontext_t - // and 'float_state' is not a member of CrashContext. -@@ -701,7 +701,7 @@ bool ExceptionHandler::WriteMinidump() { - } - #endif - --#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__) -+#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__) && !defined(__riscv) - // FPU state is not part of ARM EABI ucontext_t. - memcpy(&context.float_state, context.context.uc_mcontext.fpregs, - sizeof(context.float_state)); -@@ -726,6 +726,9 @@ bool ExceptionHandler::WriteMinidump() { - #elif defined(__mips__) - context.siginfo.si_addr = - reinterpret_cast(context.context.uc_mcontext.pc); -+#elif defined(__riscv) -+ context.siginfo.si_addr = -+ reinterpret_cast(context.context.uc_mcontext.__gregs[REG_PC]); - #else - #error "This code has not been ported to your platform yet." - #endif -Index: chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h -=================================================================== ---- chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h -+++ chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h -@@ -192,7 +192,7 @@ class ExceptionHandler { - siginfo_t siginfo; - pid_t tid; // the crashing thread. - ucontext_t context; --#if !defined(__ARM_EABI__) && !defined(__mips__) -+#if !defined(__ARM_EABI__) && !defined(__mips__) && !defined(__riscv) - // #ifdef this out because FP state is not part of user ABI for Linux ARM. - // In case of MIPS Linux FP state is already part of ucontext_t so - // 'float_state' is not required. -Index: chromium/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc -=================================================================== ---- chromium/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc -+++ chromium/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc -@@ -138,7 +138,7 @@ class MicrodumpWriter { - const MicrodumpExtraInfo& microdump_extra_info, - LinuxDumper* dumper) - : ucontext_(context ? &context->context : NULL), --#if !defined(__ARM_EABI__) && !defined(__mips__) -+#if !defined(__ARM_EABI__) && !defined(__mips__) && !defined(__riscv) - float_state_(context ? &context->float_state : NULL), - #endif - dumper_(dumper), -@@ -337,6 +337,12 @@ class MicrodumpWriter { - # else - # error "This mips ABI is currently not supported (n32)" - #endif -+#elif defined(__riscv) -+# if __riscv_xlen == 64 -+ const char kArch[] = "riscv64"; -+# else -+# error "This RISC-V ABI is currently not supported" -+#endif - #else - #error "This code has not been ported to your platform yet" - #endif -@@ -409,7 +415,7 @@ class MicrodumpWriter { - void DumpCPUState() { - RawContextCPU cpu; - my_memset(&cpu, 0, sizeof(RawContextCPU)); --#if !defined(__ARM_EABI__) && !defined(__mips__) -+#if !defined(__ARM_EABI__) && !defined(__mips__) && !defined(__riscv) - UContextReader::FillCPUContext(&cpu, ucontext_, float_state_); - #else - UContextReader::FillCPUContext(&cpu, ucontext_); -@@ -605,7 +611,7 @@ class MicrodumpWriter { - void* Alloc(unsigned bytes) { return dumper_->allocator()->Alloc(bytes); } - - const ucontext_t* const ucontext_; --#if !defined(__ARM_EABI__) && !defined(__mips__) -+#if !defined(__ARM_EABI__) && !defined(__mips__) && !defined(__riscv) - const google_breakpad::fpstate_t* const float_state_; - #endif - LinuxDumper* dumper_; -Index: chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc -=================================================================== ---- chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc -+++ chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc -@@ -112,6 +112,9 @@ bool LinuxCoreDumper::GetThreadInfoByInd - #elif defined(__mips__) - stack_pointer = - reinterpret_cast(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]); -+#elif defined(__riscv) -+ stack_pointer = -+ reinterpret_cast(info->mcontext.__gregs[MD_CONTEXT_RISCV64_REG_SP]); - #else - #error "This code hasn't been ported to your platform yet." - #endif -@@ -218,6 +221,8 @@ bool LinuxCoreDumper::EnumerateThreads() - info.mcontext.mdlo = status->pr_reg[EF_LO]; - info.mcontext.mdhi = status->pr_reg[EF_HI]; - info.mcontext.pc = status->pr_reg[EF_CP0_EPC]; -+#elif defined(__riscv) -+ memcpy(info.mcontext.__gregs, status->pr_reg, sizeof(info.mcontext.__gregs)); - #else // __mips__ - memcpy(&info.regs, status->pr_reg, sizeof(info.regs)); - #endif // __mips__ -Index: chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h -=================================================================== ---- chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h -+++ chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h -@@ -63,7 +63,8 @@ namespace google_breakpad { - (defined(__mips__) && _MIPS_SIM == _ABIO32) - typedef Elf32_auxv_t elf_aux_entry; - #elif defined(__x86_64) || defined(__aarch64__) || \ -- (defined(__mips__) && _MIPS_SIM != _ABIO32) -+ (defined(__mips__) && _MIPS_SIM != _ABIO32) || \ -+ (defined(__riscv) && __riscv_xlen == 64) - typedef Elf64_auxv_t elf_aux_entry; - #endif - -Index: chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc -=================================================================== ---- chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc -+++ chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc -@@ -298,6 +298,9 @@ bool LinuxPtraceDumper::GetThreadInfoByI - #elif defined(__mips__) - stack_pointer = - reinterpret_cast(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]); -+#elif defined(__riscv) -+ stack_pointer = -+ reinterpret_cast(info->mcontext.__gregs[MD_CONTEXT_RISCV64_REG_SP]); - #else - #error "This code hasn't been ported to your platform yet." - #endif -Index: chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc -=================================================================== ---- chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc -+++ chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc -@@ -141,7 +141,7 @@ class MinidumpWriter { - : fd_(minidump_fd), - path_(minidump_path), - ucontext_(context ? &context->context : NULL), --#if !defined(__ARM_EABI__) && !defined(__mips__) -+#if !defined(__ARM_EABI__) && !defined(__mips__) && !defined(__riscv) - float_state_(context ? &context->float_state : NULL), - #endif - dumper_(dumper), -@@ -473,7 +473,7 @@ class MinidumpWriter { - if (!cpu.Allocate()) - return false; - my_memset(cpu.get(), 0, sizeof(RawContextCPU)); --#if !defined(__ARM_EABI__) && !defined(__mips__) -+#if !defined(__ARM_EABI__) && !defined(__mips__) && !defined(__riscv) - UContextReader::FillCPUContext(cpu.get(), ucontext_, float_state_); - #else - UContextReader::FillCPUContext(cpu.get(), ucontext_); -@@ -950,7 +950,7 @@ class MinidumpWriter { - dirent->location.rva = 0; - } - --#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) -+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || defined(__riscv) - bool WriteCPUInformation(MDRawSystemInfo* sys_info) { - char vendor_id[sizeof(sys_info->cpu.x86_cpu_info.vendor_id) + 1] = {0}; - static const char vendor_id_name[] = "vendor_id"; -@@ -978,6 +978,12 @@ class MinidumpWriter { - # else - # error "This mips ABI is currently not supported (n32)" - #endif -+#elif defined(__riscv) -+# if __riscv_xlen == 64 -+ MD_CPU_ARCHITECTURE_RISCV64; -+# else -+# error "This RISC-V ABI is currently not supported" -+# endif - #elif defined(__i386__) - MD_CPU_ARCHITECTURE_X86; - #else -@@ -1386,7 +1392,7 @@ class MinidumpWriter { - const char* path_; // Path to the file where the minidum should be written. - - const ucontext_t* const ucontext_; // also from the signal handler --#if !defined(__ARM_EABI__) && !defined(__mips__) -+#if !defined(__ARM_EABI__) && !defined(__mips__) && !defined(__riscv) - const google_breakpad::fpstate_t* const float_state_; // ditto - #endif - LinuxDumper* dumper_; -Index: chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h -=================================================================== ---- chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h -+++ chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h -@@ -48,7 +48,7 @@ class ExceptionHandler; - - #if defined(__aarch64__) - typedef struct fpsimd_context fpstate_t; --#elif !defined(__ARM_EABI__) && !defined(__mips__) -+#elif !defined(__ARM_EABI__) && !defined(__mips__) && !defined(__riscv) - typedef std::remove_pointer::type fpstate_t; - #endif - -Index: chromium/third_party/breakpad/breakpad/src/common/linux/breakpad_getcontext.S -=================================================================== ---- chromium/third_party/breakpad/breakpad/src/common/linux/breakpad_getcontext.S -+++ chromium/third_party/breakpad/breakpad/src/common/linux/breakpad_getcontext.S -@@ -527,6 +527,68 @@ breakpad_getcontext: - .cfi_endproc - .size breakpad_getcontext, . - breakpad_getcontext - -+#elif defined(__riscv) && __riscv_xlen == 64 -+ -+#define __NR_rt_sigprocmask 135 -+#define _NSIG8 64 / 8 -+#define SIG_BLOCK 0 -+ -+ .text -+ .global breakpad_getcontext -+ .hidden breakpad_getcontext -+ .type breakpad_getcontext, @function -+ .align 2 -+breakpad_getcontext: -+ sd ra, MCONTEXT_GREGS_OFFSET + 0*8(a0) -+ sd ra, MCONTEXT_GREGS_OFFSET + 1*8(a0) -+ sd sp, MCONTEXT_GREGS_OFFSET + 2*8(a0) -+ sd s0, MCONTEXT_GREGS_OFFSET + 8*8(a0) -+ sd s1, MCONTEXT_GREGS_OFFSET + 9*8(a0) -+ sd x0, MCONTEXT_GREGS_OFFSET + 10*8(a0) /* return 0 by overwriting a0. */ -+ sd s2, MCONTEXT_GREGS_OFFSET + 18*8(a0) -+ sd s3, MCONTEXT_GREGS_OFFSET + 19*8(a0) -+ sd s4, MCONTEXT_GREGS_OFFSET + 20*8(a0) -+ sd s5, MCONTEXT_GREGS_OFFSET + 21*8(a0) -+ sd s6, MCONTEXT_GREGS_OFFSET + 22*8(a0) -+ sd s7, MCONTEXT_GREGS_OFFSET + 23*8(a0) -+ sd s8, MCONTEXT_GREGS_OFFSET + 24*8(a0) -+ sd s9, MCONTEXT_GREGS_OFFSET + 25*8(a0) -+ sd s10, MCONTEXT_GREGS_OFFSET + 26*8(a0) -+ sd s11, MCONTEXT_GREGS_OFFSET + 27*8(a0) -+ -+#ifndef __riscv_float_abi_soft -+ frsr a1 -+ -+ fsd fs0, MCONTEXT_FPREGS_OFFSET + 8*8(a0) -+ fsd fs1, MCONTEXT_FPREGS_OFFSET + 9*8(a0) -+ fsd fs2, MCONTEXT_FPREGS_OFFSET + 18*8(a0) -+ fsd fs3, MCONTEXT_FPREGS_OFFSET + 19*8(a0) -+ fsd fs4, MCONTEXT_FPREGS_OFFSET + 20*8(a0) -+ fsd fs5, MCONTEXT_FPREGS_OFFSET + 21*8(a0) -+ fsd fs6, MCONTEXT_FPREGS_OFFSET + 22*8(a0) -+ fsd fs7, MCONTEXT_FPREGS_OFFSET + 23*8(a0) -+ fsd fs8, MCONTEXT_FPREGS_OFFSET + 24*8(a0) -+ fsd fs9, MCONTEXT_FPREGS_OFFSET + 25*8(a0) -+ fsd fs10, MCONTEXT_FPREGS_OFFSET + 26*8(a0) -+ fsd fs11, MCONTEXT_FPREGS_OFFSET + 27*8(a0) -+ -+ sw a1, MCONTEXT_FSR_OFFSET(a0) -+#endif /* __riscv_float_abi_soft */ -+ -+/* rt_sigprocmask (SIG_BLOCK, NULL, &ucp->uc_sigmask, _NSIG / 8) */ -+ li a3, _NSIG8 -+ add a2, a0, UCONTEXT_SIGMASK_OFFSET -+ mv a1, zero -+ li a0, SIG_BLOCK -+ -+ li a7, __NR_rt_sigprocmask -+ scall -+ -+ /* Always return 0 for success, even if sigprocmask failed. */ -+ mv a0, zero -+ ret -+ .size breakpad_getcontext, . - breakpad_getcontext -+ - #else - #error "This file has not been ported for your CPU!" - #endif -Index: chromium/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc -=================================================================== ---- chromium/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc -+++ chromium/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc -@@ -65,7 +65,8 @@ bool MemoryMappedFile::Map(const char* p - } - - #if defined(__x86_64__) || defined(__aarch64__) || \ -- (defined(__mips__) && _MIPS_SIM == _ABI64) -+ (defined(__mips__) && _MIPS_SIM == _ABI64) || \ -+ (defined(__riscv) && __riscv_xlen == 64) - - struct kernel_stat st; - if (sys_fstat(fd, &st) == -1 || st.st_size < 0) { -Index: chromium/third_party/breakpad/breakpad/src/common/linux/ucontext_constants.h -=================================================================== ---- chromium/third_party/breakpad/breakpad/src/common/linux/ucontext_constants.h -+++ chromium/third_party/breakpad/breakpad/src/common/linux/ucontext_constants.h -@@ -146,6 +146,14 @@ - #endif - #define FPREGS_OFFSET_MXCSR 24 - -+#elif defined(__riscv) -+ -+#define UCONTEXT_SIGMASK_OFFSET 40 -+ -+#define MCONTEXT_GREGS_OFFSET 176 -+#define MCONTEXT_FPREGS_OFFSET 432 -+#define MCONTEXT_FSR_OFFSET (MCONTEXT_FPREGS_OFFSET + 32*8) -+ - #else - #error "This header has not been ported for your CPU" - #endif -Index: chromium/third_party/breakpad/breakpad/src/google_breakpad/common/minidump_cpu_riscv64.h -=================================================================== ---- /dev/null -+++ chromium/third_party/breakpad/breakpad/src/google_breakpad/common/minidump_cpu_riscv64.h -@@ -0,0 +1,121 @@ -+/* Copyright 2013 Google Inc. -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are -+ * met: -+ * -+ * * Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * * Redistributions in binary form must reproduce the above -+ * copyright notice, this list of conditions and the following disclaimer -+ * in the documentation and/or other materials provided with the -+ * distribution. -+ * * Neither the name of Google Inc. nor the names of its -+ * contributors may be used to endorse or promote products derived from -+ * this software without specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -+ -+/* minidump_format.h: A cross-platform reimplementation of minidump-related -+ * portions of DbgHelp.h from the Windows Platform SDK. -+ * -+ * (This is C99 source, please don't corrupt it with C++.) -+ * -+ * This file contains the necessary definitions to read minidump files -+ * produced on ARM. These files may be read on any platform provided -+ * that the alignments of these structures on the processing system are -+ * identical to the alignments of these structures on the producing system. -+ * For this reason, precise-sized types are used. The structures defined -+ * by this file have been laid out to minimize alignment problems by -+ * ensuring that all members are aligned on their natural boundaries. -+ * In some cases, tail-padding may be significant when different ABIs specify -+ * different tail-padding behaviors. To avoid problems when reading or -+ * writing affected structures, MD_*_SIZE macros are provided where needed, -+ * containing the useful size of the structures without padding. -+ * -+ * Structures that are defined by Microsoft to contain a zero-length array -+ * are instead defined here to contain an array with one element, as -+ * zero-length arrays are forbidden by standard C and C++. In these cases, -+ * *_minsize constants are provided to be used in place of sizeof. For a -+ * cleaner interface to these sizes when using C++, see minidump_size.h. -+ * -+ * These structures are also sufficient to populate minidump files. -+ * -+ * Because precise data type sizes are crucial for this implementation to -+ * function properly and portably, a set of primitive types with known sizes -+ * are used as the basis of each structure defined by this file. -+ * -+ * Author: Colin Blundell -+ */ -+ -+/* -+ * RISCV64 support -+ */ -+ -+#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_RISCV64_H__ -+#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_RISCV64_H__ -+ -+#include "google_breakpad/common/breakpad_types.h" -+ -+#define MD_FLOATINGSAVEAREA_RISCV64_FPR_COUNT 32 -+#define MD_CONTEXT_RISCV64_GPR_COUNT 32 -+ -+typedef struct { -+ /* 32 64-bit floating point registers, f0 .. f31. */ -+ uint64_t regs[MD_FLOATINGSAVEAREA_RISCV64_FPR_COUNT]; -+ -+ uint32_t fcsr; /* FPU control and status register */ -+} MDFloatingSaveAreaRISCV64; -+ -+/* For (MDRawContextRISCV64).context_flags. These values indicate the type of -+ * context stored in the structure. */ -+#define MD_CONTEXT_RISCV64 0x00400000 -+#define MD_CONTEXT_RISCV64_CONTROL (MD_CONTEXT_RISCV64 | 0x00000001) -+#define MD_CONTEXT_RISCV64_INTEGER (MD_CONTEXT_RISCV64 | 0x00000002) -+#define MD_CONTEXT_RISCV64_FLOATING_POINT (MD_CONTEXT_RISCV64 | 0x00000004) -+#define MD_CONTEXT_RISCV64_DEBUG (MD_CONTEXT_RISCV64 | 0x00000008) -+#define MD_CONTEXT_RISCV64_FULL (MD_CONTEXT_RISCV64_CONTROL | \ -+ MD_CONTEXT_RISCV64_INTEGER | \ -+ MD_CONTEXT_RISCV64_FLOATING_POINT) -+#define MD_CONTEXT_RISCV64_ALL (MD_CONTEXT_RISCV64_FULL | MD_CONTEXT_RISCV64_DEBUG) -+ -+typedef struct { -+ /* Determines which fields of this struct are populated */ -+ uint32_t context_flags; -+ -+ /* 32 64-bit integer registers, x1 .. x31 + the PC -+ * Note the following fixed uses: -+ * x8 is the frame pointer -+ * x1 is the link register -+ * x2 is the stack pointer -+ * The PC is effectively x0. -+ */ -+ uint64_t iregs[MD_CONTEXT_RISCV64_GPR_COUNT]; -+ -+ /* The next field is included with MD_CONTEXT64_ARM_FLOATING_POINT */ -+ MDFloatingSaveAreaRISCV64 float_save; -+ -+} MDRawContextRISCV64; -+ -+/* Indices into iregs for registers with a dedicated or conventional -+ * purpose. -+ */ -+enum MDRISCV64RegisterNumbers { -+ MD_CONTEXT_RISCV64_REG_FP = 8, -+ MD_CONTEXT_RISCV64_REG_RA = 1, -+ MD_CONTEXT_RISCV64_REG_SP = 2, -+ MD_CONTEXT_RISCV64_REG_PC = 0 -+}; -+ -+#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_RISCV64_H__ */ -Index: chromium/third_party/breakpad/breakpad/src/google_breakpad/common/minidump_format.h -=================================================================== ---- chromium/third_party/breakpad/breakpad/src/google_breakpad/common/minidump_format.h -+++ chromium/third_party/breakpad/breakpad/src/google_breakpad/common/minidump_format.h -@@ -118,6 +118,7 @@ typedef struct { - #include "minidump_cpu_mips.h" - #include "minidump_cpu_ppc.h" - #include "minidump_cpu_ppc64.h" -+#include "minidump_cpu_riscv64.h" - #include "minidump_cpu_sparc.h" - #include "minidump_cpu_x86.h" - -@@ -684,6 +685,7 @@ typedef enum { - MD_CPU_ARCHITECTURE_PPC64 = 0x8002, /* Breakpad-defined value for PPC64 */ - MD_CPU_ARCHITECTURE_ARM64_OLD = 0x8003, /* Breakpad-defined value for ARM64 */ - MD_CPU_ARCHITECTURE_MIPS64 = 0x8004, /* Breakpad-defined value for MIPS64 */ -+ MD_CPU_ARCHITECTURE_RISCV64 = 0x8005, /* Breakpad-defined value for RISCV64 */ - MD_CPU_ARCHITECTURE_UNKNOWN = 0xffff /* PROCESSOR_ARCHITECTURE_UNKNOWN */ - } MDCPUArchitecture; - diff --git a/riscv-crashpad.patch b/riscv-crashpad.patch deleted file mode 100644 index e43499cf53374808d373884d82ef7d9018a708cb..0000000000000000000000000000000000000000 --- a/riscv-crashpad.patch +++ /dev/null @@ -1,777 +0,0 @@ -Index: chromium/third_party/crashpad/crashpad/minidump/minidump_context.h -=================================================================== ---- chromium/third_party/crashpad/crashpad/minidump/minidump_context.h -+++ chromium/third_party/crashpad/crashpad/minidump/minidump_context.h -@@ -637,6 +637,41 @@ struct MinidumpContextMIPS64 { - uint64_t fir; - }; - -+//! \brief 64bit RISC-V-specifc flags for MinidumpContextRISCV64::context_flags. -+//! Based on minidump_cpu_riscv64.h from breakpad -+enum MinidumpContextRISCV64Flags : uint32_t { -+ //! \brief Identifies the context structure as RISCV64. -+ kMinidumpContextRISCV64 = 0x00080000, -+ -+ //! \brief Indicates the validity of integer registers. -+ //! -+ //! Registers `x1`-`x31` and pc are valid. -+ kMinidumpContextRISCV64Integer = kMinidumpContextRISCV64 | 0x00000002, -+ -+ //! \brief Indicates the validity of floating point registers. -+ //! -+ //! Floating point registers `f0`-`f31`, and `fcsr` are valid -+ kMinidumpContextRISCV64FloatingPoint = kMinidumpContextRISCV64 | 0x00000004, -+ -+ //! \brief Indicates the validity of all registers. -+ kMinidumpContextRISCV64All = kMinidumpContextRISCV64Integer | -+ kMinidumpContextRISCV64FloatingPoint, -+}; -+ -+//! \brief A 64bit RISCV CPU context (register state) carried in a minidump file. -+struct MinidumpContextRISCV64 { -+ uint64_t context_flags; -+ -+ //! \brief General purpose registers. -+ uint64_t regs[32]; -+ -+ //! \brief FPU registers. -+ uint64_t fpregs[32]; -+ -+ //! \brief FPU status register. -+ uint64_t fcsr; -+}; -+ - } // namespace crashpad - - #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_ -Index: chromium/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc -=================================================================== ---- chromium/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc -+++ chromium/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc -@@ -102,6 +102,13 @@ MinidumpContextWriter::CreateFromSnapsho - break; - } - -+ case kCPUArchitectureRISCV64: { -+ context = std::make_unique(); -+ reinterpret_cast(context.get()) -+ ->InitializeFromSnapshot(context_snapshot->riscv64); -+ break; -+ } -+ - default: { - LOG(ERROR) << "unknown context architecture " - << context_snapshot->architecture; -@@ -555,5 +562,42 @@ size_t MinidumpContextMIPS64Writer::Cont - DCHECK_GE(state(), kStateFrozen); - return sizeof(context_); - } -+ -+MinidumpContextRISCV64Writer::MinidumpContextRISCV64Writer() -+ : MinidumpContextWriter(), context_() { -+ context_.context_flags = kMinidumpContextRISCV64; -+} -+ -+MinidumpContextRISCV64Writer::~MinidumpContextRISCV64Writer() = default; -+ -+void MinidumpContextRISCV64Writer::InitializeFromSnapshot( -+ const CPUContextRISCV64* context_snapshot) { -+ DCHECK_EQ(state(), kStateMutable); -+ DCHECK_EQ(context_.context_flags, kMinidumpContextRISCV64); -+ -+ context_.context_flags = kMinidumpContextRISCV64All; -+ -+ static_assert(sizeof(context_.regs) == sizeof(context_snapshot->regs), -+ "GPRs size mismatch"); -+ memcpy(context_.regs, context_snapshot->regs, sizeof(context_.regs)); -+ -+ static_assert(sizeof(context_.fpregs) == sizeof(context_snapshot->fpregs), -+ "FPRs size mismatch"); -+ memcpy(context_.fpregs, -+ context_snapshot->fpregs, -+ sizeof(context_.fpregs)); -+ context_.fcsr = context_snapshot->fcsr; -+} -+ -+bool MinidumpContextRISCV64Writer::WriteObject( -+ FileWriterInterface* file_writer) { -+ DCHECK_EQ(state(), kStateWritable); -+ return file_writer->Write(&context_, sizeof(context_)); -+} -+ -+size_t MinidumpContextRISCV64Writer::ContextSize() const { -+ DCHECK_GE(state(), kStateFrozen); -+ return sizeof(context_); -+} - - } // namespace crashpad -Index: chromium/third_party/crashpad/crashpad/minidump/minidump_context_writer.h -=================================================================== ---- chromium/third_party/crashpad/crashpad/minidump/minidump_context_writer.h -+++ chromium/third_party/crashpad/crashpad/minidump/minidump_context_writer.h -@@ -369,6 +369,49 @@ class MinidumpContextMIPS64Writer final - MinidumpContextMIPS64 context_; - }; - -+//! \brief The writer for a MinidumpContextRISCV64 structure in a minidump file. -+class MinidumpContextRISCV64Writer final : public MinidumpContextWriter { -+ public: -+ MinidumpContextRISCV64Writer(); -+ -+ MinidumpContextRISCV64Writer(const MinidumpContextRISCV64Writer&) = delete; -+ MinidumpContextRISCV64Writer& operator=(const MinidumpContextRISCV64Writer&) = -+ delete; -+ -+ ~MinidumpContextRISCV64Writer() override; -+ -+ //! \brief Initializes the MinidumpContextRISCV based on \a context_snapshot. -+ //! -+ //! \param[in] context_snapshot The context snapshot to use as source data. -+ //! -+ //! \note Valid in #kStateMutable. No mutation of context() may be done before -+ //! calling this method, and it is not normally necessary to alter -+ //! context() after calling this method. -+ void InitializeFromSnapshot(const CPUContextRISCV64* context_snapshot); -+ -+ //! \brief Returns a pointer to the context structure that this object will -+ //! write. -+ //! -+ //! \attention This returns a non-`const` pointer to this object’s private -+ //! data so that a caller can populate the context structure directly. -+ //! This is done because providing setter interfaces to each field in the -+ //! context structure would be unwieldy and cumbersome. Care must be taken -+ //! to populate the context structure correctly. The context structure -+ //! must only be modified while this object is in the #kStateMutable -+ //! state. -+ MinidumpContextRISCV64* context() { return &context_; } -+ -+ protected: -+ // MinidumpWritable: -+ bool WriteObject(FileWriterInterface* file_writer) override; -+ -+ // MinidumpContextWriter: -+ size_t ContextSize() const override; -+ -+ private: -+ MinidumpContextRISCV64 context_; -+}; -+ - } // namespace crashpad - - #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_WRITER_H_ -Index: chromium/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc -=================================================================== ---- chromium/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc -+++ chromium/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc -@@ -175,6 +175,10 @@ std::string MinidumpMiscInfoDebugBuildSt - static constexpr char kCPU[] = "mips"; - #elif defined(ARCH_CPU_MIPS64EL) - static constexpr char kCPU[] = "mips64"; -+#elif defined(ARCH_CPU_RISCV32) -+ static constexpr char kCPU[] = "riscv32"; -+#elif defined(ARCH_CPU_RISCV64) -+ static constexpr char kCPU[] = "riscv64"; - #else - #error define kCPU for this CPU - #endif -Index: chromium/third_party/crashpad/crashpad/snapshot/capture_memory.cc -=================================================================== ---- chromium/third_party/crashpad/crashpad/snapshot/capture_memory.cc -+++ chromium/third_party/crashpad/crashpad/snapshot/capture_memory.cc -@@ -117,6 +117,16 @@ void CaptureMemory::PointedToByContext(c - for (size_t i = 0; i < std::size(context.mipsel->regs); ++i) { - MaybeCaptureMemoryAround(delegate, context.mipsel->regs[i]); - } -+#elif defined(ARCH_CPU_RISCV_FAMILY) -+ if (context.architecture == kCPUArchitectureRISCV64) { -+ for (size_t i = 0; i < std::size(context.riscv64->regs); ++i) { -+ MaybeCaptureMemoryAround(delegate, context.riscv64->regs[i]); -+ } -+ } else { -+ for (size_t i = 0; i < std::size(context.riscv32->regs); ++i) { -+ MaybeCaptureMemoryAround(delegate, context.riscv32->regs[i]); -+ } -+ } - #else - #error Port. - #endif -Index: chromium/third_party/crashpad/crashpad/snapshot/cpu_architecture.h -=================================================================== ---- chromium/third_party/crashpad/crashpad/snapshot/cpu_architecture.h -+++ chromium/third_party/crashpad/crashpad/snapshot/cpu_architecture.h -@@ -43,7 +43,13 @@ enum CPUArchitecture { - kCPUArchitectureMIPSEL, - - //! \brief 64-bit MIPSEL. -- kCPUArchitectureMIPS64EL -+ kCPUArchitectureMIPS64EL, -+ -+ //! \brief 32-bit RISCV. -+ kCPUArchitectureRISCV32, -+ -+ //! \brief 64-bit RISCV. -+ kCPUArchitectureRISCV64 - }; - - } // namespace crashpad -Index: chromium/third_party/crashpad/crashpad/snapshot/cpu_context.cc -=================================================================== ---- chromium/third_party/crashpad/crashpad/snapshot/cpu_context.cc -+++ chromium/third_party/crashpad/crashpad/snapshot/cpu_context.cc -@@ -226,10 +226,12 @@ bool CPUContext::Is64Bit() const { - case kCPUArchitectureX86_64: - case kCPUArchitectureARM64: - case kCPUArchitectureMIPS64EL: -+ case kCPUArchitectureRISCV64: - return true; - case kCPUArchitectureX86: - case kCPUArchitectureARM: - case kCPUArchitectureMIPSEL: -+ case kCPUArchitectureRISCV32: - return false; - default: - NOTREACHED(); -Index: chromium/third_party/crashpad/crashpad/snapshot/cpu_context.h -=================================================================== ---- chromium/third_party/crashpad/crashpad/snapshot/cpu_context.h -+++ chromium/third_party/crashpad/crashpad/snapshot/cpu_context.h -@@ -362,6 +362,20 @@ struct CPUContextMIPS64 { - uint64_t fir; - }; - -+//! \brief A context structure carrying RISCV32 CPU state. -+struct CPUContextRISCV32 { -+ uint32_t regs[32]; -+ uint64_t fpregs[32]; -+ uint32_t fcsr; -+}; -+ -+//! \brief A context structure carrying RISCV64 CPU state. -+struct CPUContextRISCV64 { -+ uint64_t regs[32]; -+ uint64_t fpregs[32]; -+ uint32_t fcsr; -+}; -+ - //! \brief A context structure capable of carrying the context of any supported - //! CPU architecture. - struct CPUContext { -@@ -402,6 +416,8 @@ struct CPUContext { - CPUContextARM64* arm64; - CPUContextMIPS* mipsel; - CPUContextMIPS64* mips64; -+ CPUContextRISCV32* riscv32; -+ CPUContextRISCV64* riscv64; - }; - }; - -Index: chromium/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.cc -=================================================================== ---- chromium/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.cc -+++ chromium/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.cc -@@ -266,6 +266,30 @@ void InitializeCPUContextARM64_OnlyFPSIM - context->fpcr = float_context.fpcr; - } - -+#elif defined(ARCH_CPU_RISCV_FAMILY) -+ -+template -+void InitializeCPUContextRISCV( -+ const typename Traits::SignalThreadContext& thread_context, -+ const typename Traits::SignalFloatContext& float_context, -+ typename Traits::CPUContext* context) { -+ static_assert(sizeof(context->regs) == sizeof(thread_context), -+ "registers size mismatch"); -+ static_assert(sizeof(context->fpregs) == sizeof(float_context.f), -+ "fp registers size mismatch"); -+ memcpy(&context->regs, &thread_context, sizeof(context->regs)); -+ memcpy(&context->fpregs, &float_context.f, sizeof(context->fpregs)); -+ context->fcsr = float_context.fcsr; -+} -+template void InitializeCPUContextRISCV( -+ const ContextTraits32::SignalThreadContext& thread_context, -+ const ContextTraits32::SignalFloatContext& float_context, -+ ContextTraits32::CPUContext* context); -+template void InitializeCPUContextRISCV( -+ const ContextTraits64::SignalThreadContext& thread_context, -+ const ContextTraits64::SignalFloatContext& float_context, -+ ContextTraits64::CPUContext* context); -+ - #endif // ARCH_CPU_X86_FAMILY - - } // namespace internal -Index: chromium/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h -=================================================================== ---- chromium/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h -+++ chromium/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h -@@ -174,6 +174,22 @@ void InitializeCPUContextMIPS( - - #endif // ARCH_CPU_MIPS_FAMILY || DOXYGEN - -+#if defined(ARCH_CPU_RISCV_FAMILY) || DOXYGEN -+ -+//! \brief Initializes a CPUContextRISCV structure from native context -+//! structures on Linux. -+//! -+//! \param[in] thread_context The native thread context. -+//! \param[in] float_context The native float context. -+//! \param[out] context The CPUContextRISCV structure to initialize. -+template -+void InitializeCPUContextRISCV( -+ const typename Traits::SignalThreadContext& thread_context, -+ const typename Traits::SignalFloatContext& float_context, -+ typename Traits::CPUContext* context); -+ -+#endif // ARCH_CPU_RISCV_FAMILY || DOXYGEN -+ - } // namespace internal - } // namespace crashpad - -Index: chromium/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc -=================================================================== ---- chromium/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc -+++ chromium/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc -@@ -325,6 +325,61 @@ bool ExceptionSnapshotLinux::ReadContext - reader, context_address, context_.mips64); - } - -+#elif defined(ARCH_CPU_RISCV_FAMILY) -+ -+template -+static bool ReadContext(ProcessReaderLinux* reader, -+ LinuxVMAddress context_address, -+ typename Traits::CPUContext* dest_context) { -+ const ProcessMemory* memory = reader->Memory(); -+ -+ LinuxVMAddress gregs_address = context_address + -+ offsetof(UContext, mcontext) + -+ offsetof(typename Traits::MContext, gregs); -+ -+ typename Traits::SignalThreadContext thread_context; -+ if (!memory->Read(gregs_address, sizeof(thread_context), &thread_context)) { -+ LOG(ERROR) << "Couldn't read gregs"; -+ return false; -+ } -+ -+ LinuxVMAddress fpregs_address = context_address + -+ offsetof(UContext, mcontext) + -+ offsetof(typename Traits::MContext, fpregs); -+ -+ typename Traits::SignalFloatContext fp_context; -+ if (!memory->Read(fpregs_address, sizeof(fp_context), &fp_context)) { -+ LOG(ERROR) << "Couldn't read fpregs"; -+ return false; -+ } -+ -+ InitializeCPUContextRISCV(thread_context, fp_context, dest_context); -+ -+ return true; -+} -+ -+template <> -+bool ExceptionSnapshotLinux::ReadContext( -+ ProcessReaderLinux* reader, -+ LinuxVMAddress context_address) { -+ context_.architecture = kCPUArchitectureRISCV32; -+ context_.riscv32 = &context_union_.riscv32; -+ -+ return internal::ReadContext( -+ reader, context_address, context_.riscv32); -+} -+ -+template <> -+bool ExceptionSnapshotLinux::ReadContext( -+ ProcessReaderLinux* reader, -+ LinuxVMAddress context_address) { -+ context_.architecture = kCPUArchitectureRISCV64; -+ context_.riscv64 = &context_union_.riscv64; -+ -+ return internal::ReadContext( -+ reader, context_address, context_.riscv64); -+} -+ - #endif // ARCH_CPU_X86_FAMILY - - bool ExceptionSnapshotLinux::Initialize( -Index: chromium/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h -=================================================================== ---- chromium/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h -+++ chromium/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h -@@ -89,6 +89,9 @@ class ExceptionSnapshotLinux final : pub - #elif defined(ARCH_CPU_MIPS_FAMILY) - CPUContextMIPS mipsel; - CPUContextMIPS64 mips64; -+#elif defined(ARCH_CPU_RISCV_FAMILY) -+ CPUContextRISCV32 riscv32; -+ CPUContextRISCV64 riscv64; - #endif - } context_union_; - CPUContext context_; -Index: chromium/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc -=================================================================== ---- chromium/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc -+++ chromium/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc -@@ -127,6 +127,9 @@ void ProcessReaderLinux::Thread::Initial - #elif defined(ARCH_CPU_MIPS_FAMILY) - stack_pointer = reader->Is64Bit() ? thread_info.thread_context.t64.regs[29] - : thread_info.thread_context.t32.regs[29]; -+#elif defined(ARCH_CPU_RISCV_FAMILY) -+ stack_pointer = reader->Is64Bit() ? thread_info.thread_context.t64.sp -+ : thread_info.thread_context.t32.sp; - #else - #error Port. - #endif -Index: chromium/third_party/crashpad/crashpad/snapshot/linux/signal_context.h -=================================================================== ---- chromium/third_party/crashpad/crashpad/snapshot/linux/signal_context.h -+++ chromium/third_party/crashpad/crashpad/snapshot/linux/signal_context.h -@@ -422,6 +422,67 @@ static_assert(offsetof(UContext -+struct UContext { -+ typename Traits::ULong flags; -+ typename Traits::Address link; -+ SignalStack stack; -+ Sigset sigmask; -+ char padding[128 - sizeof(sigmask)]; -+ typename Traits::Char_64Only padding2[8]; -+ typename Traits::MContext mcontext; -+}; -+ -+#if defined(ARCH_CPU_RISCV32) -+static_assert(offsetof(UContext, mcontext) == -+ offsetof(ucontext_t, uc_mcontext), -+ "context offset mismatch"); -+static_assert(offsetof(UContext, mcontext.gregs) == -+ offsetof(ucontext_t, uc_mcontext.__gregs), -+ "context offset mismatch"); -+static_assert(offsetof(UContext, mcontext.fpregs) == -+ offsetof(ucontext_t, uc_mcontext.__fpregs), -+ "context offset mismatch"); -+#elif defined(ARCH_CPU_RISCV64) -+static_assert(offsetof(UContext, mcontext) == -+ offsetof(ucontext_t, uc_mcontext), -+ "context offset mismatch"); -+static_assert(offsetof(UContext, mcontext.gregs) == -+ offsetof(ucontext_t, uc_mcontext.__gregs), -+ "context offset mismatch"); -+static_assert(offsetof(UContext, mcontext.fpregs) == -+ offsetof(ucontext_t, uc_mcontext.__fpregs), -+ "context offset mismatch"); -+#endif -+ - #else - #error Port. - #endif // ARCH_CPU_X86_FAMILY -Index: chromium/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc -=================================================================== ---- chromium/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc -+++ chromium/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc -@@ -205,6 +205,9 @@ CPUArchitecture SystemSnapshotLinux::Get - #elif defined(ARCH_CPU_MIPS_FAMILY) - return process_reader_->Is64Bit() ? kCPUArchitectureMIPS64EL - : kCPUArchitectureMIPSEL; -+#elif defined(ARCH_CPU_RISCV_FAMILY) -+ return process_reader_->Is64Bit() ? kCPUArchitectureRISCV64 -+ : kCPUArchitectureRISCV32; - #else - #error port to your architecture - #endif -@@ -220,6 +223,9 @@ uint32_t SystemSnapshotLinux::CPURevisio - #elif defined(ARCH_CPU_MIPS_FAMILY) - // Not implementable on MIPS - return 0; -+#elif defined(ARCH_CPU_RISCV_FAMILY) -+ // Not implementable on RISCV -+ return 0; - #else - #error port to your architecture - #endif -@@ -240,6 +246,9 @@ std::string SystemSnapshotLinux::CPUVend - #elif defined(ARCH_CPU_MIPS_FAMILY) - // Not implementable on MIPS - return std::string(); -+#elif defined(ARCH_CPU_RISCV_FAMILY) -+ // Not implementable on RISCV -+ return std::string(); - #else - #error port to your architecture - #endif -@@ -373,6 +382,9 @@ bool SystemSnapshotLinux::NXEnabled() co - #elif defined(ARCH_CPU_MIPS_FAMILY) - // Not implementable on MIPS - return false; -+#elif defined(ARCH_CPU_RISCV_FAMILY) -+ // Not implementable on RISCV -+ return false; - #else - #error Port. - #endif // ARCH_CPU_X86_FAMILY -Index: chromium/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc -=================================================================== ---- chromium/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc -+++ chromium/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc -@@ -190,6 +190,22 @@ bool ThreadSnapshotLinux::Initialize( - thread.thread_info.float_context.f32, - context_.mipsel); - } -+#elif defined(ARCH_CPU_RISCV_FAMILY) -+ if (process_reader->Is64Bit()) { -+ context_.architecture = kCPUArchitectureRISCV64; -+ context_.riscv64 = &context_union_.riscv64; -+ InitializeCPUContextRISCV( -+ thread.thread_info.thread_context.t64, -+ thread.thread_info.float_context.f64, -+ context_.riscv64); -+ } else { -+ context_.architecture = kCPUArchitectureRISCV32; -+ context_.riscv32 = &context_union_.riscv32; -+ InitializeCPUContextRISCV( -+ thread.thread_info.thread_context.t32, -+ thread.thread_info.float_context.f32, -+ context_.riscv32); -+ } - #else - #error Port. - #endif -Index: chromium/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h -=================================================================== ---- chromium/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h -+++ chromium/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h -@@ -74,6 +74,9 @@ class ThreadSnapshotLinux final : public - #elif defined(ARCH_CPU_MIPS_FAMILY) - CPUContextMIPS mipsel; - CPUContextMIPS64 mips64; -+#elif defined(ARCH_CPU_RISCV_FAMILY) -+ CPUContextRISCV32 riscv32; -+ CPUContextRISCV64 riscv64; - #else - #error Port. - #endif // ARCH_CPU_X86_FAMILY -Index: chromium/third_party/crashpad/crashpad/util/linux/ptracer.cc -=================================================================== ---- chromium/third_party/crashpad/crashpad/util/linux/ptracer.cc -+++ chromium/third_party/crashpad/crashpad/util/linux/ptracer.cc -@@ -398,6 +398,51 @@ bool GetThreadArea64(pid_t tid, - return true; - } - -+#elif defined(ARCH_CPU_RISCV_FAMILY) -+ -+template -+bool GetRegisterSet(pid_t tid, int set, Destination* dest, bool can_log) { -+ iovec iov; -+ iov.iov_base = dest; -+ iov.iov_len = sizeof(*dest); -+ if (ptrace(PTRACE_GETREGSET, tid, reinterpret_cast(set), &iov) != 0) { -+ PLOG_IF(ERROR, can_log) << "ptrace"; -+ return false; -+ } -+ if (iov.iov_len != sizeof(*dest)) { -+ LOG_IF(ERROR, can_log) << "Unexpected registers size"; -+ return false; -+ } -+ return true; -+} -+ -+bool GetFloatingPointRegisters32(pid_t tid, -+ FloatContext* context, -+ bool can_log) { -+ return false; -+} -+ -+bool GetFloatingPointRegisters64(pid_t tid, -+ FloatContext* context, -+ bool can_log) { -+ return GetRegisterSet(tid, NT_PRFPREG, &context->f64.f, can_log); -+} -+ -+bool GetThreadArea32(pid_t tid, -+ const ThreadContext& context, -+ LinuxVMAddress* address, -+ bool can_log) { -+ return false; -+} -+ -+bool GetThreadArea64(pid_t tid, -+ const ThreadContext& context, -+ LinuxVMAddress* address, -+ bool can_log) { -+ *address = context.t64.tp; -+ return true; -+} -+ - #else - #error Port. - #endif // ARCH_CPU_X86_FAMILY -Index: chromium/third_party/crashpad/crashpad/util/linux/thread_info.h -=================================================================== ---- chromium/third_party/crashpad/crashpad/util/linux/thread_info.h -+++ chromium/third_party/crashpad/crashpad/util/linux/thread_info.h -@@ -79,6 +79,40 @@ union ThreadContext { - uint32_t cp0_status; - uint32_t cp0_cause; - uint32_t padding1_; -+#elif defined(ARCH_CPU_RISCV_FAMILY) -+ // Reflects user_regs_struct in asm/ptrace.h. -+ uint32_t pc; -+ uint32_t ra; -+ uint32_t sp; -+ uint32_t gp; -+ uint32_t tp; -+ uint32_t t0; -+ uint32_t t1; -+ uint32_t t2; -+ uint32_t s0; -+ uint32_t s1; -+ uint32_t a0; -+ uint32_t a1; -+ uint32_t a2; -+ uint32_t a3; -+ uint32_t a4; -+ uint32_t a5; -+ uint32_t a6; -+ uint32_t a7; -+ uint32_t s2; -+ uint32_t s3; -+ uint32_t s4; -+ uint32_t s5; -+ uint32_t s6; -+ uint32_t s7; -+ uint32_t s8; -+ uint32_t s9; -+ uint32_t s10; -+ uint32_t s11; -+ uint32_t t3; -+ uint32_t t4; -+ uint32_t t5; -+ uint32_t t6; - #else - #error Port. - #endif // ARCH_CPU_X86_FAMILY -@@ -132,6 +166,40 @@ union ThreadContext { - uint64_t cp0_badvaddr; - uint64_t cp0_status; - uint64_t cp0_cause; -+#elif defined(ARCH_CPU_RISCV_FAMILY) -+ // Reflects user_regs_struct in asm/ptrace.h. -+ uint64_t pc; -+ uint64_t ra; -+ uint64_t sp; -+ uint64_t gp; -+ uint64_t tp; -+ uint64_t t0; -+ uint64_t t1; -+ uint64_t t2; -+ uint64_t s0; -+ uint64_t s1; -+ uint64_t a0; -+ uint64_t a1; -+ uint64_t a2; -+ uint64_t a3; -+ uint64_t a4; -+ uint64_t a5; -+ uint64_t a6; -+ uint64_t a7; -+ uint64_t s2; -+ uint64_t s3; -+ uint64_t s4; -+ uint64_t s5; -+ uint64_t s6; -+ uint64_t s7; -+ uint64_t s8; -+ uint64_t s9; -+ uint64_t s10; -+ uint64_t s11; -+ uint64_t t3; -+ uint64_t t4; -+ uint64_t t5; -+ uint64_t t6; - #else - #error Port. - #endif // ARCH_CPU_X86_FAMILY -@@ -143,11 +211,12 @@ union ThreadContext { - using NativeThreadContext = user_regs; - #elif defined(ARCH_CPU_MIPS_FAMILY) - // No appropriate NativeThreadsContext type available for MIPS -+#elif defined(ARCH_CPU_RISCV_FAMILY) - #else - #error Port. - #endif // ARCH_CPU_X86_FAMILY || ARCH_CPU_ARM64 - --#if !defined(ARCH_CPU_MIPS_FAMILY) -+#if !defined(ARCH_CPU_MIPS_FAMILY) && !defined(ARCH_CPU_RISCV_FAMILY) - #if defined(ARCH_CPU_32_BITS) - static_assert(sizeof(t32_t) == sizeof(NativeThreadContext), "Size mismatch"); - #else // ARCH_CPU_64_BITS -@@ -218,6 +287,9 @@ union FloatContext { - } fpregs[32]; - uint32_t fpcsr; - uint32_t fpu_id; -+#elif defined(ARCH_CPU_RISCV_FAMILY) -+ uint64_t f[32]; -+ uint32_t fcsr; - #else - #error Port. - #endif // ARCH_CPU_X86_FAMILY -@@ -252,6 +324,9 @@ union FloatContext { - double fpregs[32]; - uint32_t fpcsr; - uint32_t fpu_id; -+#elif defined(ARCH_CPU_RISCV_FAMILY) -+ uint64_t f[32]; -+ uint32_t fcsr; - #else - #error Port. - #endif // ARCH_CPU_X86_FAMILY -@@ -281,6 +356,7 @@ union FloatContext { - static_assert(sizeof(f64) == sizeof(user_fpsimd_struct), "Size mismatch"); - #elif defined(ARCH_CPU_MIPS_FAMILY) - // No appropriate floating point context native type for available MIPS. -+#elif defined(ARCH_CPU_RISCV_FAMILY) - #else - #error Port. - #endif // ARCH_CPU_X86 -Index: chromium/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc -=================================================================== ---- chromium/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc -+++ chromium/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc -@@ -237,6 +237,8 @@ std::string UserAgent() { - #elif defined(ARCH_CPU_BIG_ENDIAN) - static constexpr char arch[] = "aarch64_be"; - #endif -+#elif defined(ARCH_CPU_RISCV64) -+ static constexpr char arch[] = "riscv64"; - #else - #error Port - #endif diff --git a/riscv-sandbox.patch b/riscv-sandbox.patch index 6b58ac65be5c108c44f37291ddf7baacd6fde3a5..5211d9721963ed201524e1d60671956de24f2d8b 100644 --- a/riscv-sandbox.patch +++ b/riscv-sandbox.patch @@ -1,5 +1,5 @@ -Index: chromium/sandbox/features.gni -=================================================================== +diff --git chromium/sandbox/features.gni chromium/sandbox/features.gni +index 8434144..8aa5298 100644 --- chromium/sandbox/features.gni +++ chromium/sandbox/features.gni @@ -9,7 +9,8 @@ @@ -12,8 +12,8 @@ Index: chromium/sandbox/features.gni # SSBD (Speculative Store Bypass Disable) is a mitigation of Spectre Variant 4. # As Spectre Variant 4 can be mitigated by site isolation, opt-out SSBD on site -Index: chromium/sandbox/linux/bpf_dsl/linux_syscall_ranges.h -=================================================================== +diff --git chromium/sandbox/linux/bpf_dsl/linux_syscall_ranges.h chromium/sandbox/linux/bpf_dsl/linux_syscall_ranges.h +index 1d0590b..3bf3cb2 100644 --- chromium/sandbox/linux/bpf_dsl/linux_syscall_ranges.h +++ chromium/sandbox/linux/bpf_dsl/linux_syscall_ranges.h @@ -56,6 +56,12 @@ @@ -29,8 +29,8 @@ Index: chromium/sandbox/linux/bpf_dsl/linux_syscall_ranges.h #else #error "Unsupported architecture" #endif -Index: chromium/sandbox/linux/bpf_dsl/seccomp_macros.h -=================================================================== +diff --git chromium/sandbox/linux/bpf_dsl/seccomp_macros.h chromium/sandbox/linux/bpf_dsl/seccomp_macros.h +index 87d5825..cc9b89b 100644 --- chromium/sandbox/linux/bpf_dsl/seccomp_macros.h +++ chromium/sandbox/linux/bpf_dsl/seccomp_macros.h @@ -343,6 +343,46 @@ struct regs_struct { @@ -80,21 +80,21 @@ Index: chromium/sandbox/linux/bpf_dsl/seccomp_macros.h #else #error Unsupported target platform -Index: chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc -=================================================================== +diff --git chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc +index 7bde501..0c26728 100644 --- chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc +++ chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc -@@ -61,6 +61,9 @@ bool IsBaselinePolicyAllowed(int sysno) +@@ -59,6 +59,9 @@ bool IsBaselinePolicyAllowed(int sysno) { + #endif #if defined(__mips__) SyscallSets::IsMipsPrivate(sysno) || - #endif ++#endif +#if defined(__riscv) + SyscallSets::IsRiscvPrivate(sysno) || -+#endif + #endif SyscallSets::IsAllowedOperationOnFd(sysno); // clang-format on - } -@@ -198,7 +201,7 @@ ResultExpr EvaluateSyscallImpl(int fs_de +@@ -193,7 +196,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno, return RestrictFcntlCommands(); #endif @@ -103,7 +103,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc // fork() is never used as a system call (clone() is used instead), but we // have seen it in fallback code on Android. if (sysno == __NR_fork) { -@@ -253,7 +256,7 @@ ResultExpr EvaluateSyscallImpl(int fs_de +@@ -255,7 +258,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno, } #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \ @@ -112,7 +112,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc if (sysno == __NR_mmap) return RestrictMmapFlags(); #endif -@@ -274,7 +277,7 @@ ResultExpr EvaluateSyscallImpl(int fs_de +@@ -276,7 +279,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno, return RestrictPrctl(); #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \ @@ -121,8 +121,8 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc if (sysno == __NR_socketpair) { // Only allow AF_UNIX, PF_UNIX. Crash if anything else is seen. static_assert(AF_UNIX == PF_UNIX, -Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc -=================================================================== +diff --git chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc +index 74112e8..d7c23bf 100644 --- chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc +++ chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc @@ -37,6 +37,7 @@ @@ -133,17 +133,17 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restriction !defined(PTRACE_GET_THREAD_AREA) // Also include asm/ptrace-abi.h since ptrace.h in older libc (for instance // the one in Ubuntu 16.04 LTS) is missing PTRACE_GET_THREAD_AREA. -@@ -443,7 +444,7 @@ ResultExpr RestrictPtrace() { +@@ -463,7 +464,7 @@ ResultExpr RestrictPtrace() { #endif return Switch(request) - .CASES(( + .Cases({ -#if !defined(__aarch64__) +#if !defined(__aarch64__) && !defined(__riscv) PTRACE_GETREGS, PTRACE_GETFPREGS, PTRACE_GET_THREAD_AREA, PTRACE_GETREGSET, #endif -Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc -=================================================================== +diff --git chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc +index 4cde283..aa55880 100644 --- chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc +++ chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc @@ -103,7 +103,7 @@ bool SyscallSets::IsUmask(int sysno) { @@ -155,7 +155,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc case __NR_access: // EPERM not a valid errno. case __NR_chmod: case __NR_chown: -@@ -136,7 +136,7 @@ bool SyscallSets::IsFileSystem(int sysno +@@ -136,7 +136,7 @@ bool SyscallSets::IsFileSystem(int sysno) { case __NR_faccessat2: case __NR_fchmodat: case __NR_fchownat: // Should be called chownat ? @@ -164,7 +164,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc case __NR_newfstatat: // fstatat(). EPERM not a valid errno. #elif defined(__i386__) || defined(__arm__) || \ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) -@@ -226,7 +226,7 @@ bool SyscallSets::IsAllowedFileSystemAcc +@@ -241,7 +241,7 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) { case __NR_oldfstat: #endif #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \ @@ -173,7 +173,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc case __NR_sync_file_range: // EPERM not a valid errno. #elif defined(__arm__) case __NR_arm_sync_file_range: // EPERM not a valid errno. -@@ -245,7 +245,7 @@ bool SyscallSets::IsDeniedFileSystemAcce +@@ -260,7 +260,7 @@ bool SyscallSets::IsDeniedFileSystemAccessViaFd(int sysno) { #if defined(__i386__) || defined(__arm__) case __NR_fchown32: #endif @@ -182,7 +182,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc case __NR_getdents: // EPERM not a valid errno. #endif case __NR_getdents64: // EPERM not a valid errno. -@@ -324,7 +324,7 @@ bool SyscallSets::IsProcessPrivilegeChan +@@ -339,7 +339,7 @@ bool SyscallSets::IsProcessPrivilegeChange(int sysno) { bool SyscallSets::IsProcessGroupOrSession(int sysno) { switch (sysno) { case __NR_setpgid: @@ -191,7 +191,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc case __NR_getpgrp: #endif case __NR_setsid: -@@ -358,7 +358,7 @@ bool SyscallSets::IsAllowedSignalHandlin +@@ -373,7 +373,7 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) { case __NR_rt_sigqueueinfo: case __NR_rt_sigsuspend: case __NR_rt_tgsigqueueinfo: @@ -200,7 +200,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc case __NR_signalfd: #endif case __NR_signalfd4: -@@ -382,12 +382,12 @@ bool SyscallSets::IsAllowedOperationOnFd +@@ -397,12 +397,12 @@ bool SyscallSets::IsAllowedOperationOnFd(int sysno) { switch (sysno) { case __NR_close: case __NR_dup: @@ -215,7 +215,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc case __NR_shutdown: #endif return true; -@@ -426,7 +426,7 @@ bool SyscallSets::IsAllowedProcessStartO +@@ -441,7 +441,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) { return true; case __NR_clone: // Should be parameter-restricted. case __NR_setns: // Privileged. @@ -224,7 +224,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc case __NR_fork: #endif #if defined(__i386__) || defined(__x86_64__) -@@ -437,7 +437,7 @@ bool SyscallSets::IsAllowedProcessStartO +@@ -452,7 +452,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) { #endif case __NR_set_tid_address: case __NR_unshare: @@ -233,7 +233,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc case __NR_vfork: #endif default: -@@ -462,7 +462,7 @@ bool SyscallSets::IsAllowedFutex(int sys +@@ -477,7 +477,7 @@ bool SyscallSets::IsAllowedFutex(int sysno) { bool SyscallSets::IsAllowedEpoll(int sysno) { switch (sysno) { @@ -242,24 +242,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc case __NR_epoll_create: case __NR_epoll_wait: #endif -@@ -483,14 +483,14 @@ bool SyscallSets::IsAllowedEpoll(int sys - - bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) { - switch (sysno) { --#if !defined(__aarch64__) -+#if !defined(__aarch64__) && !defined(__riscv) - case __NR_pipe: - #endif - case __NR_pipe2: - return true; - default: - #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \ -- defined(__aarch64__) -+ defined(__aarch64__) || defined(__riscv) - case __NR_socketpair: // We will want to inspect its argument. - #endif - return false; -@@ -500,7 +500,7 @@ bool SyscallSets::IsAllowedGetOrModifySo +@@ -499,7 +499,7 @@ bool SyscallSets::IsAllowedEpoll(int sysno) { bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) { switch (sysno) { #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \ @@ -268,7 +251,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc case __NR_accept: case __NR_accept4: case __NR_bind: -@@ -554,7 +554,7 @@ bool SyscallSets::IsAllowedAddressSpaceA +@@ -553,7 +553,7 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) { case __NR_mincore: case __NR_mlockall: #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \ @@ -277,7 +260,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc case __NR_mmap: #endif #if defined(__i386__) || defined(__arm__) || \ -@@ -587,7 +587,7 @@ bool SyscallSets::IsAllowedGeneralIo(int +@@ -586,7 +586,7 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) { (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) case __NR__llseek: #endif @@ -286,7 +269,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc case __NR_poll: #endif case __NR_ppoll: -@@ -608,7 +608,7 @@ bool SyscallSets::IsAllowedGeneralIo(int +@@ -607,7 +607,7 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) { case __NR_recv: #endif #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \ @@ -295,7 +278,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc case __NR_recvfrom: // Could specify source. case __NR_recvmsg: // Could specify source. #endif -@@ -623,7 +623,7 @@ bool SyscallSets::IsAllowedGeneralIo(int +@@ -622,7 +622,7 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) { case __NR_send: #endif #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \ @@ -304,7 +287,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc case __NR_sendmsg: // Could specify destination. case __NR_sendto: // Could specify destination. #endif -@@ -672,7 +672,7 @@ bool SyscallSets::IsSeccomp(int sysno) { +@@ -671,7 +671,7 @@ bool SyscallSets::IsSeccomp(int sysno) { bool SyscallSets::IsAllowedBasicScheduler(int sysno) { switch (sysno) { case __NR_sched_yield: @@ -313,7 +296,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc case __NR_pause: #endif case __NR_nanosleep: -@@ -756,7 +756,7 @@ bool SyscallSets::IsNuma(int sysno) { +@@ -755,7 +755,7 @@ bool SyscallSets::IsNuma(int sysno) { case __NR_getcpu: case __NR_mbind: #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \ @@ -322,7 +305,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc case __NR_migrate_pages: #endif case __NR_move_pages: -@@ -791,7 +791,7 @@ bool SyscallSets::IsGlobalProcessEnviron +@@ -790,7 +790,7 @@ bool SyscallSets::IsGlobalProcessEnvironment(int sysno) { switch (sysno) { case __NR_acct: // Privileged. #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \ @@ -331,7 +314,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc case __NR_getrlimit: #endif #if defined(__i386__) || defined(__arm__) -@@ -826,7 +826,7 @@ bool SyscallSets::IsDebug(int sysno) { +@@ -825,7 +825,7 @@ bool SyscallSets::IsDebug(int sysno) { bool SyscallSets::IsGlobalSystemStatus(int sysno) { switch (sysno) { @@ -340,7 +323,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc case __NR__sysctl: case __NR_sysfs: #endif -@@ -844,7 +844,7 @@ bool SyscallSets::IsGlobalSystemStatus(i +@@ -843,7 +843,7 @@ bool SyscallSets::IsGlobalSystemStatus(int sysno) { bool SyscallSets::IsEventFd(int sysno) { switch (sysno) { @@ -349,7 +332,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc case __NR_eventfd: #endif case __NR_eventfd2: -@@ -896,7 +896,8 @@ bool SyscallSets::IsKeyManagement(int sy +@@ -895,7 +895,8 @@ bool SyscallSets::IsKeyManagement(int sysno) { } #if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || \ @@ -359,7 +342,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc bool SyscallSets::IsSystemVSemaphores(int sysno) { switch (sysno) { case __NR_semctl: -@@ -916,7 +917,8 @@ bool SyscallSets::IsSystemVSemaphores(in +@@ -915,7 +916,8 @@ bool SyscallSets::IsSystemVSemaphores(int sysno) { #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \ defined(__aarch64__) || \ @@ -369,7 +352,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc // These give a lot of ambient authority and bypass the setuid sandbox. bool SyscallSets::IsSystemVSharedMemory(int sysno) { switch (sysno) { -@@ -932,7 +934,8 @@ bool SyscallSets::IsSystemVSharedMemory( +@@ -931,7 +933,8 @@ bool SyscallSets::IsSystemVSharedMemory(int sysno) { #endif #if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || \ @@ -379,7 +362,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc bool SyscallSets::IsSystemVMessageQueue(int sysno) { switch (sysno) { case __NR_msgctl: -@@ -963,7 +966,8 @@ bool SyscallSets::IsSystemVIpc(int sysno +@@ -962,7 +965,8 @@ bool SyscallSets::IsSystemVIpc(int sysno) { bool SyscallSets::IsAnySystemV(int sysno) { #if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || \ @@ -389,7 +372,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc return IsSystemVMessageQueue(sysno) || IsSystemVSemaphores(sysno) || IsSystemVSharedMemory(sysno); #elif defined(__i386__) || \ -@@ -1000,7 +1004,7 @@ bool SyscallSets::IsAdvancedScheduler(in +@@ -999,7 +1003,7 @@ bool SyscallSets::IsAdvancedScheduler(int sysno) { bool SyscallSets::IsInotify(int sysno) { switch (sysno) { case __NR_inotify_add_watch: @@ -398,7 +381,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc case __NR_inotify_init: #endif case __NR_inotify_init1: -@@ -1138,7 +1142,7 @@ bool SyscallSets::IsMisc(int sysno) { +@@ -1134,7 +1138,7 @@ bool SyscallSets::IsMisc(int sysno) { #if defined(__x86_64__) case __NR_tuxcall: #endif @@ -407,7 +390,7 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc case __NR_vserver: #endif return true; -@@ -1173,6 +1177,17 @@ bool SyscallSets::IsArmPrivate(int sysno +@@ -1169,6 +1173,17 @@ bool SyscallSets::IsArmPrivate(int sysno) { } #endif // defined(__arm__) @@ -425,8 +408,8 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc #if defined(__mips__) bool SyscallSets::IsMipsPrivate(int sysno) { switch (sysno) { -Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h -=================================================================== +diff --git chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h +index 9be7b03..41b3605 100644 --- chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h +++ chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h @@ -52,7 +52,7 @@ class SANDBOX_EXPORT SyscallSets { @@ -473,8 +456,8 @@ Index: chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h static bool IsGoogle3Threading(int sysno); }; -Index: chromium/sandbox/linux/seccomp-bpf/syscall.cc -=================================================================== +diff --git chromium/sandbox/linux/seccomp-bpf/syscall.cc chromium/sandbox/linux/seccomp-bpf/syscall.cc +index 02cbb04..61453ec 100644 --- chromium/sandbox/linux/seccomp-bpf/syscall.cc +++ chromium/sandbox/linux/seccomp-bpf/syscall.cc @@ -18,7 +18,7 @@ namespace sandbox { @@ -486,7 +469,7 @@ Index: chromium/sandbox/linux/seccomp-bpf/syscall.cc // Number that's not currently used by any Linux kernel ABIs. const int kInvalidSyscallNumber = 0x351d3; #else -@@ -308,6 +308,28 @@ asm(// We need to be able to tell the ke +@@ -308,6 +308,28 @@ asm(// We need to be able to tell the kernel exactly where we made a "2:ret\n" ".cfi_endproc\n" ".size SyscallAsm, .-SyscallAsm\n" @@ -534,21 +517,21 @@ Index: chromium/sandbox/linux/seccomp-bpf/syscall.cc #else #error "Unimplemented architecture" #endif -Index: chromium/sandbox/linux/services/credentials.cc -=================================================================== +diff --git chromium/sandbox/linux/services/credentials.cc chromium/sandbox/linux/services/credentials.cc +index a33597c..d4180ac 100644 --- chromium/sandbox/linux/services/credentials.cc +++ chromium/sandbox/linux/services/credentials.cc @@ -80,7 +80,7 @@ bool ChrootToSafeEmptyDir() { - pid_t pid = -1; - alignas(16) char stack_buf[PTHREAD_STACK_MIN]; + alignas(16) char stack_buf[PTHREAD_STACK_MIN_CONST]; + #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \ - defined(ARCH_CPU_MIPS_FAMILY) + defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_RISCV_FAMILY) // The stack grows downward. void* stack = stack_buf + sizeof(stack_buf); #else -Index: chromium/sandbox/linux/services/syscall_wrappers.cc -=================================================================== +diff --git chromium/sandbox/linux/services/syscall_wrappers.cc chromium/sandbox/linux/services/syscall_wrappers.cc +index 7650e98..bb4bd33 100644 --- chromium/sandbox/linux/services/syscall_wrappers.cc +++ chromium/sandbox/linux/services/syscall_wrappers.cc @@ -61,7 +61,7 @@ long sys_clone(unsigned long flags, @@ -560,11 +543,11 @@ Index: chromium/sandbox/linux/services/syscall_wrappers.cc // CONFIG_CLONE_BACKWARDS defined. return syscall(__NR_clone, flags, child_stack, ptid, tls, ctid); #endif -Index: chromium/sandbox/linux/syscall_broker/broker_process.cc -=================================================================== +diff --git chromium/sandbox/linux/syscall_broker/broker_process.cc chromium/sandbox/linux/syscall_broker/broker_process.cc +index c6c1117..779065a 100644 --- chromium/sandbox/linux/syscall_broker/broker_process.cc +++ chromium/sandbox/linux/syscall_broker/broker_process.cc -@@ -117,44 +117,46 @@ bool BrokerProcess::IsSyscallBrokerable( +@@ -122,44 +122,46 @@ bool BrokerProcess::IsSyscallBrokerable(int sysno, bool fast_check) const { // and are default disabled in Android. So, we should refuse to broker them // to be consistent with the platform's restrictions. switch (sysno) { @@ -618,7 +601,7 @@ Index: chromium/sandbox/linux/syscall_broker/broker_process.cc case __NR_stat: case __NR_lstat: #endif -@@ -164,7 +166,7 @@ bool BrokerProcess::IsSyscallBrokerable( +@@ -169,7 +171,7 @@ bool BrokerProcess::IsSyscallBrokerable(int sysno, bool fast_check) const { #if defined(__NR_fstatat64) case __NR_fstatat64: #endif @@ -627,7 +610,7 @@ Index: chromium/sandbox/linux/syscall_broker/broker_process.cc case __NR_newfstatat: #endif return !fast_check || policy_->allowed_command_set.test(COMMAND_STAT); -@@ -179,7 +181,7 @@ bool BrokerProcess::IsSyscallBrokerable( +@@ -184,7 +186,7 @@ bool BrokerProcess::IsSyscallBrokerable(int sysno, bool fast_check) const { return !fast_check || policy_->allowed_command_set.test(COMMAND_STAT); #endif @@ -636,8 +619,8 @@ Index: chromium/sandbox/linux/syscall_broker/broker_process.cc case __NR_unlink: return !fast_check || policy_->allowed_command_set.test(COMMAND_UNLINK); #endif -Index: chromium/sandbox/linux/system_headers/linux_seccomp.h -=================================================================== +diff --git chromium/sandbox/linux/system_headers/linux_seccomp.h chromium/sandbox/linux/system_headers/linux_seccomp.h +index 8690a96..5e34038 100644 --- chromium/sandbox/linux/system_headers/linux_seccomp.h +++ chromium/sandbox/linux/system_headers/linux_seccomp.h @@ -38,6 +38,9 @@ @@ -660,8 +643,8 @@ Index: chromium/sandbox/linux/system_headers/linux_seccomp.h // For prctl.h #ifndef PR_SET_SECCOMP -Index: chromium/sandbox/linux/system_headers/linux_signal.h -=================================================================== +diff --git chromium/sandbox/linux/system_headers/linux_signal.h chromium/sandbox/linux/system_headers/linux_signal.h +index 69ccaf1..2ffe309 100644 --- chromium/sandbox/linux/system_headers/linux_signal.h +++ chromium/sandbox/linux/system_headers/linux_signal.h @@ -13,7 +13,7 @@ @@ -673,8 +656,8 @@ Index: chromium/sandbox/linux/system_headers/linux_signal.h #define LINUX_SIGHUP 1 #define LINUX_SIGINT 2 -Index: chromium/sandbox/linux/system_headers/linux_stat.h -=================================================================== +diff --git chromium/sandbox/linux/system_headers/linux_stat.h chromium/sandbox/linux/system_headers/linux_stat.h +index 3aae8cb..74977ad 100644 --- chromium/sandbox/linux/system_headers/linux_stat.h +++ chromium/sandbox/linux/system_headers/linux_stat.h @@ -150,7 +150,7 @@ struct kernel_stat { @@ -686,8 +669,8 @@ Index: chromium/sandbox/linux/system_headers/linux_stat.h struct kernel_stat { unsigned long st_dev; unsigned long st_ino; -Index: chromium/sandbox/linux/system_headers/linux_syscalls.h -=================================================================== +diff --git chromium/sandbox/linux/system_headers/linux_syscalls.h chromium/sandbox/linux/system_headers/linux_syscalls.h +index 438147b..d6de8c1 100644 --- chromium/sandbox/linux/system_headers/linux_syscalls.h +++ chromium/sandbox/linux/system_headers/linux_syscalls.h @@ -35,5 +35,9 @@ @@ -700,8 +683,9 @@ Index: chromium/sandbox/linux/system_headers/linux_syscalls.h + #endif // SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SYSCALLS_H_ -Index: chromium/sandbox/linux/system_headers/riscv64_linux_syscalls.h -=================================================================== +diff --git chromium/sandbox/linux/system_headers/riscv64_linux_syscalls.h chromium/sandbox/linux/system_headers/riscv64_linux_syscalls.h +new file mode 100644 +index 0000000..7615cd5 --- /dev/null +++ chromium/sandbox/linux/system_headers/riscv64_linux_syscalls.h @@ -0,0 +1,1222 @@ @@ -1927,11 +1911,11 @@ Index: chromium/sandbox/linux/system_headers/riscv64_linux_syscalls.h +#endif + +#endif // SANDBOX_LINUX_SYSTEM_HEADERS_RISCV64_LINUX_SYSCALLS_H_ -Index: chromium/sandbox/policy/linux/bpf_cros_amd_gpu_policy_linux.cc -=================================================================== +diff --git chromium/sandbox/policy/linux/bpf_cros_amd_gpu_policy_linux.cc chromium/sandbox/policy/linux/bpf_cros_amd_gpu_policy_linux.cc +index df2567f..41e158a 100644 --- chromium/sandbox/policy/linux/bpf_cros_amd_gpu_policy_linux.cc +++ chromium/sandbox/policy/linux/bpf_cros_amd_gpu_policy_linux.cc -@@ -38,7 +38,7 @@ ResultExpr CrosAmdGpuProcessPolicy::Eval +@@ -38,7 +38,7 @@ ResultExpr CrosAmdGpuProcessPolicy::EvaluateSyscall(int sysno) const { case __NR_sched_setscheduler: case __NR_sysinfo: case __NR_uname: @@ -1940,11 +1924,11 @@ Index: chromium/sandbox/policy/linux/bpf_cros_amd_gpu_policy_linux.cc case __NR_readlink: case __NR_stat: #endif -Index: chromium/sandbox/policy/linux/bpf_gpu_policy_linux.cc -=================================================================== +diff --git chromium/sandbox/policy/linux/bpf_gpu_policy_linux.cc chromium/sandbox/policy/linux/bpf_gpu_policy_linux.cc +index ef49a63..3334257 100644 --- chromium/sandbox/policy/linux/bpf_gpu_policy_linux.cc +++ chromium/sandbox/policy/linux/bpf_gpu_policy_linux.cc -@@ -73,7 +73,7 @@ ResultExpr GpuProcessPolicy::EvaluateSys +@@ -80,7 +80,7 @@ ResultExpr GpuProcessPolicy::EvaluateSyscall(int sysno) const { (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) case __NR_ftruncate64: #endif @@ -1953,3 +1937,6 @@ Index: chromium/sandbox/policy/linux/bpf_gpu_policy_linux.cc case __NR_getdents: #endif case __NR_getdents64: +-- +2.43.5 +