There is a double fetch problem in audit_log_single_execve_arg()
where we first check the execve(2) argumnets for any "bad" characters
which would require hex encoding and then re-fetch the arguments for
logging in the audit record[1]. Of course this leaves a window of
opportunity for an unsavory application to munge with the data.
This patch reworks things by only fetching the argument data once[2]
into a buffer where it is scanned and logged into the audit
records(s). In addition to fixing the double fetch, this patch
improves on the original code in a few other ways: better handling
of large arguments which require encoding, stricter record length
checking, and some performance improvements (completely unverified,
but we got rid of some strlen() calls, that's got to be a good
thing).
As part of the development of this patch, I've also created a basic
regression test for the audit-testsuite, the test can be tracked on
GitHub at the following link:
* https://github.com/linux-audit/audit-testsuite/issues/25
[1] If you pay careful attention, there is actually a triple fetch
problem due to a strnlen_user() call at the top of the function.
[2] This is a tiny white lie, we do make a call to strnlen_user()
prior to fetching the argument data. I don't like it, but due to the
way the audit record is structured we really have no choice unless we
copy the entire argument at once (which would require a rather
wasteful allocation). The good news is that with this patch the
kernel no longer relies on this strnlen_user() value for anything
beyond recording it in the log, we also update it with a trustworthy
value whenever possible.
Reported-by: Pengfei Wang <wpengfeinudt@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Change-Id: Ie9848961d236739df5014474f2c2a781af9fb811
Git-repo: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git
Git-commit: 43761473c254b45883a64441dd0bc85a42f3645c
Signed-off-by: Dennis Cagle <d-cagle@codeaurora.org>
Add thermal properties to enable kernel thermal monitoring and
mitigations like hotplug, thermal reset, vdd restriction, etc.
for msmfalcon. Add mitigation profiles for each physical CPU which
has information like sensor to monitor and various mitigation types
to enable for msmfalcon.
Change-Id: I36ca125143cf9929fb0bd781990bdd8ab1dbeebf
Signed-off-by: Manaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
Add thermal sensor related information, which provides information
such as alias, type and scaling factor to Kernel Thermal Monitor(KTM).
The KTM exposes these sensor information via sysfs to thermal-engine.
Change-Id: Ie564c181db61f6229479a49917cdb9e6c1887fc5
Signed-off-by: Manaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
Add checks of the user input count to avoid possible heap overflow
Signed-off-by: Min Chong <mchong@google.com>
Bug: 30937462
Git-repo: https://android.googlesource.com/kernel/msm.git
Git-commit: a6accafb252a76256f11c83e28c556c8ca4b8e1f
Change-Id: I6fc8323cbcf395a2c24e49e65cc7012709d031a2
Signed-off-by: Dennis Cagle <d-cagle@codeaurora.org>
Fix uninitialized references in gladiator_erp_v2, reported
by static analysis tool. While at it, log all error registers
for Gladiator error.
Change-Id: If2b81e8b8fd446a07bc92ff23f74cdaa9ed11ff5
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
This reverts commit 691ddba4ee ("msm: kgsl: Enable limits
management on A540v2"). The GPU does not hit the voltage
limits at 670mhz so there isn't any need to enable
limit management.
CRs-Fixed: 1056661
Change-Id: If225dc4ec2c2e3eb8996f49f4fdf6acd31a50680
Signed-off-by: Oleg Perelet <operelet@codeaurora.org>
Update the code name from msmcobalt to msm8998. As a result, update
the filename containing "cobalt" and files content containing "cobalt".
CRs-Fixed: 1070840
Change-Id: I2c7b95e3e2a2fec7730724da9eeb86a39a77faf1
Signed-off-by: Runmin Wang <runminw@codeaurora.org>
Signed-off-by: Kyle Yan <kyan@codeaurora.org>
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
In case of an error when configuring a pipe during kickoff,
driver unstages from HW the pipe that had the error, so it
makes sure this dirty pipe is not used by HW.
This is a problem if the pipe is configured in multi-rect
mode and we only fail one of the two multi-rect pipes since
in this case HW is expecting both multi-rect pipes that
represent the two HW rectangles and we are only configuring
one due the error that happened.
Fix this problem by making sure that if the configuration of
one multi-rect fail, we unstage both multi-rect pipes.
Change-Id: I09fbda8eb92c81acf24d0ff07ca9c040141680e1
Signed-off-by: Ingrid Gallardo <ingridg@codeaurora.org>
Falcon uses IPA HW to shunt data between
different components like apps, modem and usb.
Add a support to enable IPA node for falcon.
Change-Id: If2b37804d82160d7965ea1d0f6eb69f96b3514f4
Acked-by: Mohammed Javid <mjavid@qti.qualcomm.com>
Signed-off-by: Utkarsh Saxena <usaxena@codeaurora.org>
There is a requirement, for diag command handler, that needs
the separator between image variant and image OEM to be shown
as part of OEM value in sysfs. So change the relevant offset
and size to include this information in image oem sysfs
attribute.
CRs-Fixed: 1086976
Change-Id: Iae12fa648df17dddd48f3a71e94d06c2c3b03277
Signed-off-by: Imran Khan <kimran@codeaurora.org>
Correct description for ARCH_MSMFALCON and ARCH_MSMTRITON,
to match the guidelines.
Change-Id: I2e657f3237c7ed38111b7bc6bddbf07ef4420924
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
If a legacy Type-A to Type-C cable is attached to the phone, but the
Type-A end is left disconnected, then the VBUS capacitor will be charged
when DRP toggles to DFP mode. Since VBUS is charged it will prevent the
device from staying in power off state when shutdown.
Fix this by forcing UFP mode before shutdown so the VBUS capacitor will be
discharged, and therefore it will not trigger PON to restart the device.
Change-Id: I53f89cf6b7c11f32c5e8e5a51a5986fa31424b92
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
Currently, smb2 charger uses VBT_LT_CHG_RECHARGE_THRESH signal
from FG to enable auto recharge by default. Add support to
configure smb2 charger to use SOC_LT_CHG_RECHARGE_THRESH signal
from FG if needed.
This will enable charging to resume again when battery SOC drops
below the automatic recharge SOC threshold (configured in FG)
while charger is inserted and SOC goes down after the charge
termination had happened.
Change-Id: Ic68cd12cc861d04e107b70e2b96200483f13da26
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
enable_irq() called before processing responses in work handler
which would lead to miss interrupt from video hardware sometimes.
An interrupt from video h/w will queue the work to work handler
but if work is already running the new work is not posted.
work handler has two parts, one, read all the messages from video h/w,
two, process the messages. queue work while processing messages
will miss reading the new messages from video h/w because
the queue work (as a result of interrupt from video h/w) will not
actually queue the work as work handler already running. Fix the
issue by enabling irq after processing all the responses to
makesure interrupt coming from video h/w after work handler
completed processing the messages.
CRs-Fixed: 1086284
Change-Id: Id158e5c6d89fc8b761d8cfe92afbf3592877c556
Signed-off-by: Karthikeyan Periasamy <kperiasa@codeaurora.org>
RF clock 2 is not required on msmfalcon, so remove the clock instance and
add rf clk1 support instead.
Change-Id: I13258295e9ae9c8607586ed5686e97276823d08c
Signed-off-by: Taniya Das <tdas@codeaurora.org>
Modify the clock_gfx dummy clock to use the real clock controller for all
gpu clock controller clients.
Change-Id: If3c707877f2a0da04065b57a1c2fd44d256a5303
Signed-off-by: Taniya Das <tdas@codeaurora.org>
GPU clock controller is required to be enabled for GPU clocks
supported by GPU clock controller.
Change-Id: Ica381b0b73bd59a10ac8fd876bda5c21678dfddb
Signed-off-by: Taniya Das <tdas@codeaurora.org>
Add support for the multimedia clock controller found on MSMFalcon
based devices. This should allow most clocks for multimedia peripherals
which includes display, video, camera etc.
Change-Id: If8aa0b094af5ff82fe66c95e3ef2f13632950d2e
Signed-off-by: Taniya Das <tdas@codeaurora.org>
Fix GSI interrupt processing to make sure interrupt are
not missed. In order to achieve that interrupt should first be
cleared before processed.
Change-Id: I42978f2230e95456e4b4e932365e5b2c83445f56
CRs-Fixed: 1090894
Acked-by: Ady Abraham <adya@qti.qualcomm.com>
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
Add mpm2-sleep-counter device node, which is used by the
boot_stats driver.
Change-Id: I2c8ffe10b650777f6c0b697c33e958300c9dbe66
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
Add mpm2-sleep-counter device node, which is used by the
boot_stats driver.
Change-Id: I32fb4c9a9be83a4448754bffde798432e417b17c
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
Add device tree entry for performance monitor unit (pmu) on msmfalcon
and msmtriton.
Change-Id: I97a28cccc0494ea5ff45ccade9721da0c85edef7
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
Gate clocks would also require to set the flags using
clk_set_flags. Add the clk_ops for the same.
Change-Id: I9d180e4aedb17692eb2e48f98461239d29bbf975
Signed-off-by: Amit Nischal <anischal@codeaurora.org>