Message ID | 20190809080623.7548-2-y.karadz@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Handle the case when KernelShark is started as Root | expand |
Hey Mike, Very well spotted, thanks! It will be great if you can test the patches on your machine. cheers, Yordan On 9.08.19 г. 13:33 ч., Mike Auty wrote: > Hiya, > > I can't really review the rest of the code, my main language is python, > but I spotted a couple of minor typos that might be worth fixing? I > didn't want to post them to everyone since they're fairly trivial. 5:S > > "noRootWorn" might want to "noRootWarn" > "your one risk." might want to be "your own risk." > > Thanks for putting the patches together so quickly! 5:) > > Mike 5:) > > On 09/08/2019 09:06, Yordan Karadzhov (VMware) wrote: >> Running the KernelShark GUI with Root privileges is not recommended due >> to security reasons. The user will be allowed to continue on its own risk. >> >> Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> >> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204475 >> Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> >> --- >> kernel-shark/src/KsMainWindow.cpp | 28 ++++++++++++++++++++++++++++ >> kernel-shark/src/KsMainWindow.hpp | 2 ++ >> 2 files changed, 30 insertions(+) >> >> diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp >> index 6439265..2560bf8 100644 >> --- a/kernel-shark/src/KsMainWindow.cpp >> +++ b/kernel-shark/src/KsMainWindow.cpp >> @@ -76,6 +76,9 @@ KsMainWindow::KsMainWindow(QWidget *parent) >> _createMenus(); >> _initCapture(); >> >> + if (geteuid() == 0) >> + _rootWarning(); >> + >> _splitter.addWidget(&_graph); >> _splitter.addWidget(&_view); >> setCentralWidget(&_splitter); >> @@ -1271,3 +1274,28 @@ void KsMainWindow::_deselectB() >> _mState.updateLabels(); >> _graph.glPtr()->model()->update(); >> } >> + >> +void KsMainWindow::_rootWarning() >> +{ >> + QString cbFlag("noRootWorn"); >> + >> + if (_settings.value(cbFlag).toBool()) >> + return; >> + >> + QMessageBox warn; >> + warn.setText("KernelShark will have Root privileges."); >> + warn.setInformativeText("Continue on your one risk."); >> + warn.setIcon(QMessageBox::Warning); >> + warn.setStandardButtons(QMessageBox::Close); >> + >> + QCheckBox cb("Don't show this message again."); >> + >> + auto lamCbChec = [&] (int state) { >> + if (state) >> + _settings.setValue(cbFlag, true); >> + }; >> + >> + connect(&cb, &QCheckBox::stateChanged, lamCbChec); >> + warn.setCheckBox(&cb); >> + warn.exec(); >> +} >> diff --git a/kernel-shark/src/KsMainWindow.hpp b/kernel-shark/src/KsMainWindow.hpp >> index 62e66a0..4a7b8ab 100644 >> --- a/kernel-shark/src/KsMainWindow.hpp >> +++ b/kernel-shark/src/KsMainWindow.hpp >> @@ -238,6 +238,8 @@ private: >> >> void _deselectB(); >> >> + void _rootWarning(); >> + >> void _updateFilterMenu(); >> >> void _filterSyncCBoxUpdate(kshark_context *kshark_ctx); >> >
On Fri, 9 Aug 2019 11:06:21 +0300 "Yordan Karadzhov (VMware)" <y.karadz@gmail.com> wrote: > Running the KernelShark GUI with Root privileges is not recommended due > to security reasons. The user will be allowed to continue on its own risk. > > Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> > Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204475 > Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> > --- > kernel-shark/src/KsMainWindow.cpp | 28 ++++++++++++++++++++++++++++ > kernel-shark/src/KsMainWindow.hpp | 2 ++ > 2 files changed, 30 insertions(+) > > diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp > index 6439265..2560bf8 100644 > --- a/kernel-shark/src/KsMainWindow.cpp > +++ b/kernel-shark/src/KsMainWindow.cpp > @@ -76,6 +76,9 @@ KsMainWindow::KsMainWindow(QWidget *parent) > _createMenus(); > _initCapture(); > > + if (geteuid() == 0) > + _rootWarning(); > + > _splitter.addWidget(&_graph); > _splitter.addWidget(&_view); > setCentralWidget(&_splitter); > @@ -1271,3 +1274,28 @@ void KsMainWindow::_deselectB() > _mState.updateLabels(); > _graph.glPtr()->model()->update(); > } > + > +void KsMainWindow::_rootWarning() > +{ > + QString cbFlag("noRootWorn"); Mike already pointed this out (Thanks Mike!) > + > + if (_settings.value(cbFlag).toBool()) > + return; > + > + QMessageBox warn; > + warn.setText("KernelShark will have Root privileges."); > + warn.setInformativeText("Continue on your one risk."); Probably better to say: "KernelShark is running with Root privileges." "Continue at your own risk." -- Steve > + warn.setIcon(QMessageBox::Warning); > + warn.setStandardButtons(QMessageBox::Close); > + > + QCheckBox cb("Don't show this message again."); > + > + auto lamCbChec = [&] (int state) { > + if (state) > + _settings.setValue(cbFlag, true); > + }; > + > + connect(&cb, &QCheckBox::stateChanged, lamCbChec); > + warn.setCheckBox(&cb); > + warn.exec(); > +} > diff --git a/kernel-shark/src/KsMainWindow.hpp b/kernel-shark/src/KsMainWindow.hpp > index 62e66a0..4a7b8ab 100644 > --- a/kernel-shark/src/KsMainWindow.hpp > +++ b/kernel-shark/src/KsMainWindow.hpp > @@ -238,6 +238,8 @@ private: > > void _deselectB(); > > + void _rootWarning(); > + > void _updateFilterMenu(); > > void _filterSyncCBoxUpdate(kshark_context *kshark_ctx);
diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp index 6439265..2560bf8 100644 --- a/kernel-shark/src/KsMainWindow.cpp +++ b/kernel-shark/src/KsMainWindow.cpp @@ -76,6 +76,9 @@ KsMainWindow::KsMainWindow(QWidget *parent) _createMenus(); _initCapture(); + if (geteuid() == 0) + _rootWarning(); + _splitter.addWidget(&_graph); _splitter.addWidget(&_view); setCentralWidget(&_splitter); @@ -1271,3 +1274,28 @@ void KsMainWindow::_deselectB() _mState.updateLabels(); _graph.glPtr()->model()->update(); } + +void KsMainWindow::_rootWarning() +{ + QString cbFlag("noRootWorn"); + + if (_settings.value(cbFlag).toBool()) + return; + + QMessageBox warn; + warn.setText("KernelShark will have Root privileges."); + warn.setInformativeText("Continue on your one risk."); + warn.setIcon(QMessageBox::Warning); + warn.setStandardButtons(QMessageBox::Close); + + QCheckBox cb("Don't show this message again."); + + auto lamCbChec = [&] (int state) { + if (state) + _settings.setValue(cbFlag, true); + }; + + connect(&cb, &QCheckBox::stateChanged, lamCbChec); + warn.setCheckBox(&cb); + warn.exec(); +} diff --git a/kernel-shark/src/KsMainWindow.hpp b/kernel-shark/src/KsMainWindow.hpp index 62e66a0..4a7b8ab 100644 --- a/kernel-shark/src/KsMainWindow.hpp +++ b/kernel-shark/src/KsMainWindow.hpp @@ -238,6 +238,8 @@ private: void _deselectB(); + void _rootWarning(); + void _updateFilterMenu(); void _filterSyncCBoxUpdate(kshark_context *kshark_ctx);
Running the KernelShark GUI with Root privileges is not recommended due to security reasons. The user will be allowed to continue on its own risk. Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204475 Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> --- kernel-shark/src/KsMainWindow.cpp | 28 ++++++++++++++++++++++++++++ kernel-shark/src/KsMainWindow.hpp | 2 ++ 2 files changed, 30 insertions(+)